Inspirisys-Facebook-Page

Low code Chatbot from Watson Assistant integrated with Twilio

Standard Post with Image

Abstract

Low-code chatbot from Watson Assistant integrated with Twilio

Enterprises rank customer experience as one of the prime differentiators towards their competitive advantage-building initiatives. It is also a way to define and differentiate their brands, as well as build and maintain a loyal customer base. However, this comes with another inevitable factor of cost affecting the Return on Investment (ROI). IBM Watson claims to achieve a return on their virtual agent investment by providing customers with fast, straightforward, and accurate answers to their questions at reduced cost. This effort explores and documents a low-code approach and usage of Natural Language Processing (NLP) techniques hosted on scalable cloud systems integrated with Twilio-based solutions for delivering SMS, WhatsApp, Voice, Video, email, and IoT messages.

Introduction

Conversational Artificial Intelligence (AI) has become a mainstream capability offering for enterprises where human-digital system interactions occur frequently at work, at home, and on the go. Solutions and tools of this kind in the conversational AI space, known as bots, chatbots, or virtual assistants, are emerging to the next stage, where these bots start talking to each other, too.

Watson Assistant is IBM's chatbot with the capability of interacting with business systems using natural human languages. Watson is a combination of a technically robust conversational platform with developer and line-of-business (LOB) tools serving a broad scope. This facilitates enterprises to build and train low-code AI solutions to serve a wide range of use cases across applications, devices, and channels.

IBM Watson Assistant is a cloud-based AI solution that allows one to create, train, and deploy chatbots with very little or no technical knowledge. The user-friendly interface makes it simple to construct dynamic dialogue flows.

IMG_256

Create a Chatbot

Go to https://cloud.ibm.com/login and log in. Make an account with your email address and a password. A screen similar to this will be visible.

1_

Enter the details such as Assistant name, Description, Language and click on Create assistant. Assistant is created successfully after this step.

Then a screen similar to this will be visible.

2

Click on Actions in the menu bar

3

A screen similar to this will appear.

4

Click on “Create a new action.” Initialize the new action as the example below and click on save.

5

Now the new action is created to pay the credit bill. Now type the conversation in the "Assistant Says" dialog box; in this example, it is "What type of transfer would you like to make?"

6

Then define the customer response; click on ‘Options’.

7

Then a screen similar to this will be visible.

8

Type the Options as required, In this example it says “Saving , NEFT, UPI”

Click on Apply after setting the options.

9

Now click on ‘New step’ to add another step to the conversation.

10

Type the text "When would you like to do this transaction?" in the ‘Assistant’ to be displayed next. In the "Define Customer Response" set, set the response type to Date. The result after adding new step is as follows.

11

Again, click on New Step to add another step to the dialogs.

Type in the "Assistant Says" box, "Please enter the amount."

Set the Define Customer Response as Currency type.

12

The screen looks similar to this after this step.

13

Create a new step and type the message in the "Assistant says" box. In this example, it is "The amount has been successfully transferred."

14

As this is the final step, select the option in "And then" to end the action, as shown in the example. Now, go back to the home menu and select the "Publish" option.

2

Now click on the “Publish” option

3

Now go back to the home menu and press “Preview” option.

4

A screen similar to this will appear.

5

Copy the link given in the box and open it in a new browser. Here you can test your Chatbot.

1

Thus, we have successfully deployed our first chatbot.

INTEGRATION WITH TWILIO

Twilio's programmable application programming interfaces (APIs) are a set of building blocks that enable developers to create the exact consumer experiences they need.

Throughout the customer experience, Twilio can be used to deliver SMS, WhatsApp, Voice, Video, email, and even IoT. All you have to do now is incorporate its API into your application.

Create a Twilio account using your email address, and copy the Account SID and Auth token from the Account settings.

On the IBM Watson Assistant Home page, select the option 'Integrations' from the menu. In addition, select the 'SMS with Twilio' option.

6

Integrate the chatbot from this option, giving the details previously collected from the Twilio account: Account SID, Account Token, and Phone Number. Click Next, and then finish integrating with Twilio.

INTEGRATION WITH APPS USING PYTHON SDK

Install the required libraries using the pip package manager. Using python version 3.5

pip install --upgrade ibm-watson

pip install --requests>=2.0

pip install  --dateutil>=2.5.3

websocket-client==1.1.0

ibm_cloud_sdk_core>=3.3.6

To get started, go to the IBM Cloud Dashboard page.

In Watson's service, in the left menu bar, select Manage Users and go to the     Identity and Access Management.

In the Users tab, click on Create an IBM Cloud API key.

Create the API key by entering the Name and Description and click on Create.

Now the API keys are generated successfully.

To access IBM Watson, these API keys can be specified in Python code.

Sample code

The API key must be supplied.

from ibm_watson import DiscoveryV1

from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('apikey', url='https://iam.cloud.ibm.com/identity/token') discovery = DiscoveryV1(version=, authenticator=authenticator)

discovery.set_service_url('')

Then the bearer tokens are generated using API keys

from ibm_watson import IAMTokenManager

iam_token_manager = IAMTokenManager(apikey='')

token = iam_token_manager.get_token()

And the tokens are supplied

from ibm_watson import DiscoveryV1

from ibm_cloud_sdk_core.authenticators import BearerTokenAuthenticator

authenticator = BearerTokenAuthenticator('your bearer token')

discovery = DiscoveryV1(version='2019-04-30', authenticator=authenticator)

discovery.set_service_url('')

Conclusion

In this exploration, we have demonstrated how to integrate AI powered by IBM Watson into your Twilio and Python application with just a few lines of code. Such low-code approaches provide advantages such as out-of-the-box functionalities, security, and scalability. We observe the advantage of creating advanced software applications like Chatbots via simple graphical user interfaces and configuration. Time consumption for a typical on-premise configuration and deployment of a business process management reduces drastically from months to days, along with a reduction of cost to a great extent, as well as scalability and security.

Posted by Admin

Talk to our expert