DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
Building Scalable Real-Time Apps with AstraDB and Vaadin
Register Now

Trending

  • How to Submit a Post to DZone
  • Avoiding Pitfalls With Java Optional: Common Mistakes and How To Fix Them [Video]
  • Extending Java APIs: Add Missing Features Without the Hassle
  • Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers

Trending

  • How to Submit a Post to DZone
  • Avoiding Pitfalls With Java Optional: Common Mistakes and How To Fix Them [Video]
  • Extending Java APIs: Add Missing Features Without the Hassle
  • Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers

How to Build Facebook Chatbots With IBM Watson

A simple bot built on Facebook Messenger that leverages the language capabilities of Watson.

Niklas Heidloff user avatar by
Niklas Heidloff
CORE ·
May. 16, 16 · Tutorial
Like (2)
Save
Tweet
Share
8.26K Views

Join the DZone community and get the full member experience.

Join For Free

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.

get the code from github.

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>
Facebook Messenger Chatbot Build (game engine)

Published at DZone with permission of Niklas Heidloff, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Trending

  • How to Submit a Post to DZone
  • Avoiding Pitfalls With Java Optional: Common Mistakes and How To Fix Them [Video]
  • Extending Java APIs: Add Missing Features Without the Hassle
  • Effortlessly Streamlining Test-Driven Development and CI Testing for Kafka Developers

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com

Let's be friends: