Twilio WhatsApp Adapter
To enable Twilio WhatsApp as an engagement adaptor, a number of steps need to be followed:
- Configure your endpoint
- Register a Twilio account
- Purchase an WhatsApp-enabled Twilio number
- Configure Twilio in your ServisBOT organization
- You will need a working bot. Use our getting started tutorials if you need one. Make sure it is working by testing it using the default endpoint before proceeding.
- Access to Twilio services with the ability to purchase a whatsapp-enabled number.
Create a new Twilio WhatsApp Endpoint for your Bot
- Set the endpoint target to be for your working bot.
- Change the endpoint type to Twilio WhatsApp and save it.
- A secret containing the following properties should be present:
- Twilio accountSid
- Twilio authToken
- Twilio whatsapp phoneNumber
Example Endpoint Configuration
An Endpoint can be configured to allow communication between Twilio and ServisBOT. To do so, the
EngagementConfig must be configured:
You will need the URL to your endpoint in order to configure your bot in Twilio.
Set up your phone number to be used with WhatsApp on Twilio
- You will need to the following guide to enable your Twilio numbers to be used with WhatsApp
- Once you have a WhatsApp enabled number, make sure it matches the one in the secret.
- Navigate to the configuration of the WhatsApp number you wish to use.
- Set the following options:
- Messaging endpoint (see below for more details) / HTTP POST
The Messaging endpoint
The Messaging endpoint takes the form:
Example for the current public ServisBot Regions:
Setup Twilio Secret
Get Twilio Credentials
- Navigate back to the Twilio dashboard.
- Under “Project Info”, copy your Account SID and Auth Token.
Create ServisBOT Secret
- Create a new ServisBOT secret of type Custom JSON.
Here’s what the secret should look like:
"accountSid": "ABC12337", //your-twilio-account-sid,
"authToken": "uui1234dcu", //your-twilio-auth-token,
"phoneNumber": "whatsapp:+141555555" //your-twilo-whatsapp-phone-number
- Edit the endpoint and assign your Twilio secret to it.
Test your Bot
- Send a text message to your Twilio number
- A response will come back to you from your Bot
Supported Timeline Elements
- Card: Will display the image and title in the WhatsApp messenger.
- StaticMap: Will display a map of the location in the WhatsApp messenger, with a clickthrough to the location on Google maps.
- TextMsg or a Dialog node: Will display as a regular text message.