Getting Started with Twilio for WhatsApp (Beta)

Twilio now supports sending and receiving messages to and from WhatsApp users! The WhatsApp channel helps expand your reach and availability to your important contacts on any platform that is convenient for them. Best of all, WhatsApp messages are controlled by Twilio's existing Programmable SMS API. Here's what you need to know to get started.

Beta Testing Limitations

Message Sender: WhatsApp messages can be sent and received right now via the Twilio Sandbox for WhatsApp. This allows you to build out your app, and test sending and receiving messages with your Twilio account using one of our sandbox test numbers.

To use your own Twilio number(s) with WhatsApp, they will first need to be enabled for use with the WhatsApp channel. During the beta process, WhatsApp is gradually approving activations, so your request may not be approved right away. To sign up for the WhatsApp Sandbox and begin testing, as well as request notification when WhatsApp is ready to onboard more users, visit the WhatsApp Sandbox in Console.

Message Content: Outbound messages to WhatsApp users must be sent using pre-approved templates. When your Twilio number has been enabled for use with the WhatsApp channel, you will have the opportunity to create your own templates. For examples, visit the WhatsApp Sandbox in Console.

Responses to incoming messages do not have a template requirement.

Please Note: The WhatsApp Channel is currently in beta, and has not yet been finalized. For more information on Support limitations for beta products, please see our article Twilio Beta Product Support.

Twilio Sandbox Activation

To begin testing the WhatsApp channel now, you must first activate the Twilio Sandbox for WhatsApp. You'll need to select a Twilio test number for use, and have any users testing in WhatsApp join your particular sandbox. Once this has been completed, you can add your WhatsApp webhook. To setup the Twilio Sandbox for WhatsApp, visit Console.

Send a Message to a WhatsApp User

To send a WhatsApp message, your application needs to make an HTTP POST request to Twilio’s Programmable SMS Message REST API resource with three required pieces of information; A recipient, a sender, and your message.

  • Recipient: The To parameter consisting of whatsapp: followed by the destination WhatsApp user number (using E.164 formatting).
  • Sender: The From parameter consisting of whatsapp: followed by the sending WhatsApp number (using E.164 formatting).
  • Message: The Body parameter consisting of the desired message you wish to send.

Here’s an example cURL script:

curl -X POST \
--data-urlencode "To=whatsapp:+13105555555" \
--data-urlencode "From=whatsapp:+12125551234" \
--data-urlencode "Body=Your appointment is coming up on {{Date}} at {{Time}}" \

This example will contact the destination (310) 555-5555 from the sender (212) 555-1234 via the WhatsApp app, and send the following message:

Your appointment is coming up on {{Date}} at {{Time}}

To make this script work for you, make the following updates, and then paste it into a terminal window:

  • Line 1 update with your Account SID
  • Line 2 update with a valid destination
  • Line 3 update with a valid sender number
  • Line 4 update with your desired message
  • Line 5 update with your Account SID and Auth Token.

Additional Resources

Have more questions? Submit a request
Powered by Zendesk