Instagram

The DRUID Portal allows you to create the bot once and deploy it on Instagram using the Messenger from Meta.

Prerequisites

  • You built and published a DRUID chat bot.
  • You have one or more Facebook pages.
  • You should have a Instagram Professional account.
  • Open the Facebook Page's About page and then copy and save the Page ID.
  • For DRUID on premise deployments, make sure that you provide access to/from the necessary messaging endpoints as follows:
  • Outbound graph.facebook.com
    Inbound DRUID.BotApp
Note:   In DRUID hybrid and cloud deployments Instagram channel uses the Microsoft Bot Framework, while in on premise deployments it uses direct DRUID Facebook integration.

To integrate a DRUID chatbot with Instagram, follow these steps:

Step 1. Link your Instagram professional account to a Facebook page

Go to your Facebook page settings and on the Settings menu, click Linked Accounts.

On the Linked Accounts menu, click Instagram and on the page, click the Connect account button.

In the pop-up that opens, click Connect.

Step 2: Create a Facebook app

Note:  The Facebook UI may appear slightly different depending on which version you are using.
  1. In your browser, navigate to Facebook for Developers and log in.
  2. On the toolbar, click My Apps. Your Facebook apps page appears.
  3. Click the Create App button.
  4. Select the app type.
  5. Click Next.
  6. Enter the Display name of your app and select your Business Account account.
  7. Click Create App.
  8. For security reasons, re-enter your password and click Submit.
  9. The Facebook app is added to the dashboard.

  10. On the left menu, click Settings > Basic.
  11. From the right pane, copy and save the App ID and App Secret (click Show , then copy). You will need them at Step 2.
  12. Select Clients as App Purpose and at the bottom of the page click the Save changes button.

  13. On the left menu, click Settings > Advanced.
  14. In the right pane, set the Allow API Access to app settings slider to Yes.
  15. Click the Save Changes button to save the settings.

Step 3. Enable Instagram Messenger

  1. On the left menu, click Dashboard.
  2. In the right pane, scroll down and in the Messenger card, click the Set Up button.
  3. The Messenger entry is displayed under the Products section on the left menu.

  4. Confirm that you allow access to Instagram messages in Inbox.

Step 4. Generate a Page Access Token

To generate a Facebook page access token:

  1. On the left menu, click Messenger > Instagram Settings.
  2. Scroll down to the Access Tokens section and click the Add or Remove Pages button.
  3. Continue as logged in user or log in using another account.
  4. Select the target page(s).
  5. Click Continue and then click Save.
  6. A pop-up appears informing you that you linked your Facebook app to Instagram account.
  7. Click Got it. The Facebook app appears in the Access tokens section.
  8. Click the Generate Token button. The Token Generated pop-up appears.
  9. Tick I understandand click the Copy button to copy the page access token as you will need it at step 5.

  10. Click Done.
  11. You can now exit the Facebook app pages.

Step 5: Configure the DRUID chat bot

  1. Log in the DRUID Portal and go to your bot configuration page.
  2. Click the Channels tab, then click Instagram. The Instagram section expands.
  3. Enter the Facebook App ID and the Facebook App Secret (the App ID and App Secret you copied when creating the Facebook app).
  4. Click the Add page button ().
  5. Enter the Facebook Page ID and Page Access Token and click the Save page button.
  6. If you host the bot (via Facebook app) in multiple Facebook pages, click the Add page button and enter the Page ID and access token for any subsequent Facebook pages.

  7. Click the Publish button. The channel activation might take up to 1 minute. When the channel activation completes, the Callback URL and Verify Token fields are automatically filled in. Copy the two values (clicking the Copy icon at the right-side of the two fields) and save them in a file, you will need them at Step 6.

After the channel’s activation, the following fields are available in DRUID:

  • [[ChatUser]].ChannelId = "instagram"
  • [[ChatUser]].UserId - Stores the unique identifier of the Instagram user account.

Step 6: Enable Webhooks

To send messages from your bot to Instagram Messenger, you must enable webhooks integration. To do so, follow these steps:

  1. Go back to the Facebook app settings. On the left menu, click Messenger > Instagram Settings.
  2. On the right pane, scroll down to the Webhooks section and click the Add Callback URL button.
  3. Enter the Callback URL and Verify Token automatically generated in DRUID on the bot Facebook channel and click Verify and Save.
  4. The Facebook page appears in the Webhooks section but it has no webhook events selected. Click the Edit Subscriptions button.
  5. The Edit Instagram Webhook Subscriptions page appears.

  6. Select messages and instagram_manage_messages.
  7. Important!  instagram_manage_messages subscription is required for handling Instagram user story mentions. Mentioning an Instagram account linked to a DRUID bot in a user's story triggers the Welcome flow. The event "story_mention" is logged in a new system entity field, [[ConversationInfo]].InstagramEvent, providing authors with control over subsequent actions by evaluating the condition [[ConversationInfo]].InstagramEvent == "story_mention" within the Welcome flow.
  8. Click the Save button.

Step 7. Establish Instagram Tester permissions

If additional permissions for the Instagram Business Account have not been set up by default, follow these steps:

  1. On the App Roles menu, click Roles.
  2. In the App Roles section, click the Add People button. The Add people to your app pop-up appears.
  3. Select Instagram Tester and enter the username of the Instagram Business Account.
  4. Click Add.

Now you can start talking to the bot on Instagram.

Hint:  For testing purposes, an account other than the admin account is required to interact with the channel and chat with the bot.
Note:  In DRUID 7.5 and higher, when a user initiates a conversation with the bot, the Welcome flow will be automatically triggered. Regardless of the user's subscription status to the bot channel, the welcome message will be promptly sent to the user, ensuring a seamless and engaging interaction experience.