Twilio WhatsApp Integration

To register a mobile number in Twilio, follow these steps:


StepsDetails
1

Get a Twilio account

Signup for a trial/paid account from Twilio Navigate to WhatsApp sandbox using the link.
2Getting Started with Twilio for WhatsApp

See Getting Started with Twilio for WhatsApp to setup Twilio to send and receive WhatsApp messages.

3Get a Twilio Phone Number
  1. On Twilio dashboard, under All Products and Services, select Super Networks > Phone Numbers. 
  2. Get an SMS capable Phone Number.


4

Sandbox setup

Navigate to the WhatsApp tab from the Programmable SMS section or use this link.
5Configure Webhook
  1. Click the number to specify Hybrid Chat web hook against Messaging > A Message Comes In.
  2. Specify https://hybrid-chat-public-fqdn/ccm/msg-client/receive, where hybrid-chat-public-fqdn is  the public FQDN of the machine where Hybrid Chat solution is installed. 
  3. Add the number in your WhatsApp contacts and send a WhatsApp message as described by Twilio. 

Twilio will use this API to push any incoming Whatsapp messages. 

6Specify Twilio Phone Number in Hybrid Chat

Under Customer Channel Manager (CCM) Environment Variables, specify the Twilio phone number for TWILIO_FROM_NUMBER environment variable.

7Enable WhatsApp capability

Add WhatsApp capability to the Twilio registered number.

8Add Twilio SSL certificate in Hybrid Chat trust storeIf the CCM SSL_TRUST_STORE_PATH environment variable is set, then you will need to add a Twilio SSL certificate to our trust store. Open https://twilio.com in Chrome, export certificate and follow these steps to add the certificate to the trust store.


Limitations



1Opt-ins and Opt-outs are not supported yet. 
2Formatting a WhatsApp message is not supported.
3WhatsApp notification message via Templates are not supported.


Environment Variables for Twilio Integration 

Following CCM environment variables must be configured for Twilio integration. See Customer Channel Manager (CCM) Environment Variables for a complete list of all environment variables.

Variable NameDescription

TWILIO_API_ACCOUNT

Unique 34 character SID of the Twilio Account, e.g., AC496763443da6c75e0f1b5f27ddb3f515

TWILIO_API_TOKEN

Twilio auth token

example: 100865823c710ff641409f5703f50f98

TWILIO_FROM_NUMBER

Number registered with Twilio to send outbound SMS from. Use same format that is mentioned in Twilio dashboard.

TWILIO_WHATSAPP_FROM_NUMBER

Number registered with Twilio to send outbound WhatsApp messages from. It consisting of whatsapp: followed by the sending WhatsApp number (usingE.164 formatting). For example, 

whatsapp:+14155238886
TWILIO_OUTBOUND_API_URL (optional)

Twilio Outbound SMS REST API URL

If this variable is not set the default URL is constructed using TWILIO_API_ACCOUNT. For example, https://api.twilio.com/2010-04-01/Accounts/AC496763443da6c75e0f1b5f27ddb3f515/Messages.json

TWILIO_STATUS_CALLBACK

CCM receives SMS delivery status notification on http[s]://CCM-HOST/sms-client/delivery-notification. When this variable is set, it is pushed with every outbound SMS to Twilio and Twilio uses this value a webhook to push SMS delivery notification back to CCM

  1. Specify the exact callback API URL according to your host IP/FQDN and the port the connector is running on.
  2. Specify the same callback API URL against Twilio statusCallBack

For example, https://<FQDN>/sms-client/delivery-notification, where

(a) sms.hybrid-chat.com is the FQDN of your HOST where CCM is running and

(b) 8080 is the service port.

WHATSAPP_ROUTING_POLICY

A directive for Hybrid Chat to decide routing of requests from a WhatsApp number.

DEFAULT

No directive from Channel Manager for the Hybrid Chat bot or chat-server. HybridChat will route requests either to the bot or the agent based on the Bot training and chat-server configurations.

BOT_ONLYChat requests should not be routed to the agent even if the Bot's confidence level for a response is below confidence threshold.