Note: This code pattern uses the classic Watson Assistant experience. After October 8, 2021, all instances (except the standard plan) can switch between the classic and new Watson Assistant experiences by going to the upper-right corner of the Watson Assistant screen and clicking the Manage icon.


In this code pattern, build a framework that lets users send voice queries using the WhatsApp application and get a response from IBM Watson Assistant. The query from the user is sent to the Watson Speech to Text Service through a custom application. The output from the Watson Speech to Text Service is then fed to Watson Assistant. Watson Assistant responds back to the user with an appropriate answer.


Conversational AI voicebots are helping businesses automate repetitive and time-consuming queries. This gives your team more time to tackle more complex, high priority strategic tasks, while still ensuring that the customers are engaged. Voicebots take in voice input and can ingest, analyze, interpret, and respond to customer inquiries, with the goal being able to answer a customer’s question in real time or being able to continue a text exchange with the customer to clarify the question.

A voicebot is useful in many scenarios where typing is not a convenient option, such as:

Elderly customers who find it more convenient to speak than to type. Some customers have better spoken language skills than written language skills. They find it easier to use voicebots.
Delivery executives on the move with a need to update systems.

This code pattern uses the scenario of a customer speaking Brazilian Portuguese through the WhatsApp application to interact with a customer care center. A framework is built that lets the customer send queries using speech on WhatsApp, and then get a response from Watson Assistant. The user’s query is sent to the Watson Speech to Text Service through a custom application. The output from the Watson Speech to Text Service is then fed into Watson Assistant. Watson Assistant understands the query with the help of the built-in support for Brazilian Portuguese and responds back to the user with an appropriate reply. This code pattern can be configured to support multiple languages. Watson Assistant supports these languages.

Related work from others:  Latest from MIT : Learning the language of molecules to predict their properties

When you have completed this code pattern, you understand how to:

Use the Watson Speech to Text Service
Use the Watson Assistant Service
Integrate WhatsApp with Watson Services
Handle queries sent over voice on WhatsApp

Flow diagram

The user sends a voice or text message in the WhatsApp application.
The message is redirected to the Twilio Programmable Messaging service.
Twilio redirects the message to the voicebot application that is deployed on IBM Cloud or Red Hat OpenShift.
If the user sent a voice message, the voicebot application uses the Watson Speech to Text Service to transcribe the message into text.
The text message is sent to Watson Assistant.
The Watson Assistant chatbot detects the intent and replies with a response.
The Twilio Programmable Messaging service redirects the response message to WhatsApp.
The user is able to view the response message on WhatsApp.


Find the detailed steps in the README file. Those steps explain how to:

Clone the repository.
Create the Watson Services.
Create the Twilio Service.
Build and deploy the voicebot application.
Try out the voicebot application on WhatsApp.

Similar Posts