UPDATED 20:56 EDT / APRIL 13 2016

NEWS

Developers: Roll your own Facebook Messenger bot and what you can do with it

At the F8 Developers conference, Facebook announced the Facebook Messenger product that is designed in particular for people to develop bots, or applications that could respond to commands sent via chat from the public. Out of all the announcements from Facebook, this one has a broad number of applications for connecting people with software.

If you’re a user of Facebook interested in how to find and use the bots that currently exist SiliconANGLE has you covered; but if you’re a developer wondering how to get your own project in on this article will give you everything you need to know.

Getting started with Facebook Messenger

Facebook’s Messenger Platform is still in beta but has recently become available for all developers to start making apps with. Documentation on the platform is available directly from Facebook’s Developer portal for Messenger.

A complete developer guide (Ed note: at time of writing this link is broken) to the Messenger Platform and bots is available, but Facebook kindly produced a Getting Started guide for anyone just getting their hands dirty.

The Getting Started guide will walk you through the bare minimum to get a bot prepared including how to set up WebHook, to allow the bot to handle messages sent to it via the Messenger Platform. The process is fairly simple and includes information on how to get a Verify Token from Facebook to make it function.

The Getting Started guide provides the code for producing a simple “echo” app: someone sends a message to the bot and the bot sends the message back. For example, if you messaged an echo bot “Hello!” the bot would reply with “Text received, echo: Hello!”

A simple framework, but a perfect place to start when getting the first steps on how to develop the part where the bot gets a message and replies to it down.

The example code also includes information on how to send structured messages (with media such as images or movies) and how to allow the recipient to click buttons in an outgoing message to send information back to the bot.

The engine that drives bots: Wit.ai

So far, Facebook has provided all of the information necessary to hook third-party code to the Messenger Platform. This means that a user can connect to a bot, say something, and get information back in the Messenger chat. Pretty much anything that can be done with a web page text entry box can be done here (from keyword searches to simple FAQ lookups) but this is a messenger chat and people will want to “talk” to the bot and not just type psudeocode.

To bridge this gap, Facebook gives developers access to an English language parsing service called the Wit.ai Bot Engine. The engine sells itself as a way to build “a quick-witted voice interface to our app or device.” Developers can access the bot engine directly through the Wit.ai backend.

As an engine, Wit.ai makes it easy to produce a “conversation” with a bot by allowing a developer to set up a storyboard of how such a conversation might go: if a user says “X” (or something that looks like “X”) then reply with “Y.”

What the Wit.ai engine does is parses the message sent by the user into actionable data based on templates: extract location, time, keywords/question and even sentiment analysis. This data can then be either acted upon by replying with a set message or passed onto a third-party app on the web that can be used to perform an action.

For example, a merchant could have Wit.ai determine that a customer wants to know where a nearby store is either by them asking “Where’s the nearest store?” or say “What’s the nearest store to Lakanaba St and Burland Ave.” The bot could then reply with a map and a link that would provide directions.

The storyboarding done by the Wit.ai backend allows for a lot of “understanding” that can be drawn out of messages sent by a user. For more examples, Wit.ai provides a series of “recipes” that includes deriving location, keywords, etc.

Image screenshot via Wit.ai

Image screenshot via Wit.ai

Making chat-driven data delivery a possibility

Already a few brands have taken advantage of Facebook’s Messenger Platform and its underlying AI English processing engine. Users can now use Messenger bots to hail an Uber (Uber Technologies, Inc.) or Lyft (Lyft Inc.) ride, share Spotify songs, or even send and receive money.

The potential uses for a messenger bot are almost endless, especially with Facebook’s 900 million users meaning that the Messenger Platform has a great deal of reach all across the world, especially to people with smartphones that include some sort of voice-to-text mechanism.

People are becoming increasingly used to voice-recognition driven smart agents such as Cortana, Siri and Google Now that are context aware when a smartphone (or PC user) speaks up and asks a question. Facebook Messenger bots provides a UI that not only connects a user to a search engine or a smart agent with Apple or Microsoft in mind but to a specific brand.

Facebook’s Messenger Platform becomes a portal to connect brands, or even service-specific applications developed by whomever, to end users. In the case of enterprise brands that means that, for example, Best Buy could easily let someone know if a particular item is in stock at a local store, just by chatting at the Best Buy app. Or, amazing urban food delivery web application GrubHub could take an order from Facebook Messenger by answering questions about local restaurant menu’s and then listening to a series of requests (piling up a shopping cart) and then finalizing the order with a “Good send that to me now and add a $5 tip.”

The interface of a chat messenger differs from a web page in that less information is displayed at one time but before the web and mobile phones people did receive and deliver information in question-answer or request-reply conversations with other people. With the Wit.ai behind the scenes parsing queries from the public, it’s possible to allow a developer’s back-end to provide a very similar experience.

photo credit: Ed Yourdon via photopin cc

A message from John Furrier, co-founder of SiliconANGLE:

Your vote of support is important to us and it helps us keep the content FREE.

One click below supports our mission to provide free, deep, and relevant content.  

Join our community on YouTube

Join the community that includes more than 15,000 #CubeAlumni experts, including Amazon.com CEO Andy Jassy, Dell Technologies founder and CEO Michael Dell, Intel CEO Pat Gelsinger, and many more luminaries and experts.

“TheCUBE is an important partner to the industry. You guys really are a part of our events and we really appreciate you coming and I know people appreciate the content you create as well” – Andy Jassy

THANK YOU