Skip to main content

Facebook

You can add a chatbot to your Facebook public Page so that the bot will reply to your clients’ messages. Clients will talk to the bot in Facebook Messenger.

To add the Facebook channel to your bot:

  1. Create and configure a Facebook Page.
  2. Create and configure an app on Facebook.
  3. Create a channel.
  4. Set up a webhook.
  5. Test the bot.
  6. Go through the App Review.
  7. Publish your Page and app.

Create and configure a Facebook Page

Create a Page

Communication on Facebook happens with user or group pages. So first of all, you need to create a Facebook company Page you will connect your bot to. If you have already created and configured a Page, go to the next step.

To create a Page:

  1. Proceed to the Facebook main page and select Pages in the sidebar.
  1. Click + Create New Page.
  1. Provide the Page information: the Page name and category are required. Then click Create Page.
  1. After creating a Page, you can add profile and cover photos, and also fill out optional fields.

Setting up your Page

Let’s make your Page unpublished.

  1. Go to Settings in the Manage Page menu.
  2. Set Page unpublished in the Page Visibility field. Choose The Page isn’t finished yet → Unpublish as a reason. Now only Page admins can see your Page.

Now let’s give admin rights to all the users that will be able to view the dialogs with the chatbot.

  1. Choose Page rolesAssign a New Page Role.
  2. Type a Facebook name of the user you would like to give permissions to, choose Admin and click Add.

Test a Page

Let’s add a button to test the messages delivery.

Go to your Page and click + Add a Button. Here you can customize the button text. Choose the appropriate option, e.g., Send message. Click Save.

The button will be added to the Page.

You will see the Edit Send Message button instead of the Send message button. Click it and select Test Button from the drop-down list.

Configure an app on Facebook

To add your chatbot to your Facebook Page, you will need to create an app.

Create an app

  1. Open the Facebook for Developers page.
  2. Click Log in and log in to your Facebook account. If you already have an account in Facebook for Developers, go to step 5.
  3. Select Get started on the main page of Facebook for Developers.
  4. Go through all the steps to create your account on Facebook for Developers.
  5. After you have created an account, go to the My Apps tab, click Create App and select the Business app type. Click Continue.

  1. Name the app and select Yourself or your own business as the app purpose. Add your Business Manager account and save the settings.

After you have done it, you will be taken to the page of your app.

Connect a Page to your app

On the app page, select the Dashboard tab in the sidebar. Find Add Products to Your App section and select Messenger, then go to the Settings tab.

To connect a Page, follow the steps below:

  1. In the Access Tokens section, click the Add or Remove Pages button.

  1. The new window for Facebook authorization will open. Click Continue as (your account name).
  2. Select the Page you are going to use in the integration, then click Next.
  3. Specify the app permissions. All permissions should be activated so that the integration works correctly. Click Done, and the app will be connected to Facebook. The Page will appear in the Access Tokens section.

Now, you need to get an access token. Click the Generate Token button next to your Page. In the modal window, click I Understand and copy the token. You will need it when configuring the channel in Tovie DialogStudio.

Create a channel

On the bot page in Tovie DialogStudio, go to the Channels tab. Select the Facebook channel.

Fill out the fields:

  • Access token — paste the access token that you have copied before.
  • Name — choose any name you like. You can change it later.

Click Connect.

Get a webhook

Click Get webhook near the name of the channel. The webhook URL will be copied to the clipboard.

Go back to the Settings page and follow the steps:

  1. In the Webhooks section, click Add Callback URL.

  1. In the modal window, paste the webhook you have copied into the Callback URL field. Paste tovieai_verify_token into the Verify Token field. Click Verify and Save.

  2. Click the Edit Subscriptions button. Activate the messages and messaging_postbacks parameters, then click Save.

  1. Reload the page. Select the Webhooks tab in the sidebar and select Permissions from the drop-down list.

  1. Click Subscribe to this object and fill out the fields as specified in steps 1 and 2, then click Verify and Save.

After you take all the steps, the integration will be ready for testing.

Test your bot

Now you can proceed to your Page and check chatbot reactions to messages.

Click Edit Send Message and select Test Button as you did when testing a Page.

Send the message with the activation phrase that you have set up in your script. Your bot should reply to it.

Go through the App Review process

To make the bot reply to messages sent from any people, not only those with a direct role on the app, you need to go through the App Review process.

First of all, make sure your app does not contradict:

Before you submit your app, make sure it functions correctly.

caution
If Facebook is unable to test the app functionality, or the functionality does not work as described, your app will not be approved.

To submit your app:

  1. On the app page, go to App ReviewRequests and click Request Permissions or Features.

  1. For the pages_messaging parameter, click Request Advanced Access in the Action column.

  1. Go to the Requests tab and click Edit for the draft request with these parameters.

  1. Fill in the request form according to the instruction. While filling it in, you must include screen recordings that show how to test any functionality that relies on that permission or feature.
  2. After you complete the request, click Submit for Review.

Wait for Facebook’s decision on your app. If your request is approved, you can start using the integration.

Publish your Page and app

After your chatbot is approved, you need to publish your Page and app.

To publish your Page, in the Manage Page menu go to Settings and choose Page published in the Page Visibility field.

Go to SettingsBasic. Create a privacy policy page and provide a URL in the Privacy Policy URL field. Choose your app category, upload an icon and fill in all the necessary fields. Save the changes.

After you publish your app and Page, all the clients that find your Page and click the Send message button will be able to talk to the bot.