How to make a bot in facebook


Building Bots - Documentation - Facebook for Developers

Building bots for Workplace in groups and chat

Bots in Groups

Bots in Chat

Overview

With custom integrations for Workplace, it's now possible to build powerful bots that can interact with people in groups and chat.

You can build a bot that automatically posts content into groups, responds to questions with extra information or takes action when mentioned in comments on a post. You can also build bots that can converse with people in Work Chat, providing information in real time, or handling requests with structured conversation elements like quick replies and persistent menus.

To build a bot for your community, you'll need a System Administrator admin role.

If you are not an admin of your Workplace community, you will need to work with an admin in order to build a bot.

Bots as Pages

On Workplace, similar to the Messenger platform, bots are represented as pages. A page is automatically created when you create a custom integration app. People in your Workplace community can discover and interact with your bot through this page

Bot pages are company-public, so any member of a Workplace community can see, tag, and message the bot. However, depending on the permission level you choose when creating your bot, it may not be able to see and interact with all of the content on Workplace.

For example, if your bot has the Read group content permission, it will be able to see content in groups. And if your bot doesn't have the Post to groups permission, it won't be able to reply to content in any group.

Additionally, people will only be able to find and message your bot in Work Chat if it has Message any member permission.

Bots in Groups

In groups, bots can do many of the things that people can do. This means you can build bots that post new content, comment on content with new information and like posts to indicate acknowledgement or approval.

Bots can also @mention people to get their attention, and be @mentioned to kick off a specific workflow or ask a question.

Lastly, bots can subscribe to group and @mention webhooks which provide the ability to monitor content and interact with users in flexible ways.

Bots in Chat

While in groups, bots are able to consume and share information across a group of people asynchronously, bots in chat are best for direct real-time interaction with a single person or defined group of people.

For instance, a chat bot can be used to send important reminders or notifications to someone based on an upcoming event like an interview or a meeting. Work chat bots can also be used to engage with a user in a conversation and take follow up action based on feedback received.

This interaction model is based on the same concepts used by the Messenger Platform. As a result, work chat bots can use features like persistent menus, quick replies, and templates to enrich the user experience.

A bot can only reply to a Chat thread in which Bot is a member(1-1 chat or Groups chats). Additionally the Bot must have Message Any Member permission.

Bot-to-User Chat

When a bot has the Message Any Member permission, it will be allowed to send a direct message any person on Workplace via their email address or their Workplace ID via the Messenger Send API.

A bot in a new message typeahead

The Message Any Member permission also allows your bot to show up in typeaheads in Workplace chat surfaces.

A bot in a new message typeahead

By subscribing for Page Message webhooks, your bot will also get notified when a user messages your bot, and you can build a conversation flow by combining sending and receiving.

A bot-to-user conversation

Bot-to-Group Chat

Bots can also create, manage and be added to multi-person group chat threads. Bots can create new group threads by specifying a list of recipients, and can rename threads to create chat discussions on specific topics with specific people.

A named thread with specific people, created by a bot.

Enabling bots for group chats

To enable a bot to create group chats with Workplace users, open the Permissions panel of the Edit Custom Integration dialog, and check the box labelled Allow this integration to work in group chats.

Enabling a custom integration bot for group chat support.

By enabling group chat support, your bot will show up in the Add people typeaheads in an existing group chat thread. It will then receive webhooks for each message sent by people in that thread, and can reply to that thread using its thread ID.

Adding a bot to a group chat, then @-mentioning the bot

Creating new named threads

To create a new thread with specific recipients, make a POST request to the /me/messages endpoint specifying an array of recipient IDs and an initial message payload as follows:

POST /me/messages { "recipient": { "ids": [<user_ids>] }, "message": <message_payload> }

You'll get back a response payload that includes a thread ID, which you can use for follow-up messages.

If you use the same endpoint with the same list of recipients again, a new thread will be created. To send follow-up messages to an already-created thread, make a POST request to the /me/messages endpoint using the thread_id in the recipient payload, as follows:

POST /me/messages { "recipient": { "thread_key": <thread_id> }, "message": <message_payload> }

To rename a thread created by your bot, make a POST request to the /{thread}/threadname edge, as follows:

POST /t_<thread_id>/threadname { "name": "new name" }

Note the need to prefix the thread_id with "t_" in the edge path.

