Monday 16 May 2016

How to Build Facebook Chatbots With IBM Watson






by Sarang Nagmote



Category - Website Development
More Information & Updates Available at: http://http://vibranttechnologies.co.in




I’ve open sourced a simple sample of a chatbot for Facebook that leverages IBM Watson Dialog and IBM Watson Natural Language Classifier for conversations with users.
The GitHub project contains a sample of a Facebook bot built on the Facebook Messenger Platform which is currently available as beta. The sample bot is pretty simple but might give people some ideas about how to use cognitive Watson services and host the bot on Bluemix.
The sample bot shows recent tweets with a positive or negative sentiment about a specific topic via the Insights for Twitter service. Check out the screenshots folder for more information.
The left screenshot shows the usage of the Dialog service. The right column shows additionally the Natural Language Classifier. In this example, users can type in ‘awesome’ which is a word that is not hardcoded anywhere.
facebookbot5
I’ve implemented the bot via Node.js. In order to invoke the action that reads the tweets, I’ve extended the dialog definition with the JavaScript code which is supposed to be invoked.
<item>Alright. Here are the {Sentiment} tweets about {Topic}:$ExecCode$showTweets(sender, "{Topic}", "{Sentiment}")</item>

In order to use buttons in the chat, I’ve extended the dialog definition with the button data.
Rather than clicking on buttons users can also type in text like ‘awesome.’ Rather than hardcoding all alternatives, the Watson classifier is used to determine whether users are interested in positive or negative tweets. The id of the classifier is defined as part of the dialog definition.
<item>Are you interested in positive or negative tweets?$ShowButtons$[{"type":"postback","title":"Positive","payload":"positive"},{"type":"postback","title":"Negative","payload":"negative"}]#3a84cfx63-nlc-5285</item>

No comments:

Post a Comment