Configure Twilio for WhatsApp

Luma is available through many different chat channels but for some organizations WhatsApp is the way their users communicate with each other and with the support team. The Twilio API for WhatsApp helps organizations send and receive messages to WhatsApp users using the Twilio Messaging API. 

To configure the WhatsApp chat channel, a Skills Builder Administrator needs to complete the following high-level steps:

  1. Register in Twilio by creating an account. Once the account is created, set up billing for the Twilio messages/transactions. For details about the pricing and billing, refer https://www.twilio.com/whatsapp/pricing/us.
  2. From Twilio, copy the Account SIDAuth Token, and finally the Sender number and retain them in an easily accessible location such as notepad or a text editor tool.
  3. Configure the WhatsApp chat channel in Luma using the Account SID, Auth Token and Sender number from the Skills Builder.
  4. Enable the WhatsApp channel in the Skills Builder.

Register in Twilio

To use WhatsApp with Luma, you need to first register on Twilio. To do so:

  1. Navigate to the Twilio website by entering the URL www.twilio.com.
    The Twilio home page appears as shown below.

  2. Create an account in Twilio by clicking Signup.

  3. Once the registration is completed, on the Create a Project page (which appears after submitting the verification code), on the Templates tab, select the SMS Chatbot tile.
     
    The Twilio home page appears, and your are prompted to login.

  4. Enter the Login ID and click Next as shown below.
  5. Enter the Password to login.
  6. Confirm that you are not a robot by selecting the check box.
  7. Click Login.

    The Custom Project page appears as shown below.
  8. Enter a new Project Name and click Continue.
  9. If you want to add anyone to this project for the purpose of development and to track the progress, then you can invite them to Twilio by clicking Invite a Teammate. Else, click Skip this Step to proceed to the next page.

    The Project Dashboard page appears as shown below.
  10. Copy the Account SID and Auth Token and keep it at an easily retrievable location such as notepad or a text editor tool.
  11. Click the Programmable SMS link to integrate with Whatsapp.
    The Programmable SMS Dashboard page appears as shown below.
  12. On the Programmable SMS Dashboard page, click WhatsApp Beta from the left menu.
    The Activate your Sandbox dialog box appears as shown below. The Twilio Sandbox for WhatsApp helps you to access a shared WhatsApp phone number, pre-approved for Twilio developers. 
  13. To setup your Sandbox, go through WhatsApp's Terms of Service by clicking the link and select the check box to agree and see your Sandbox. 
  14. Click Confirm.

    The Twilio Sandbox for WhatsApp page appears as shown below.
  15. In the Sandbox Configuration section, include the Message URL from Luma in the When a Message Comes in field. The URL entered in this field is used by Luma to receive message from Twilio.
  16. In the Sandbox Participants section, copy the WhatsApp number and joining code and save it at an easily retrievable location such as notepad or a text editor tool.
  17. Click Save.

Twilio Pricing

Once your Twilio account is created, ensure that you set up billing for the Twilio messages/transactions. There are two types of messages - session message and WhatsApp template message. A WhatsApp Session message is any message sent or received in response to a user-initiated session. A messaging session starts when a user send a message to Luma, and lasts for 24 hours from the most recently received message. You can wait for users to message, or you can send a Template Message to invite the user to respond.

A WhatsApp template message is Luma initiated (follow up, approval, or resolution). They are pre-approved message templates for outbound notifications such as delivery alerts and appointment reminders. A WhatsApp Template Message can be used if more than 24 hours have elapsed since the user last responded to you. Any other type of message will fail. 

For more details on how much Twilio charges for the different types of messages, refer https://www.twilio.com/whatsapp/pricing/us.

Enable WhatsApp Channel in Skills Builder

To enable WhatsApp in Skills Builder, do the following: 

  1. On the Bots dashboard, from more options  click Bot Configuration as shown below.
  2. On the Bot Configuration page, click the Channels tab.
    The Channels page appears as shown below.
  3. Select WhatsApp from the Configure Channel list.
    The Configure WhatsApp dialog box appears as shown below.
  4. Paste the copied Account SID, Auth Token (from step 10 in Register in Twilio section) and Sender Number (from step 16 in Register in Twilio section) from Twilio in the Configure WhatsApp dialog box. 

  5. Copy the Message URL and paste it in the Twilio Programable SMS > WhatsApp (Beta) Sandbox > When a Message Comes in (step 16 in Register in Twilio section). You can use the copy icon to the right to simplify the operation. 

  6. Click Save to enable the WhatsApp channel. The WhatsApp channel is now enabled.
  7. The configured WhatsApp is shown on the Channels page.
    1. If required, use the toggle button () to make the channel inactive. You can inactivate the WhatsApp if you do not want to use it. 
    2. If required, use the edit button () to edit the WhatsApp details.

Chat with Luma

Once the Twilio sign up is completed and WhatsApp is enabled in the Skills Builder, to chat with Luma, do the following:

  1. On your phone, add the WhatsApp contact (with the number saved in step 16 in Register in Twilio section).
  2. Once the contact is added, enter the joining code as shown below.
  3. After registration, you can execute the skills.