You can also get the list of participants of a thread by issuing GET requests on the /{thread}/?fields=participants edge, as follows:

GET /t_<thread_id>/?fields=participants

You can also add and remove participants from threads by issuing POST or DELETE requests on the /{thread}/participants edge, as follows:

POST t_<thread_id>/participants { "to": [<user_ids>] } DELETE t_<thread_id>/participants { "to": [<user_ids>] }

Bot Platform Partners

Workplace has a number of bot platform partners who have built support for bots on Workplace. You can see a list of them here. You can use one of these platforms to build a powerful bot without writing a single line of code.

Best Practices

Use The Right Channel

When deciding whether to build group or chat interactions for your bot, it's worth considering where your bot will be most useful.

  • If you're building a bot that several people might interact with at once, or a bot that posts content for several people to see, it makes sense to build a bot that posts into groups and responds to comments and mentions on posts in groups.
  • If you're building a bot that needs to alert someone about something immediate, something that might require quick follow up, or something that people should interact with in private, you should support conversations in Work Chat for your bot.

A single app can handle both channels. There may be times when, for example, your helpdesk bot takes messages in work chat, and other times when it needs to post in groups and pick up the replies.

Group Interactions

Once your app is subscribed for webhooks, your bot will get notified when it's mentioned in a group post or comment. It's important for your bot to respond to mentions in a timely fashion. If your bot has to process a request before replying, it's useful to like the comment, to indicate to the person that the bot knows it was mentioned.

Then if you're providing information after being mentioned in a comment, add a threaded reply to keep the rest of the group conversation flowing.

If your bot needs to provide info to the original poster, add a comment on the post itself, so they get notified too.

Chat Interactions

Bot interactions in Work Chat support similar functionality to the Messenger platform. This includes quick-reply buttons and templates that help you implement decision trees in bot conversations.

This makes it much simpler to build useful workflows and reduces the amount of typing people need to do, without the need for sophisticated natural language processing, which makes internationalisation much much simpler if you're building bots for a global workforce.

The Complete Beginner’s Tutorial to Creating an AI Bot on Facebook Messenger

AI or Artificial Intelligence has become a buzzword these days. And Facebook chatbots are no exception to artificially intelligent technologies. For a smooth and well-rounded marketing strategy, this is something you can't steer clear of.

Moving forward, using a chatbot has become a standard when it comes to prompt customer support and happiness. In this article, we will define you what a Facebook chatbot is and how you can set a chatbot for your facebook page's messenger. Now, let's go ahead.

What Is a Facebook Messenger Chatbot?

Facebook messenger chatbot is an artificially trained bot that mimics human intelligence level and converses with your visitors or customers without even the need for any human assistance.

For this purpose, chatbots always try to hide the fact that they are artificially trained bots when they are serving or reacting to its users.

Why Do You Need a Facebook Messenger Chatbot?

As a business professional, you should streamline your marketing and customer support system with a facebook messenger chatbot to have an edge over your competitors.

The users of Facebook Messenger is almost equal to the entire number of users of Instagram, Twitter, and Snapchat together.

Source: Statista

Thus, you should definitely take the advantages of the Facebook messenger to your good book.

Here are some of the predicted use cases for chatbots that can be pretty useful for you:

  • Getting a quick answer in an emergency.
  • Resolving a complaint or problem.
  • Getting detailed answers or explanations.
  • Finding a human customer service assistant.
  • Making a reservation (e.g. restaurant or hotel).
  • Paying a bill.
  • Buying a basic item.
  • Getting ideas and inspiration for purchases.
  • Adding yourself to a mailing list or news service.
  • Communicating with multiple brands using one program.
Source: Convince and Convert

Here Are Some of the Basic Benefits of Facebook Page Bots:

Chatbots are a proven way to provide a far more personalized experience and ensure much more customer engagement. Here are a few benefits:

  • Mobile friendly customer service.
  • Integration to e-Commerce platforms to increase sales.
  • Automatic sending and receiving text and images.
  • Parsing information to actionable steps.
  • Providing answers with predetermined questions.
  • Being able to send bulk push notifications.
  • Offering in-depth analysis performance of the chatbots.
  • Chatbots become smarter with more usages.

How to Create a Basic & Simple Facebook Messenger Bot

