JAICP

Instagram channel


Instagram is one of the important business platforms, and for many small companies it is the only place where they sell their services. Many people also use their Instagram feed to find new offers.

You can connect your bot to Instagram so that it could communicate with your clients using:

There are several ways to connect Aimylogic to Instagram Direct — by connecting the bot directly to Instagram, by using the Wazzup service, or via the Jivo channel.

If you connect your bot to Instagram via Jivo, your bot will also receive mentions and replies to your Instagram Stories.

The bot connects to comments via Bitrix24 Open channels.

In this article, you will find out how to connect the bot directly to Instagram Direct.

Learn more about other methods for connecting to Instagram


Integration features

The Instagram channel supports the following functions:

  • sending images;
  • sending audio and video files;
  • transferring the dialog to the agent;
  • integration with CRM systems;
  • sending emails and SMS.

Buttons are not supported in this integration.


Connect the bot to Direct

To configure the integration, you will need the Instagram Business Account connected to the Facebook Business Manager account.

To use Instagram as an inbound channel:

  1. Create and configure a Facebook Page.
  2. Create an app on Facebook.
  3. Add Facebook and Instagram accounts to the app.
  4. Create an Instagram channel in Aimylogic.
  5. Set up a webhook.
  6. Test the bot.
  7. Go through the App Review process.
  8. Publish your Page and app.

Create and configure a Facebook Page

Create a Page

The communication on Facebook happens with the use of Pages. You can add a chatbot to your Facebook company Page. If you already have a Page, go to the next step.

To create a Page:

  1. Proceed to the Facebook main page and select Pages in the sidebar.

instagram 1

  1. Click + Create New Page.

instagram 2

  1. Provide the Page information: the Page name and category are required. Then click Create Page.

instagram 3

  1. After creating a Page, you can add profile and cover photos, and also fill out optional fields.

Set 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.

instagram 4

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

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

Connect your Page to an Instagram Business Account

The Page should be connected to your Instagram Business Account.

You can connect only one Page to an Instagram Business Account.

  1. Proceed to Facebook main page and select Pages > (Your Page name) > Settings > Instagram in the sidebar.
  2. Click Connect Account.

instagram 5

  1. In the modal window, allow access to Instagram messages in Inbox and click Continue.

instagram 6

  1. Log in to your Instagram account and select the Page you are going to connect.

If you already have another Page connected to this Instagram account, you should disconnect it in order to connect a new one.


Configure an app on Facebook

Create an app

  1. Open the Facebook for Developers page.
  2. Click Log in and log in to your Facebook account.
  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 the Create App button and select the Business app type. Click Continue.

instagram 7

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

instagram 8

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


Add Facebook and Instagram accounts

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 Instagram Settings tab.

To add accounts, follow the steps below:

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

instagram 9

  1. The new window for Facebook authorization will open. Click Continue as (your account name).
  2. Select the Instagram Business Account you are going to use in the integration, then click Next.
  3. Select the Facebook Page you are going to use in the integration.
  4. 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.

If you add the Page that is not connected to the selected Instagram Business Account, this Page will not be added and displayed in the Access Tokens section.

instagram 10

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

instagram 11


Create a channel

On the bot page in Aimylogic, go to the Channels tab. Select the Instagram 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.

instagram 12


Get a webhook

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

instagram 13

Go back to the Instagram Settings page and follow the steps:

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

instagram 14

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

instagram 15

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

instagram 16

instagram 24

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

instagram 17

  1. Click Subscribe to this object and fill out the fields as specified in steps 1 and 2, then click Verify and Save.
  2. Find instagram_basic, instagram_manage_messages, and pages_manage_metadata permissions. Click Subscribe near each of these parameters.

instagram 18

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


Test the bot

To test the bot, you should add another Facebook account as a tester on the page of the Facebook app.

For doing this:

  1. Select the Roles tab in the sidebar and click Add testers in the Testers section.

instagram 19

  1. In the modal window, specify the name or identifier of the tester’s account and click Submit. The account will be added to the section with Pending status.

instagram 20

  1. Log in to Facebook with the account you have added as a tester, then approve the request for adding the account to the list of testers.
  2. Log in to Instagram with the account connected to the Facebook account you have added as a tester.
  3. Go to the page of the Instagram account you have added when configuring the app. Send a message via Direct.

If you have configured everything correctly, the bot will answer according to the script.


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 for Instagram Messaging Apps.

Facebook documentation on App Review

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

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

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 Review > Requests and click Request Permissions or Features.

instagram 21

  1. For each of instagram_basic, instagram_manage_messages, and Human Agent parameters, click Request Advanced Access in the Action column.

instagram 22

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

instagram 23

  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 Instagram 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 Settings > Basic. Create a privacy policy page and provide a URL in the Privacy Policy URL field. Choose your app category, upload an icon, and fill out all the necessary fields. Save the changes.

instagram 25

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