This document explains the steps needed to integrate your chatbot with WhatsApp. Here we focus on using Twilio.
The architecture is as follows: Twilio receives the user messages and there is a webhook to process those messages (the webhook must be configured on Twilio). It should interact with some procedures of the GeneXusChannels module so the messages are formatted, and sent to the chatbot.
At the end of the process, the response message is sent to Twilio to be sent to the user's WhatsApp.
In the webhook procedure, set the Authorization Token given by Twilio.
Below is the architecture schema and details on the solution.
See Chatbots using Whatsapp: How to set up Twilio.
The Webhook is automatically generated by configuring in the KB the following properties:
It's generated under the instance's module, and its name is WhatsappWebhook.
Warning: The URL to the web hook should include the module. I.e, in .NET: http://server/baseURL/moduleName.WhatsappWebhook.aspx.
The Auth Token of Twilio is stored in the configuration file.
The following are some of the data types used, which are part of the GeneXusChannels Module.
The Message SDT belongs to the GeneXusChannels Module and allows you to specify the messages to send. Define messages of a specific type, such as grids, videos, images, etc.
It supports sending a text message and a payload for multimedia.
This SDT is used for storing the information returned by the channel.
It allows specifying the channel (Messenger, Whatsapp) and the configuration parameters (collection Key - Value pair).
If the user receives no answer, please check:
- Twilio logs.
- Generator trace. For instance, activate the ASP Net trace when using .NET.
Since GeneXus 16 upgrade 6
Note: Chatbot without NLP (command oriented)
If you want to have a chatbot that doesn't use NLP (Natural Language Processing), you don't need to call the SendMessageFromChannel procedure. You only need to use the WhatsappTwilioWebhook to load the ChannelConfiguration, then process the &Message received, and use the GeneXusChannels.Message.SendMessage procedure to send the response to the final user.
In this case you only need the GeneXusChannels module (you don't need to install the Chatbot module).
Since GeneXus Beta the Chatbot generator generates automatically the kind of chatbots that do not use NLP. See Scripted Chatbots.
Do a checkout of the KB from here.