Last updated
Last updated
WhatsApp is a great platform for easy "On the go" access to lots of information. While most people use WhatsApp to speak to friends and family, with logicdialog it's also really easy to connect your digital assistant to a WhatsApp telephone number so that your users can access the information your bot provides on the go.
To enable use of WhatsApp, logicdialog makes use of a platform called Twilio. Twilio is an international platform that supports messaging across a number of different channels including voice, SMS and social channels such as WhatsApp. It's trusted by companies such as Marks & Spencer and Stripe, and makes it simple to deploy solutions on these channels.
If you want to have your assistant on WhatsApp then there are a few steps to follow. These are outlined below :
Registering with Twilio is easy and free. There are no card details required and you only need a name, email address and password.
Once registered you'll be able to log into the dashboard to provision various services as needed. If you need a mobile number (for SMS, Voice, WhatsApp etc) then these come with certain costs. These are outlined on the following page.
At this point however you do not need to create any resources. All you need to do is to copy down the Account SID and Auth Token found on your dashboard home page, as shown below.
Twilio communicates with logicdialog via a webhook
. This is essentially an address that information is sent to when events occur - a user typing a message in this case.
You will use a webhook for both your live solution, and while in testing. The process is the same, however where you apply the webhook settings will be slightly different.
For the purpose of testing we can make use of a WhatsApp sandbox
that is free to use, but operates in exactly the same way as a live environment. You'll find this under the Settings
menu, from within the Messaging
section, as shown below.
On this page you'll see at the top there is an input field for When a message comes in
. Set this value to be :
https://backend.logicdialog.ai/input/twilio/text
You will also need to ensure that the drop down option has HTTP Post
selected.
Once you have done this, note down the telephone number, shown on this page. This is often an American number, and in this instance is +1 415 523 8886
.
Before you can test the solution, add the telephone number, together with the Account SID, and Auth Token from the previous step, to the Channel on LogicDialog.
Note the format of the phone number, WhatsApp numbers must be prefixed by whatsapp:
To test the solution, first go through the Sandbox setup steps. Once all steps are completed, messages to the sandbox
In the case of the image above, I would send the phrase join rod-giant
to +1 415 523 8886
in order to join the sandbox.
Any user can follow this process to join the sandbox however their membership will only last 72 hours.
Upon sending the message you should receive confirmation that you have joined the sandbox. From this point on you'll be able to send a message to your bot, and have it reply as appropriate.
You'll be able to interact with your bot as normal. Please note though that buttons are not a supported format on WhatsApp and so logicdialog automatically converts the buttons into a series of choices as shown above. A similar thing is done for any buttons with links or telephone numbers in. The message at the start of the choices can be configured as required on the WhatsApp configuration page.
In order to use a specific phone number with WhatsApp you need to be approved. This involves going through a registration process with Twilio to confirm your identity and the purpose for the phone number.
To request access, select WhatsApp senders from the Senders menu within the Messaging options. The Sign up to request access
will take you through a series of steps you'll need to complete before you have access.
Once you have completed the registration process you will have a number that you can administer. There will be a similar setting to the one used for the sandbox where you can set the same webhook URL. Remember to update the phone number on the WhatsApp configuration page.