We assume that you already have a Facebook page. If you have one, you can easily set a basic facebook auto reply bot from the page settings. Now, let's begin the facebook messenger chat bot tutorial:

First off, click on the dropdown button and select the page that your are going to set the chatbot for.

Click on the Settings option.

Next, click on the Messaging option:

After that, You will get 3 settings for the chatbot:

  1. General Settings
  2. Response Assistant
  3. Appointment Messaging

Configuring General Settings

Now, turn on the “Prompt people to send messages” and “Help people start a conversation with your Page” toggle bars.

Prompt people to send messages

This will help your people with a number of ways (Such as open chat window) to send you messages while you are online.

Help people start a conversation with your Page

This option will help your audience use frequently asked questions to begin a conversation with you with ease. The coolest part is that you can edit the FAQs (Frequently Asked Questions) with your own taste and can add multiple questions as well.

After finishing editing, don't forget to save the changes.

Configuring Response Assistant

This is the most effective and useful part of the Facebook messaging settings. In this section, you will get three more options. They are:

  1. Send instant replies to anyone who messages your Page.
  2. Let people know when you don't have access to your computer or phone.
  3. Show a Messenger greeting.

You will have to turn the toggle bar on in order to keep them functioning as indicated below with red marks:

After turning the toggle bar on, your audience will get instant messages showing that you will respond to them as soon as possible. However, you can easily edit them with the Change button:

Now, you will get the message editing option with a preview of the message:

Edit the message in the way you want. You can also add personalizations in the message text using the ‘Change‘ button. Finally, hit the ‘Save‘ button.

Let people know when you don't have access to your computer or phone

With this option, you can let your visitors know that you are not in front of your device and thus can't give them support instantly.

Show a Messenger greeting

You should use this option if you would like to greet your visitor who is on the first time with your page's messenger. You can also edit this option, personalize and save it at your disposal.

And that's it! You have created a basic Facebook bot for your business page.

How to Create an Advanced Facebook Messenger Bot with Chatfuel

You can easily create a Facebook Messenger with Chatfuel while having fun during the process.

I'll not only show you the walkthrough of creating a messenger bot but also guide you with a strategy so that you can grow a good number of audience with it.

It will take only a few minutes to set up the bot but you will later discover a lot of great and exciting ways to maneuver it more efficiently.

Step 1: Sign up for a Chatfuel Account with Your Facbook Account

Chatfuel’s homepage

First off, visit the homepage of Chatfuel and click on the “Get started for free” button.

After that, you will be prompted to log in to your Facebook account and you will then have to confirm your Facebook account ID to proceed.

Chatfuel will receive your profile picture, email and name. However, it will not let the app publish itself on your Facebook timeline. So, rest assured!

Step 2: Link Your Facebook page

At this stage, you will have to link your Facebook page. To do so, select your Facebook page by checking it and then hit the ‘Next' button to go forward:

Next, Chatfuel will show you all the details that they will do for your pages. Keep all the toggle bars turned on. Now, hit the ‘Done‘ button to go to the next step:

Then, you will get a success message showing that you have now linked Chatfuel to Facebook. Click ‘Ok' to proceed:

After the successful Facebook login, you will be taken to the Chatfuel account dashboard. Now, to finalize the addition of your Facebook page hit the ‘CONNECT TO PAGE‘ button.

For now, we will be using the free version. You can later buy the PRO version down the road:

Step 3: Create a Messenger Greeting

Now, you will have to create a welcome message to greet your customers (We have already shown it though). This is very important because it guides your users on what to do next without thinking much.

  • Go back to your Facebook page > Settings > Messaging
  • Now switch the Show a Messenger Greeting toggle bar to Yes
  • Now, click Change
  • Now type the greeting message for your user, and then save the changes.

Step 4: Create a welcome message

You have to configure a welcome message for each session your users start a chat session with the bot. Fortunately, in Chatfuel, you can easily greet your customers with a welcome message using your first name. Follow these steps:

  • Navigate to your Chatfuel dashboard and then click on Welcome Message
  • Add your preferred welcome text to the box. For example, “Hi {{first name}}, may I know what are you looking for?”

That's all. You don't even save the changes by hands because it is saved automatically. To check how it works, you can visit your Facebook page and use the Message button to test its efficacy.

Step 5: Create a default reply

