Bots for Business
Facebook Messenger Bots 101
Facebook Messenger offers a diverse suite of tools for bot developers and integrates with many popular bot frameworks. Explore different use cases and learn what it’s like to use Messenger’s built-in tools, deploy a bot to Messenger from your favorite framework, and see how to get the most from your bot.
May 7, 2019
Facebook Messenger is everywhere. It’s the most widely used messaging app in the United States and Canada and the second most widely used messaging app in the world. Given the app’s global popularity, there’s a good chance your brand’s got an audience on there.
But what’s it like to deploy your bot on Messenger? What are the advantages and disadvantages? And where should you build your Facebook Messenger bot before taking it live? To answer all of these questions, let’s dive deep into the world of Facebook Messenger bots.
Why build a Facebook Messenger bot?
Besides an enormous audience of potential users, Messenger has a lot to offer bot developers. Extensive Facebook documentation shows you everything from how to build a bot to how to use analytics to gauge bot performance.
When you build a bot for Messenger, you’re getting a full suite of tools that enhance user experience, in addition to integration with Facebook advertising tools. Here are a few of the most compelling features:
- Quick replies. Users don’t have to type every response. Instead, your bot can give them clickable response buttons. This makes it easier for users to tell your bot what they need and reduces the chance they’ll submit a question your bot doesn’t understand.
- Built-in analytics. Facebook monitors your bot’s performance, so you can identify strengths and weaknesses. Metrics include user channels and devices, funnels, retention, and more.
- Short links. These make it easy for users to access your bot from any browser. To access your bot, they simply enter me.me/[botname] in the URL bar.
- Codes. Users can scan a code with their mobile device to be transported directly to your bot. It’s like a QR code, only for your Facebook Messenger bot.
- Ads that click to Messenger. This one’s valuable if your brand already advertises on Facebook. Adding a Chat Now button will connect your bot to the ad.
Those features may seem useful—and they are—but there are a few potential drawbacks to keep in mind. For one thing, you don’t have exclusive control of your data. Facebook uses the data as it sees fit. That’s how the company makes money, after all.
And, when it comes to pushing messages (as in follow-up messages to a prior conversation), Messenger prevents you from sending them after 24 hours of inactivity from the user—that is, unless, you pay Facebook for Sponsored Messaging. Then some of those limits are lifted.
You also don’t have total control over your bot’s design. To some extent, it will always have to fit Messenger’s parameters. Although the lack of creative control might be a bit off-putting, it is arguably in the best interest of Messenger users. And the Messenger Design Kit actually gives you more bot design options than you might anticipate.
Don’t forget, even if you try Facebook Messenger and later decide to move to a different platform, using a .BOT domain name from the start to redirect to where your bot can be found ensures your customers can always find and talk to you.
How to make a Facebook Messenger bot
There are many ways to create a chatbot for Facebook Messenger. If you want, you can use Facebook’s built-in tools to create and deploy your bot. A third-party framework, on the other hand, offers even more options for creating a sophisticated Facebook Messenger bot.
Messenger’s built-in tools
First, let’s look at Facebook’s bot-building tools for developers. In the setup guide, learn how to create a webhook for your bot. If you want, you can also download Facebook’s webhook starter code to get a taste of what it’s like to build a simple bot for Messenger.
The developer tools also include tutorials, where you can learn how to:
- Use the Messenger Customer Chat plugin to integrate your Messenger bot with your website.
- Set up the welcome screen, which displays your brand’s information and lets users know what to expect from your bot.
- Start using built-in natural language processing (NLP) capabilities in Messenger to create a bot that interprets user intent.
- Hand off conversations to your Facebook Page Inbox when the user requires input from a human.
Messenger’s developer tools are pretty robust, but there are advantages to using a dedicated third-party framework. For starters, you can build your bot in a framework and deploy it anywhere—not just to Facebook Messenger. So, if you have users who are active on multiple platforms, like Messenger and Kik, you can deploy a single bot that communicates through both of those messaging apps.
In a bot framework, you can also build a bot for Facebook Messenger and for your own domain. This is a smart move because the popularity of messaging apps ebbs and flows. Today, most of your potential users might be on Messenger. A year from now, they might be on a different platform. Deploying your bot to a domain that you control is an excellent way to give your bot a permanent home.
Wit.ai (aka Wit) is Facebook’s very own bot-building framework, and it provides practically seamless integration with Messenger. If Messenger is where most users will encounter your bot, Wit is the framework you should consider building on.
Of course, Wit isn’t the only framework that includes integration tools for Facebook Messenger. You can also employ:
- Amazon Lex
- Microsoft Bot Framework
To learn how they compare, check out our guide to bot-building frameworks.
Other bot-building tools
Don’t want to code? There’s a bot framework for that.
Apps like Chatfuel and ManyChat make it easy for non-developers to build quality Messenger bots without writing code—no need to understand the nuts and bolts of webhooks, APIs, or SDKs. These tools let you build a bot and deploy it to Messenger using a 100 percent graphical user interface (GUI). The advantage? Simplicity. The disadvantage? Limitations.
Bot-building apps that rely purely on GUI simply aren’t as sophisticated as real, full-featured chatbot frameworks. For simple bots, that might be okay. If you’re building a bot that displays a seven-day weather forecast for a given city when a user types “weather for
But, if you’re trying to build something more complex, you need a more capable framework. Consider Lara, Match.com’s “virtual dating coach” for users in the UK. Lara is a Messenger bot with capabilities that extend far beyond programmed responses and basic data regurgitation. She relies on deep learning and NLP capabilities to help users find their ideal dating partners based on the information they submit.
According to Match.com VP Abbie Oguntade, building Lara was far more involved than dragging and dropping some images on a simple GUI:
[We are] building out Lara’s AI to ensure she understands and can respond to voice and conversation. What we’re also doing is optimising her vocabulary to make it more colloquial, and we're improving her understanding and recommendations to bring that more “human” element to her role.
How to integrate your bot with Facebook Messenger
Integration is a framework-dependent exercise, and the process varies for different bot-building tools and chatbot frameworks. To get a sense of what integration might look like, let’s consider how it unfolds on one of the most popular frameworks with a Messenger integration component—Amazon Lex.
The Amazon Lex documentation provides a detailed step-by-step overview of integrating a bot with Facebook, but here are the basics:
- After creating a Facebook application and page, note:
- In your AWS console, assuming you’ve finished building a bot using Amazon Lex, select your Amazon Lex bot and enter some basic information, including the App Secret and Page Access Token you previously noted.
- Navigate to the Facebook developer portal, select your app, and start setting up webhooks for Messenger.
- Follow some Amazon Lex-specific instructions on the webhook page:
- To establish webhooks integration, select your Facebook page.
a. Your app’s App Secret.
b. Your Page Access Token.
a. Enter a callback URL specified in Amazon Lex.
b. Enter your Page Access Token.
c. Select some specific Subscription fields.
That’s it! Sure, there are a few steps, but they basically amount to simple data entry on two different interfaces. The process is very similar for other popular frameworks, like Microsoft Bot Framework and IBM Watson Assistant.
Keep in mind that every bot submitted to Facebook Messenger is subject to a review process. Your bot has to meet Facebook Community Standards and must abide by all platform policies.
Facebook Messenger chatbot examples
All sorts of organizations leverage Facebook Messenger to connect with new and existing customers. Let’s explore a few chatbot examples broken down by industry.
Got a kid who loves LEGO? The LEGO Messenger bot makes it easy to find the best set for a birthday gift. Just tell the bot your budget, the child’s age, and his or her imaginative play preferences (superheroes, planes, trains, or princesses, just to name a few). The bot shows you different ideas and gives you the option to make a purchase on the spot.
E-commerce bots are for grownups, too. Sephora’s Messenger bot, in particular, makes it easy to find the right beauty products based on images displayed within the bot interface. After indicating your preferences, the bot shows you the specific products (lipstick and eye shadow, for example) modeled in the photos. And there’s a Buy Now option for each one.
The Insurify bot makes excellent use of the quick replies provided by Messenger and draws on some voluminous backend data to provide car insurance quotes. After adding information about yourself and your driving history, Insurify tells you which coverage amounts you should purchase. The bot even lets you get personalized estimates on coverage.
Ever wondered whether you should buy trip cancellation insurance? Before adding that $90.00 purchase to your travel booking, you may want to consult Bank Yogi. This Messenger bot lets you know which benefits your credit cards include, so you don’t have to consult the fine print for each one. After you indicate the type of benefits you’re looking for and the type of card you already have, the bot lets you know about your benefits eligibility.
Sometimes, a bot can provide faster answers to health questions than a doctor—or even WebMD.
Gyant is a Messenger bot that performs triage and provides unofficial diagnoses of certain conditions. Depending on what’s wrong with you, the bot goes through a long list of questions about your symptoms. In the end, it makes a recommendation, which might include contacting a doctor if your condition is severe enough.
If you need a little “pocket nurse” to keep you on top of your medication, exercise goals, or nutrition plan, Florence is the Messenger bot for you. After giving Florence information about your conditions and/or objectives, she sends you reminders to stay the course. For example, she’ll check in to make sure you take your meds and she can even help you track your body weight.
Getting started with Facebook Messenger bots
The best way to get acquainted with Facebook Messenger bots is to build one. If you’re not sure which framework to use, you can always start with Facebook’s own bot-building tools. By following this Facebook bot tutorial for beginners, you can build a simple test bot and get a feel for what it’s like to create and deploy a bot within Messenger.
Check out a few more resources to help you get started:
- The Messenger integration documentation (covered in earlier sections of this post) for Amazon Lex, Microsoft Bot Framework, and IBM Watson Assistant, all of which make it easy to deploy your bot to the platform
- Facebook’s data policy and platform policy for developers, which help you understand how Facebook uses your bot data
- A comparison of different features in Chatfuel and ManyChat, in case you’re thinking of going the GUI route for a simple bot
It’s hard to go wrong with a Facebook Messenger bot. With its powerful features and the wide variety of frameworks that integrate with the platform, there are lots of reasons to deploy your bot on Messenger.
Plus, with a potential audience of millions, you’ll have ample opportunities to build, observe, iterate, and optimize your bot.