Connect with 2 billion WhatsApp users via messages and templates.
The Twilio WhatsApp source provides a channel for sending and receiving WhatsApp messages using the Twilio API.
What you will learn
- The required steps to configure the Twilio WhatsApp source
- How to connect a Twilio WhatsApp source to Airy Core
The WhatsApp via Twilio source is not enabled by default.
You need to add configuration in your airy.yaml file and apply it to activate it.
Twilio is a communication platform specialized in phone services. Airy Core supports Twilio as a provider of 2 different sources: Twilio WhatsApp and Twilio SMS. The Twilio provider requires the following configuration:
- Connect a Twilio provider to your instance
- Send and receive messages with the Inbox UI
Let's proceed step by step.
First, to connect a Twilio provider to your Airy Core instance, you must have a Twilio account and a phone number. If this is not your case: head over to Twilio's website, create an account and buy a phone number.
Then, you need to request access to enable your Twilio number for WhatsApp by completing the request form on Twilio's website. To request access, you need to have a Facebook Business Manager ID: read Twilio's documentation for more information on the request process.
Once you have a Twilio account, log in and find your Twilio auth token account SID on your Twilio dashboard (underlined in red in the screenshot below).
Copy and paste your
Auth token and
Account Sid as strings next to
components/sources/twilio in your
Make sure the
Auth token and
Account Sid are contained within a pair of either single quotation marks '' or double quotation marks ""
and paste the tokens as they are (do not add or remove additional spaces).
Refer to the Configuration Docs on how to input these values.
After editing the
airy.yaml file, create an Airy Core instance.
You are now ready to configure the Webhook.
On the Twilio dashboard, open the left menu sidebar and go to the Phone numbers section.
Select the phone number that you want to use and copy and paste your Twilio Webhook URL as the Webhook URL of your phone number (in 'Messaging', below 'A MESSAGE COMES IN' - 'Webhook' should be selected from the dropdown).
Your Twilio Webhook URL should have the following format:
or if you are using Ngrok:
Success! You are now ready to connect a Twilio.WhatsApp source to your Airy Core instance 🎉
There are 2 options to connect a Twilio.WhatsApp source to your instance:
- you can connect the source via an API request (using curl or platforms such as Postman)
- you can connect the source via the UI
We cover both options in this document.
You connect connect a Twilio.WhatsApp source by sending a request to the Channels endpoint.
Connect a Twilio.WhatsApp source to your Airy Core instance through the Channels endpoint
phone_numberThe phone number as listed in your Twilio dashboard. It must not have spaces and must include the country code.
nameis the custom name for the connected phone number
image_urlis the custom image URL
You can connect a Twilio.WhatsApp source via your Airy Core instance UI.
On your instance's Airy Core UI, click on 'Channels' on the left sidebar menu and select the WhatsApp channel. Add your Twilio phone number in the Twilio Phone Number field. You can optionally add a name and an image.
Your twilio.whatsApp channel will appear as connected in the UI.
After connecting the source to your instance, it's time to create a conversation between your Airy Core instance, and a Twilio.Whatsapp source.
Send a text message (Whatsapp) from a mobile phone to the Twilio phone number you have used. This will create a conversation: a Twilio.Whatsapp conversation will appear in the UI with the text message you have sent.
If the channel has been successfully connected, but the message you sent does not appear in a conversation and a conversation is not created, please see below for debugging advice.
If you encounter errors, please follow this debugging advice:
make sure that the authToken and accountSid tokens you have added to the airy.yaml file (refer back to step 1) have been applied to your Airy Core instance. An Airy Core instance should be created after editing the airy.yaml file.
verify your webhook integration (refer back to step 2). Make sure that your Twilio Webhook URL has been correctly added to your phone number in your Twilio dashboard (check for typos). The Webhook URL should be added in the 'Messaging', 'Incoming Message' section.
check the messaging logs in your Twilio dashboard (see screenshot below): select your phone number from the phone numbers list, click on the Messaging Logs tab, and select Incoming from the dropdown. The error codes from the logs are precious hints of API errors' causes.
Once a conversation has been successfully created, you will be able to send messages through the Messages endpoint.
Send messages to your Airy Core instance from different sources through the Messages endpoint
Sending a text message
To send media you need to enable MMS for your phone number.