Sometimes, your Chatbot will fail to answer too critical questions. To answer these types of questions, you will have to set default answers to help them what to do next. For example, you can set the replies to contact your support team, rephrase their question, use email or phone number to contact the helpdesk, etc.

Follow these steps:

  • Go back to your Chatfuel dashboard and select the Default Answer button.
  • Now you will find a set of placeholder texts. Change the texts to something more friendly. For example: (“Pardon me. I’m can not help you out but I am forwarding your queries to the customer care department. Please be patient.”)

Again, your changes are saved automatically.

Step 6: Unleash the Power of AI

You will feel the greatness of Chatbots when they can understand almost all the queries your customer ask. And this is where the concept of AI comes to the play. Since Chatfuel uses keywords to train its AI system you will have to feed some keywords to get the most of its AI system.

Follow these steps to train the AI system of the Chatbot:

  • Navigate to the Chatfuel dashboard, select Set Up AI > Add AI Rule
  • Now add a keyword that your customers are likely to use like ‘Refund policy’ in the If User Says Something Similar To box
  • In the accompanying Bot Replies with Text box, enter a useful reply like “We have no question asked policy but it is void until the product has the valid license period,” together with a link to your refund policy documentation page.
  • Now that you know the process of adding keywords, you should keep training the bots for as many keywords as possible so that the AI system gets more efficient over time.

Bonus Tips:

You can take help from your customer care department to get the most frequently asked queries from the user to train the AI system.

Step: 7 Add a Message button to your Facebook page

The Message button does not appear automatically and so you have to set it up manually in order to make it work. Follow these steps:

  • Log in to your Facebook account > Select your page > Add a Button.
  • You will get a popup window, select Contact You and Send Message option from therein:
  • Select Messenger and hit the Finish button.

Now, the Send Message button will be discoverable publicly and your users can start chatting with the bot.

Bonus Tips:

The best part of Chatfuel is that you can embed it on your website to conduct messenger-based marketing.

To this end, you can follow their tutorial and documentation so that you can use Chatfuel on your website.

Ending Thoughts

We hope that this guide will help you set the Facebook messenger bot well on your website. Besides, the user interface of Chatfuel is also friendly enough and you will find everything under your belt quickly.

Finally, I would like to say that building the AI Facebook messenger bot will not cost you arms and legs and it is actually worth the investment. That's because you don't have to spend too much on hiring new customer support employees.

Written by

Al Suzaud Dowla

Suza is a serious gadget lover and a science freak. Besides, being a computer geek, he is also passionate about music.

✅ Creation of chatbots in Facebook Messenger

How to create a chatbot for Facebook Messenger

Create and set up a chatbot with SendPulse in just a few clicks
No programming experience

  • Connect Facebook profile


    to SendPulse

    In your SendPulse account, select the "Messengers" section and log in
    with your Facebook account.

  • Select page


    to connect

    The chatbot is connecting to a Facebook page that you manage as an administrator.

  • Gather


    followers with widget

    Gather a database of contacts for mass mailing of a chatbot and private messages.

Detailed chatbot interaction statistics

Analyze what your audience is interested in. See the number of sent and read messages, as well as clicks on links in them. Learn more

Subscription Widgets

Subscribe users to the chatbot directly on the site

Widget allows the user to subscribe to the chatbot mailing list on your site without going to Facebook. You can choose the type of widget form and add a description of the bot in the title.

Create widget

Creating a chatbot is easy, editing and sending messages is even easier!

Convenient message constructor

You can send a mass mailing of several messages, as well as different types. You can insert a button with a link into the message or specify the phone number that will be called by pressing the button.

Different types of messages

Diversify text mailings with visual content. You can add an image, a product card and a file to the message.

Accept payments

Manage chatbots from your smartphone

Install the application to quickly respond to messages from Instagram, WhatsApp, Telegram and Facebook, work with subscriber data and analyze statistics.

Tools for setting up a chatbot


in Facebook Messenger

FAQ

🤖 What is a Facebook Bot?

This is a series of prepared auto-replies that is linked to a Facebook page. A “conversation” with a bot simulates a conversation with a human. Only users can initiate a conversation, which means you'll be dealing with really interested people. In this article, you will learn more about chatbots.

❤️ Why should I create a Facebook bot?

