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
Step 1: Link Instagram to Facebook Page
- Open your Facebook Page settings.
- Go to Linked Accounts > Instagram.
- Click Connect Account and log in to your Instagram Professional account.
Step 2: Configure Meta Developer App
- Go to the Meta for Developers portal.
- Select your App (or create a new one with the Business type).
- Click Add Product and select Instagram Graph API.
- In the Instagram settings of your app, navigate to Token Generation.
- Add your Facebook Page and generate an Access Token.
Step 3: Webhook Configuration
- In the Meta App dashboard, go to Webhooks.
- Select Instagram from the dropdown menu.
- Click Edit Subscription and use the Callback URL and Verify Token provided in the Flametree connector settings (see below).
- Subscribe to the
messagesfield.
Configuring Flametree Integration
- Navigate to Settings > Connectivity > Communication Channels.
- Select Instagram from the list and click Add +.
- Fill in the configuration fields using the values from your Meta Developer Console:
| Field | Description | Required |
|---|---|---|
| Name | Custom name for the integration (for example, Main IG Support). | Yes |
| Instagram ID | Your Instagram Business Account ID. | Yes |
| Facebook access token | The Page Access Token from your Meta App. | Yes |
| Facebook page ID | The ID of the Facebook Page linked to Instagram. | Yes |
| Instagram access token | Token generated specifically for Instagram Graph API. | Yes |
| Meta app ID | The ID of your Meta Developer App. | Yes |
| Instagram app secret | Found in App Settings > Basic in Meta Console. | Yes |
| Instagram verify token | An arbitrary string used to verify the webhook. | Yes |
| Registration delay | Delay between registration attempts (in seconds). | No |
| Registration count | Number of retry attempts for webhook registration. | No |
- Click Save.
- Go to your Agent Settings, find the Communication Channels section, and add the newly created Instagram connector.
- Restart the Agent to apply changes.
Testing the Integration
- Log in to a different Instagram account (not the business account itself).
- Send a Direct Message (DM) to your Instagram Business profile.
- Verify that the AI Agent responds automatically.
- 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.