We are thrilled to announce the release of the Xatkit’s WhatsApp platform. After our Telegram platform you now have two options to built chatbots that will “live” in your clients mobile phones. And as always, this platform can be combined with all the other ones so you can create bots that talk with your customers on WhatsApp but then alert you about the results of such interactions on Slack or by email.
WhatsApp is supported by using Twilio as communication middleware. So you’ll need to have your own Twilio account to create your bots. Once setup, Xatkit will communicate with Twilio to get new WhatsApp updates and to tell Twilio what to post on the client’s WhatsApp channel.
All this is internal to Xatkit, so your bot doesn’t need to care about how the API requests and webhooks are set, our platform will take care of it. As you can see in this very simple bot (part of the open source WhatsApp by Xatkit platform, so feel free to “play” with it), when the client sends a WhatsApp, Twilio warns Xatkit and the text of the message is processed as usual to recognize the intent of the message (using any of Xatkit’s available NLP connectors such as the one for DialogFlow). Once the intent has been matched, the bot can reply with text or text plus images.
Just remember to first setup the following two only mandatory configuration parameters to link Xatkit with your Twilio account:
- The Account SID
- The Auth Token
As any other configuration option, you can set them in a separate file or directly in the bot java file
botConfiguration.addProperty("xatkit.twilio.username", "Your twilio user id"); botConfiguration.addProperty("xatkit.twilio.auth.token", "Your twilio auth token");
Both values can be retrieved from the Twilio console.
Now you can just say that you’ll be working with the Twilio platform and its declared Event Provider
val botModel = model() .usePlatform(twilioPlatform) .listenTo(twilioEventProvider) .initState(init) .defaultFallbackState(defaultFallback);
At this point, your bot will be up and running and waiting for Twilio’s events to start coming. But there’s still a missing piece: we have not said to Twilio where to find our bot! We need to tell Twilio the public URL where to forward the events to.
If your bot is deployed on a server, then just tell Twilio the server public URL (including the port number of the Xatkit server). Make sure to add ‘/twilio’ to the end of the URL, example: “http://serverurl/twilio”
If you don’t have yet the bot deployed but want to try it locally, use ngrok (or any other similar tool) to redirect public URLs to your internal localhost.