skip to Main Content

By reading the Twilio tutorial, I am able to place outbound calls. But, can you point out a tutorial where I can find information that teaches how to place a outbound call in Twilio using a custom message (.i.e Good morning my friend)? On Twilio website there are several tutorials showing how to place calls, but I wasnt able to find any showing how to customize the message spoken when the call is placed.

2

Answers


  1. Twilio developer evangelist here.

    When you place an outbound call with Twilio you provide a URL parameter that points to some TwiML that tells Twilio what to do with the call next.

    You can customise the message by customising the TwiML that you respond with. You need to return the TwiML you want. For your example you can return:

    <Response>
      <Say>Good morning my friend</Say>
    </Response>
    

    If you want to return dynamic content then you need to generate this TwiML from a web application.

    There are a whole bunch of tutorials for building custom voice applications with Twilio in the documentation here.

    Let me know if that helps at all.

    Login or Signup to reply.
  2. Just for new upcoming who want to know how to customize Twilio calls message, you can use twiml key in the passed array to create method, a full snippet is below:

    
    $twiml_msg = '<Response>
    <Say voice="woman" language="en-US">
        Hello NAME_HERE,
        Thank you for your interest in our product!
        Regards
    </Say>
    </Response>';
    
    (new Client($account_sid, $auth_token))
        ->calls
        ->create(  
            $to_number,
            $twilio_number,
            array(
                "twiml" => $twiml_msg
            )
        );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search