Chatbots using Whatsapp: How to setup Twilio

Unofficial Content
This documentation is valid for:

Here we explain how to setup Twilio in order to use Whatsapp as a messaging platform for the Chatbot generator.

Twilio Sandbox for WhatsApp allows you to prototype with WhatsApp immediately, without waiting for your Twilio number to be approved for WhatsApp.

Summary

Creating the account

First, create a new account in Twilio.

image_201994155718_1_png

You'll be asked to verify your email:

image_20199513421_1_png

Then, you'll be asked to verify your phone number:

image_201995134351_1_png

Joining the sandbox

You'll have to go through some steps:

image_2019913162343_1_png

image_2019913162411_1_png

Here you can skip to dashboard:

image_2019913162437_1_png

Then go through  "All Product & Services" and select "Programmable SMS". In a new window that appears, you have to select "WhatsApp" and it asks you if you want to activate the Sandbox.

image_2019913163921_1_png

To activate the sandbox, a page like this one appears:

image_2019913162539_1_png

Select a number from the available sandbox numbers:

WA_Sandbox.png

There's a learn tutorial which you can follow easily.

The sandbox is pre-provisioned with a Twilio phone number.
Send “join <your sandbox keyword>” to your Sandbox number in WhatsApp to join your Sandbox.

image_201994161336_1_png

After joining, you will receive a message from the sandbox:

image_201994161028_1_png

See here for more details.

Configuring inbound message webhooks

When customers send you a WhatsApp message, Twilio sends a web hook to your application.

On the sandbox page you have to configure the URL that Twilio sends a web hook to for inbound messages.

You'll need to create your web hook in GeneXus, and after building it, configure the URL as follows. Note that the machine where the webhook is hosted, has to be visible from Internet:

image_201994164137_1_png

Configuration Settings

In the console page, you have the Account SID and an Authorization Token. These credentials are needed to the interaction with Twilio.

Account SID - Used to identify yourself in API requests
Auth Token  - Used to authenticate REST API requests

image_201995143334_1_png

Note:

If you have joined your Sandbox > 24 hours ago, you will need to send a fresh inbound message to your WhatsApp number in order to then send yourself a media message. Otherwise, you'll get the "ERROR - 63016
Failed to send freeform message because you are outside the allowed window. Please use a Template."