March 10, 2021

Integrating WhatsApp to Oracle Digital Assistant (ODA) as a client via Twilio

In this post, we are going to see how to connect WhatsApp as a client to have a conversation with Oracle Digital Assistant. 

In order to achieve this integration, we need to create a sandbox in Twilio and create a channel in ODA for Twilio. We need a Twilio account to do this integration. We will see each of these setups.

Setup Testing Sandbox in Twilio for WhatsApp

We need to create a sandbox for WhatsApp, which follows the below procedure. 

  • Login to Twilio
  • Under "All Products & Services", select the "Programmable Messaging" option. 
Twilio Programmable Messages Option
  • Its dashboard will be opened. You can observe a message like below to start connecting WhatsApp. Click on the link.

Building with whatsapp

  • Sandbox setup for WhatsApp will be started
Setup testing Sandbox for WhatsApp in Twilio
  • Save the given phone number on your mobile
  • Send the given message (ex: join ring-worried) from your WhatsApp to the above number
  • You can observe the confirmation on the screen for your message
Setup testing Sandbox for WhatsApp in Twilio 2
  • Click on the "Next" button below
  • Ignore the step "Send a One-Way WhatsApp Message" and click on Next
  • You can send a reply to the message on your device which will be displayed here. You can send a message from the console and see the message on your WhatsApp. This is to test the Two-Way messages from your WhatsApp to Twilio and vice versa, though this step is not mandatory.
Setup testing Sandbox for WhatsApp in Twilio 3
  • Click on Next
  • Copy and paste the webhook URL created in the ODA channel (which will be shown in next steps) into the "WHEN A MESSAGE COMES IN" input field as shown in the below picture
Setup testing Sandbox for WhatsApp in Twilio 4
  • Click on Save

Setup ODA Channel for Twilio

  • Login to ODA
  • Go to Channels
  • Click on "+ Channel" button to create a new channel
  • Enter name & description of the channel
  • Select Channel Type as "Twilio SMS"
  • Copy-paste the Account SID and Auth Token from the Twilio account dashboard
  • In the Phone Number field, enter the phone number you saved on your device which was given by Twilio in the above procedure
  • Make sure you prefix the phone number with "whatsapp:" and the phone number should be in international format. You can refer to the below screenshot for the inputs 
Creating ODA channel for Twilio
  • Click on the "Create" button, the channel will be created
  • Select a skill or digital assistant from the "Route To" drop-down
  • Enable the channel
  • Copy the Webhook URL and past it in the "WHEN A MESSAGE COMES IN" input field of the Twilio Sandbox created in the above procedure
Channel creation for Twilio in ODA

Now the WhatsApp is ready to start the conversation with ODA. You can test the chatbot now. See the below screen for your reference.

Connecting ODA chatbot through WhatsApp

#chatbot #DigitalAssistant #ODA