A well-designed Facebook bot takes care of your business 24/7. It can offload sales and customer support departments. In addition, you can use the Facebook bot to advertise and send marketing emails directly to your private messages. You can even set up autoposting to fully automate your interactions with customers on Facebook Messenger.

🚀 What is the functionality of a Facebook bot?

It helps you support your customers at every stage of their life cycle. Without knowing a single line of code, you can set up a Facebook bot that will move users through the sales funnel, answer FAQs, register participants for webinars, collect resumes - the possibilities are endless. Here's how to create a Facebook bot if you want to understand how it works.

💳 How much does it cost to create a Facebook bot with SendPulse?

On the basic plan, you can create up to 3 bots for free and send up to 10,000 messages to an unlimited number of users. The choice of a paid plan will depend on the number of your subscribers. Check out the prices and functionality of our Facebook bot at the link.

👌 How to subscribe people to a Facebook bot?

SendPulse provides a free subscription widget for Facebook Messenger that can be easily connected to your website. This is a great way to build a subscriber base. Read the instructions for adding a subscription widget to your site.

Learn more about chatbots for Facebook Messenger

  • Continue reading →

  • Continue reading →

Try free Facebook Messenger bot

Connect bot

Algorithm for creating a bot for Facebook Messenger - Offtop on vc.

ru

Column of the director of digital marketing "Atlas"

Viktor Babichev, Digital Marketing Director of the biomedical holding Atlas and mentor of the Growth Hacks section, wrote a column for vc.ru about the algorithm for creating a bot for the Facebook messenger.

Digital Marketing Director of Atlas Medical Center Victor Babichev

In order to create a bot for the Facebook messenger, you need to have minimal programming knowledge and skills. In fact, everything goes to the fact that bots will be created in a couple of clicks, but this is still far away. Already projects begin to appear that greatly simplify the development of bots, but most often they solve far from all tasks. Therefore, let's look into the issue and write our own simple bot for the Facebook messenger.

Preparation

You need to start with the environment. Necessary:

  • Open Terminal (console for entering commands).
  • Install git.
  • Sign in to your Heroku account and set the default project to Node.js.
  • Install Node.js and npm.
  • Open a convenient text editor.
  • Read the Facebook documentation.
  • Parse the code and understand what is responsible for what.
  • Refresh programming knowledge if necessary.

Start

First, we need to decide what we want to write. Our task is to create a simple Facebook bot that will automatically respond to user messages. The goal is to figure out how everything works.

We need a community for testing. So far, the structure is such that the Facebook bot is a separate page. That is, if you want to add a bot to an already existing community, then you need to handle the situation where the user wants to write to the administrator, and not communicate with the bot. Example: CNN edition page.

We create new application, where we indicate that this is App for Pages:

We go to the Messenger tab, select the desired community, log in and write down the received token. We still need it.

WebHooks

Now you need to configure WebHooks - this is the address of the site to which the user's responses will be sent in real time. The application must process requests and return the result. The site must be accessible via HTTPS, and the verification token must match the settings in the application.

We will create such a site and go through the verification procedure. This will require a bit of programming.

For convenience, we have chosen the Node.js platform, as the examples in the Facebook Messenger Platform are located there.

Follow the sequence of steps:

  • Download project from Github with sample bot: $ git clone [email protected]:babi4/vctest.git $ cd vctest.
  • Insert your pageToken into index.js - we remembered it earlier. verifyToken - come up with any phrase.
  • Run project: $ npm install $ npm start.
  • If everything worked out, then the site will be available at http://localhost:5000/.

To verify the address in WebHooks, you need to publish the site on a public hosting. The easiest way is offered by Heroku.

  • Install https://toolbelt.heroku.com/.
  • Signing up for an account: $ heroku login.
  • Go to the vctest project directory and prepare the project for deployment: $ cd vctest $ heroku create.
  • Remembering the site address.
  • Deploy the site (we host it): $ git push heroku master.
  • Congratulations, our site is ready: https://floating-dusk-67986.herokuapp.com/ It remains to connect it to the Facebook application settings.

Set up WebHooks in the application: add /webhook to the generated site address. In the Verify Token, we insert the phrase that we came up with a little earlier and wrote it into the code:

If everything worked out, it will look like this:

For everything to work, you need to create a subscription from the community - then all new messages from the user will be immediately processed.


Learn more