Messenger

Flow.ai has advanced support for the Facebook Messenger platform.

Introduction

If you are new to the Messenger platform, in search of advanced features like the Send to Messenger button, or ready to deploy your Messenger bot to the public, these docs are for you!

Getting started

Requirements

To create a new Messenger Platform channel, you will need the following:

  • Facebook Developer account. You can create a one at the Facebook Developer website. Connecting Flow.ai with Facebook Messenger is described in detail

  • Facebook App: The Facebook App contains the settings for your Messenger Platform integration. This is where you will setup your webhook, retrieve your page access token, and submit your app for approval.

  • Facebook Page: A Facebook Page will be used as the identity of your bot. When people chat with your bot, they will see the Page name and the Page profile picture.

Create a new Facebook channel

Connect Facebook Page to Messenger

  • Login at the Facebook Developer website
  • Choose at My Apps the option Create new App
  • Choose basic setup
  • Decide what to name your app, add a contact email and choose a category (like Apps for pages)
  • When the app is created select Add Product
  • Choose Messenger and Get started
  • Select your Facebook page you want to connect
  • Select the Page Access Token and copy the Page Access Token
  • Switch to the Flow.ai dashboard and paste the Page Access Token
  • Press the verifyM button and press =saveM

Configure webhooks

  • Go to https://developers.facebook.com
  • Choose your app under My Apps
  • Choose Messenger
  • Choose Setup webhooks under the item called Webhooks
  • Switch back to the Flow.ai dashboard
  • Copy and paste the Callback url from Flow.ai to the developer platform
  • Copy and paste the Verify token from Flow.ai to the developer platform
  • Check the following options: messages, message_echoes, messaging_postbacks messaging_optins en message_deliveries
  • Press Verify and save

Testing

After adding Messenger you can test your Messenger integration straight away. Only admins can test your bot though, so if you want other people interact with your bot you'll need to add them as a tester.

If you want the world yo use your Messenger app, you'll need to publish it.

Publishing

When you want to enable your bot for the world to interact with you'll need to complete the review proces.

pages_messaging

  • Choose Edit notes for pages_messaging
  • Choose Select page and select your Facebook page name
  • Add a number of example sentences you expect people to ask

pages_messaging_subscriptions

Messaging subscriptions require additional review information. Skip this if you can.

  • Click Edit notes for pages_messaging_subscriptions
  • Mark The app does not send advertisement or promotional messages
  • Mark You agree that your bot matches one of the 3 use cases below:
  • At Select use case select the category that matches your bot
  • At Upload screencast upload a screenrecording of your bot interacting
  • Press the Submit For Review button

Send to Messenger button

Facebook provides additional ways to opt-in to your bot. We've added an easy way to handle these opt-ins using events.

Simply provide the event name to trigger with the data-ref option.

Here is an example that will trigger a flow that has an event named OPTIN_MESSENGER

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId: "394917137530567",
      xfbml: true,
      version: "v2.6"
    });
  };

  (function(d, s, id){
     var js, fjs = d.getElementsByTagName(s)[0];
     if (d.getElementById(id)) { return; }
     js = d.createElement(s); js.id = id;
     js.src = "//connect.facebook.net/en_US/sdk.js";
     fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
</script>

<div class="fb-send-to-messenger"
    messenger_app_id="194350567713753"
    page_id="94172744353"
    data-ref="OPTIN_MESSENGER"
    color="blue"
    size="xlarge">
</div>

Within the Flow design app you simply add an event trigger with the same name.

results matching ""

    No results matching ""