Oracle by Example brandingExpose Your Digital Assistant through Facebook Messenger

section 0Before You Begin

This 15-minute tutorial shows you how to make a digital assistant available to users through Facebook Messenger.

Background

You’re part of a project team that just completed a digital assistant (DA). You now want to expose it though multiple channels, including Facebook Messenger.

In this tutorial, you'll configure and publish your DA through a channel for Facebook Messenger. Because this allows users to access your DA through a Facebook page, it’s within easy reach of a multitude of users.

What Do You Need?

  • Access to Oracle Digital Assistant.
  • A digital assistant or skill.
  • A Facebook account.

    For purposes of this tutorial and testing, you can either use your own Facebook account or create a separate account. For production, you'll probably need an organizational Facebook account.

    Important: When you create a Facebook account, you need to supply an active mobile phone number. This number can’t be shared with any other Facebook account, including your personal account. If you create a separate Facebook account for testing, be sure not to supply the same phone number that you have for your personal account. Doing so could result in Facebook removing that phone number from your personal account.


section 1Create and Configure a Facebook Page for Your Digital Assistant

To start this lab, configure a Facebook page for your digital assistant.

  1. Open a new tab in your browser and then log in to https://www.facebook.com/pages/create using your Facebook account.
  2. In left navigation of Facebook, select Pages.
    Screenshot of the left menu in Facebook, with the Pages menu item highlighted.

    If you can't see that link, go directly to the Create Page option via https://www.facebook.com/pages/create.

  3. Click Get Started on the panel for the type of page that you'd like to create.

    Screenshot of two panels. The left is entitled Business or Brand. The right is entitled Community or Public Figure. Both have Get Started buttons.
  4. Provide a page name, choose a category, and click Continue.
    Screenshot of the two panels from the previous screenshot. But now, the right panel shows fields for Name and Category.
  5. Skip the profile picture and cover photo steps and complete the wizard.

    You can return to those steps later, if you wish.

    Facebook will create the new page and then display it.

    Screenshot of the created Facebook page. In the left navigation, there are items for Home, Posts, Reviews, Create Ad, and Manage Promotions. To the right of that is an empty panel with a button for 'Add a Cover'. Below that are panels with tips for further developing the page.

    Tip: If you ever want to get back to this page from your personal account, first select the question mark icon's drop down in the top right, then select your page from the displayed list of options.

  6. If you haven't already done so, enable your Facebook account as a Facebook Developer Account. To do this, go to https://developers.facebook.com, click Register and complete the dialog.

    If you're already a registered Facebook developer, then you'll be logged in and are ready to create an app.

  7. When prompted to create a new application, select Create App ID.
  8. In the Create a New App ID dialog, enter a name to represent your digital assistant in Facebook.
  9. Next, supply a contact email address then click Create App ID.
    Screenshot of the Create a New App ID dialog. It contains fields for Display Name and Contact Email.

    The name of this Facebook app is not yet connected to the name of your digital assistant. You will connect your DA and the Facebook App in later steps.

  10. Select the Dashboard option in the left navbar.

    The Dashboard page shows you high-level information about your application, such as the App Secret key, which you will need for channel configuration in Oracle Digital Assistant.

  11. Click Settings and then click Basic.
  12. Click the Show button in the right corner of the screen to reveal the app secret and then copy it to a text file.

    Note: You need to provide your Facebook password to view the App Secret key value.

  13. Go back to the Dashboard tab and click Set Up in the Messenger tile.
    Screenshot of part of the Dashboard page for the Facebook app. It shows tiles for Analytics,  Messenger, and third partially obscured tile. The Set Up button in the Messenger tile is highlighted.
  14. Scroll down to the Token Generation section and select the page you have created from the Page drop down menu.
    Screenshot of part of the Dashboard page for the Facebook app. It shows the Token Generation section, as well as the Select a Page dropdown menu.

    When you select your page, Facebook asks for your permission to continue.

  15. On the Continue as <Your Name> page, click the Continue as <Your Name> button.
  16. Go through the wizard to specify which of your pages you want to use the app and what you'll allow the app to do.

  17. Once you've completed the wizard, click OK.
    Screenshot of a page that has the text 'You've now linked shoppingcentreda to Facebook and an OK button.'
  18. Copy the generated page access token into a text file.
  19. Leave this browser tab open.

    You'll return to it later to enter the channel webhook URL that you generate in the next section.


