Skip to main content

How to connect Instagram to an AI Agent

Connect your Flametree AI agent to Instagram to automatically respond to Direct Messages (DMs). This integration uses the Meta Graph API and requires an Instagram Professional account linked to a Facebook Page.

Prerequisites

  • Instagram Professional Account (Business or Creator). Personal accounts are not supported by the API.
  • Facebook Page linked to your Instagram account.
  • Meta Developer Account and a Meta App (Type: Business).
  • Manage Queries permission enabled in Instagram settings (Settings > Privacy > Messages > Allow Access to Messages).

Setting Up Meta Infrastructure

  1. Open your Facebook Page settings.
  2. Go to Linked Accounts > Instagram.
  3. Click Connect Account and log in to your Instagram Professional account.

Step 2: Configure Meta Developer App

  1. Go to the Meta for Developers portal.
  2. Select your App (or create a new one with the Business type).
  3. Click Add Product and select Instagram Graph API.
  4. In the Instagram settings of your app, navigate to Token Generation.
  5. Add your Facebook Page and generate an Access Token.

Step 3: Webhook Configuration

  1. In the Meta App dashboard, go to Webhooks.
  2. Select Instagram from the dropdown menu.
  3. Click Edit Subscription and use the Callback URL and Verify Token provided in the Flametree connector settings (see below).
  4. Subscribe to the messages field.

Configuring Flametree Integration

  1. Navigate to Settings > Connectivity > Communication Channels.
  2. Select Instagram from the list and click Add +.
  3. Fill in the configuration fields using the values from your Meta Developer Console:
FieldDescriptionRequired
NameCustom name for the integration (for example, Main IG Support).Yes
Instagram IDYour Instagram Business Account ID.Yes
Facebook access tokenThe Page Access Token from your Meta App.Yes
Facebook page IDThe ID of the Facebook Page linked to Instagram.Yes
Instagram access tokenToken generated specifically for Instagram Graph API.Yes
Meta app IDThe ID of your Meta Developer App.Yes
Instagram app secretFound in App Settings > Basic in Meta Console.Yes
Instagram verify tokenAn arbitrary string used to verify the webhook.Yes
Registration delayDelay between registration attempts (in seconds).No
Registration countNumber of retry attempts for webhook registration.No
  1. Click Save.
  2. Go to your Agent Settings, find the Communication Channels section, and add the newly created Instagram connector.
  3. Restart the Agent to apply changes.

Testing the Integration

  1. Log in to a different Instagram account (not the business account itself).
  2. Send a Direct Message (DM) to your Instagram Business profile.
  3. Verify that the AI Agent responds automatically.
  4. Check the Sessions tab in the portal to see the conversation logs.

Common Issues & Solutions

The agent is not receiving messages

Possible causes:

  • Allow Access to Messages is disabled in the Instagram mobile app settings (Privacy > Messages).
  • The Facebook Page is not properly linked to the Instagram account.
  • The Meta App is still in Development Mode. Switch it to Live Mode.
Webhook verification fails

Solution: Ensure the Instagram verify token in the Flametree portal matches the Verify Token you entered in the Meta Webhook settings.