section 2Configure a New Facebook Messenger Channel for Your DA

Now you'll create a channel in Oracle Digital Assistant using the page access token and app secret that you generated in the previous section.

  1. Open a new tab in your browser and navigate to your Oracle Digital Assistant instance.
  2. Click main menu icon to open the side menu.
  3. Click Development and select Channels.
  4. On the Users tab, click + Channel.
    Screenshot showing a small section of the Channels page. The Users tab is selected. The Add Channel button is the first item in the tab.
  5. In the Create Channel dialog, fill in the Name and (optionally) Description fields.
  6. From the Channel Type dropdown, select Facebook Messenger.
    Screenshot of the Create Channel dialog. It's Name field is filled in. The Channel Type field is set to Facebook Messenger.
  7. Fill in the Page Access Token and App Secret fields with the values that you generated in the previous section.
  8. Click Create.

    You are returned to the page for the channel. At this point you need to route this channel to the digital assistant you created.

    Screenshot of the Channels page with the Route To dropdown highlighted.
  9. Open the Route To dropdown menu, enter your DA name in the Filter box, and select your DA.
  10. Switch Channel Enabled to ON.
  11. Copy the Verify Token and Webhook URL values to a text editor.

    You will use them to hook up your DA to your Facebook application.

  12. Return to the browser tab where you set up the Facebook app.
  13. Under Products, select Messenger, and click Settings.
  14. Scroll to the Token Generation section of the page and click Subscribe to Events.

    The New Page Subscription dialog opens.

    Screenshot of the New Page Subscription dialog. It includes fields for Callback URL and Verify Token as well as a Subscription Fields section. The Subscription Fields sections contains 15 radio buttons, including ones for messages and messaging_postbacks.
  15. Fill in the Callback URL field with the webhook URL that you generated when creating the channel in Oracle Digital Assistant.
  16. Fill in the Verify Token field with the verify token that you generated in Oracle Digital Assistant.
  17. In the Subscription Fields section, select the following radio buttons:
    • messages
    • messaging_postbacks
  18. Click Verify and Save.

section 3Test Your Channel in Facebook

Now you're ready to test your DA in:

Test in Your Facebook Page

  1. Return to your personal Facebook account, go to the page you have created, and click Add a Button.
    Screenshot of a Facebook page. In the left navigation, there are items for Home, Posts, Reviews, Create Ad, and Manage Promotions. To the right of that is an empty panel with a button for 'Add a Cover'. Below that are panels with tips for further developing the page and a button labeled 'Add a Button'
  2. Click Contact you and select the Send Message Button radio button.
    Screenshot of step 1 of the wizard for adding a button. 'Contact You' and the Send Message Radio button is selected.
  3. Click Next.
  4. Select Messenger and click Finish.
    Screenshot of step 2 of the wizard for adding a button. 'Contact You' and the Send Message Radio button is selected.
  5. Hover over the Send Message button and then click Test Button to send messages.
    Screenshot of the Send Message dialog a menu appearing over it. The menu includes items for Test Button, Get Messages, Edit Button, and Delete Button.

Test in Facebook Messenger

To start testing in Facebook Messenger:

  1. Use the Search Messenger field to locate your DA.
  2. Start typing in the chat window.

    Here's what a test conversation might look like in Facebook Messenger:

    Screenshot of Facebook Messenger. The Shoppingcentreassistant DA is selected in the left of the window. In the right side, there is a chat beginning with 'what can you do for me today?'. The first response is 'Welcome, I can do the following things for you', followed by a carousel which shows options for Digital Bank and other skills that are not fully visible. And that is followed by a few more exchanges.

And here's what a test conversation might look like in Facebook Messenger on a mobile device:

Screenshot of Facebook Messenger on a mobile device. 'Shoppingcentrea...' is shown on the top of the screen. Below that is a chat beginning with 'what can you do for me today?'. The first response is 'Welcome, I can do the following things for you', followed by a carousel which shows options for Digital Bank and other skills that are not fully visible. And that is followed by a few more exchanges.

more informationWant to Learn More?

  • Channels in Using Oracle Digital Assistant