> ## Documentation Index
> Fetch the complete documentation index at: https://chatbase.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Add an AI agent to Facebook Messenger

> Connect your Facebook pages so your AI agent can handle Messenger conversations, with human takeover

The Chatbase Messenger integration connects your AI agent to one or more Facebook Pages, so it answers the messages customers send those Pages in Facebook Messenger. It's for businesses that get customer questions through their Facebook Page, such as online stores handling product and order questions. You can also take over any conversation yourself and reply through Messenger, so routine inquiries are automated but you keep the freedom to step in whenever you want.

> [card] What you can do:
>
> Answer Messenger inquiries automatically, take over a conversation the moment you want to handle it yourself, and run different AI agents on different pages.

> [!NOTE]
>
> Attachments are supported, so your AI agent can process them and respond based on their content. See [Attachments](https://chatbase.co/docs/user-guides/chatbot/channels.md#attachments).

> [!NOTE]
>
> You can connect more than one Facebook page: select multiple pages during setup, or add more later using **Connect a new Facebook page** in the Messenger dashboard.

## Use cases

**Customer support.** Your AI agent answers from its [Data Sources](https://chatbase.co/docs/user-guides/chatbot/data-sources.md) and can read the photos and documents customers send. When a customer needs a person, the [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) Action opens a ticket and the AI agent tells the customer a ticket was opened. With Chatbase Helpdesk as the ticket platform, the AI agent then stops replying, your team's replies show up live in Messenger, and closing the ticket hands the conversation back. See [Handover with Chatbase Helpdesk](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md#handover-with-chatbase-helpdesk).

**Shopping and orders.** With [Shopify](https://chatbase.co/docs/user-guides/integrations/shopify.md) connected, these [Shopify Actions](https://chatbase.co/docs/user-guides/chatbot/actions/shopify-actions.md#channel-compatibility) work on Messenger: **Retrieve and display products**, **Update cart**, **Get cart**, **Create order**, **Create exchange (new order)**, and **Retrieve and display orders**. A customer can ask "Do you have this in blue?", add it to their cart, check out, and later ask where their order is, all in Messenger. They can also send a photo of a product, and the AI agent finds matching items with [search by image](https://chatbase.co/docs/user-guides/chatbot/actions/shopify-actions.md#search-by-image).

**Public comments.** [Comment monitoring](#comment-monitoring) turns comments on your Facebook posts into Helpdesk tickets, so your team can answer questions like "How much is shipping?" under a post from the same place as your other tickets.

## Before you start

* A Chatbase account with an AI agent
* A Facebook page you administer

## How to connect Messenger

**1. Open the Messenger channel**

Navigate to your dashboard, pick an AI agent, and go to **Channels**. Click **Setup** if this is your first time using the integration, or **Manage** if you've connected pages before.

**2. Grant permission**

If this is the first time, you'll be asked for permission to allow Chatbase to use your information.

> [!NOTE]
>
> If you've already integrated some pages and want to modify your selection, pick the **Edit Previous Settings** option.

![Granting Chatbase permission to access your Facebook information](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-4.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=72f1e06df0e5131b97e50da4c01abe31)

**3. Choose your pages**

Select **Opt into current pages only** to choose specific pages, or **Opt all current pages** to integrate every page on your account.

![Choosing which Facebook pages to integrate](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-5.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=481c447b59d2c8a6e5fb0a58fbeb1ac3)

**4. Review and save**

Review the permissions and click **Save**.

![Reviewing Messenger permissions](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-6.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=ab2e531a5dfe29c28476b27d83c3dbb1)

Click **Done** and wait a few seconds for the integration to connect.

![The Messenger integration connecting](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-7.jpg?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=8f5c381b88ba04f40de02b97b61fcf0d)

> [!TIP]
>
> Send a message to your connected Facebook page and confirm your AI agent replies.

Once connected, you can manage your pages through the Messenger dashboard: add new pages with **Connect a new Facebook page**, or delete existing ones using the three dots next to the page.

## Human takeover

The human takeover feature lets you take over a chat whenever you want and reply to customers yourself. It works at the conversation level, so you can pick a specific conversation from the dashboard and stop the AI agent answering it.

### Enable human takeover for a conversation

1. Navigate to **Activity > Conversations** in the left sidebar.
2. In the **Conversations** section, filter to show only Messenger chats.
3. Click the human **takeover icon** to the right of the source.
4. Click the icon to enable human takeover.

![The human takeover icon in the Conversations list](https://mintcdn.com/chatbase/bO49Edenw4JMFhBZ/user-guides/integrations/images/messenger/messenger-11.png?fit=max\&auto=format\&n=bO49Edenw4JMFhBZ\&q=85\&s=83224225c821426ac58e29912641fb08)

Click the icon again to restore access to the AI agent.

> [!WARNING]
>
> Some conversations won't have the human takeover icon. This happens when you delete a page from the integrations dashboard. You keep access to the conversations in **Activity > Conversations**, but not the takeover feature, because that page's integration was deleted. The same applies if you delete a page and add it back, so be careful when deleting pages from the Messenger dashboard.

***

## Response delay

Customers on Messenger often send several short messages in a row. If your AI agent replies too fast, it answers each message separately before the customer has finished. The Messenger response delay sets how long your AI agent waits after the latest customer message before it replies. Messages sent during that wait are grouped into one reply instead of one reply per message.

To set it:

1. Go to **Channels → Messenger → Manage → Delay**.
2. For each Facebook page, set a **Minimum delay** and a **Maximum delay** in seconds.
3. Click **Save**.

For each reply, your AI agent waits a random time between the minimum and the maximum, so replies don't arrive at an exact, robotic interval. To always wait the same amount of time, set both values to the same number.

> [!NOTE]
>
> Both values can be between 2 and 30 seconds, and the maximum can't be lower than the minimum. Pages you haven't configured wait 2 seconds.

## Comment monitoring

Turn comments on your **Facebook posts into Chatbase Helpdesk tickets**, so your team can monitor and respond to customers directly from Chatbase. Comment monitoring is available from the channel settings for your Facebook accounts.

**1. Open your channel settings**

Go to **Channels** and select your connected **Facebook** channel.

**2. Open Comments**

Select the **Comments** tab.

**3. Enable comment monitoring**

Turn on **Enable comment monitoring** and select the Facebook Pages you want to monitor.

![The Comments tab in the Messenger channel settings, with Enable comment monitoring turned on and a Facebook Page selected](https://mintcdn.com/chatbase/t6rQFYPtI-Id_rjI/user-guides/integrations/images/messenger/messenger-comments.png?fit=max\&auto=format\&n=t6rQFYPtI-Id_rjI\&q=85\&s=4d8844d734ba65e00a8b5b83f74d86de)

**4. Receive comments as tickets**

When someone comments on a monitored Facebook post, Chatbase automatically creates a ticket in the **Chatbase Helpdesk**.

The ticket includes information about the original post and the comment, giving your team the context needed to respond.

**5. Reply from the Chatbase Helpdesk**

Open the ticket in the **Chatbase Helpdesk** and reply directly to the comment.

Replies sent from Chatbase are posted as replies to the original Facebook comment.

## Connecting different AI agents to different pages

You can connect different AI agents to different Facebook pages, so each page gets specialized interactions.

**1. Open the AI agent you want to connect**

After connecting your first pages, you have access to the **manage Facebook pages** integrations page. Navigate to the AI agent you want to connect, then **Channels > Manage**.

![Opening Channels > Manage for an AI agent](https://mintcdn.com/chatbase/BmrOmHxfb5Jvt0l2/user-guides/integrations/images/messenger/messenger-12.png?fit=max\&auto=format\&n=BmrOmHxfb5Jvt0l2\&q=85\&s=bfa913093824f808a1c2ac439de1cb6e)

**2. Connect a new page**

You'll see all the pages connected to this AI agent. Click **Connect a new Facebook Page**.

![The Connect a new Facebook Page button](https://mintcdn.com/chatbase/bO49Edenw4JMFhBZ/user-guides/integrations/images/messenger/messenger-13.png?fit=max\&auto=format\&n=bO49Edenw4JMFhBZ\&q=85\&s=3a8b9be5e4f1efc9aea200fd18032597)

Then click **Edit previous settings**.

![The Edit previous settings option](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-14.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=6312e112d2900c3de88516fd0e7d9dd0)

**3. Keep your existing pages selected**

A list of connected pages is displayed.

> [!WARNING]
>
> Don't deselect any page you want to stay connected to Chatbase, because deselecting disables that page for Chatbase.

![The list of connected Facebook pages](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-15.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=81a48cc2ce50dc9bbf2a01ea0f1ce782)

**4. Select the new page and save**

Select the page you want to add the new AI agent to and click **Next**. If the page was already selected, just click **Next**.

![Selecting the page to add to the new AI agent](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-16.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=f4394135798929978604065e39d0a394)

Click **Save**.

![Saving the page selection](https://mintcdn.com/chatbase/yfTgmAASFJyGs3D_/user-guides/integrations/images/messenger/messenger-17.png?fit=max\&auto=format\&n=yfTgmAASFJyGs3D_\&q=85\&s=efcecaac7c9220ee0314de2db9c2b6d8)

The new page is added to the dashboard and is now integrated with the new AI agent.

> [!NOTE]
>
> You can enable or disable the Messenger integration without disconnecting it. Disabling pauses messages while keeping your setup intact, and you can re-enable at any time. New chats still appear in **Activity > Conversations**.

## Limitations

* **Deleting a page removes takeover for its conversations.** The conversations remain, but the takeover icon disappears, and re-adding the page doesn't restore it for old conversations.
* **Deselecting a page during setup disables it** for Chatbase, even if you only meant to change something else.

## Best practices

> [card] Match AI agents to pages
>
> If you run several Facebook Pages, such as one per brand or region, connect each to the AI agent trained for it. See [Connecting different AI agents to different pages](#connecting-different-ai-agents-to-different-pages).

> [card] Edit page settings carefully
>
> When you use **Edit previous settings**, keep every page you want connected selected. Avoid deleting pages you still use, because their conversations lose the takeover icon.

> [card] Route comments to the Helpdesk
>
> Turn on [comment monitoring](#comment-monitoring) for the pages where customers ask questions under posts, so public questions don't go unanswered.

> [card] Give Messenger its own instructions
>
> Turn off **Sync with global instructions** on the Messenger channel's **Overview** tab to write instructions for Messenger only. See [Instructions and global instructions](https://chatbase.co/docs/user-guides/chatbot/playground.md#instructions-and-global-instructions).

Changes you save to instructions, Actions, and channel settings go into a draft. Messenger customers keep talking to the live AI agent until you click **Publish**. See [Drafts and versions](https://chatbase.co/docs/user-guides/chatbot/versions.md).

## Troubleshooting

> [accordion] A conversation has no human takeover icon
>
> The page it came from was deleted from the Messenger integration. The conversation stays in **Activity > Conversations**, but takeover isn't available for it, even if you add the page back.

> [accordion] A page stopped responding after you edited your settings
>
> The page was probably deselected in **Edit previous settings**, which disables it for Chatbase. Go through **Connect a new Facebook page** and **Edit previous settings** again and make sure the page is selected.

> [accordion] The AI agent stopped replying in a conversation
>
> Check whether human takeover is on for the conversation, or whether it has an open Helpdesk ticket. A conversation can also be [paused](https://chatbase.co/docs/user-guides/chatbot/activity.md#pausing-a-conversation) manually or by [Spam detection](https://chatbase.co/docs/user-guides/chatbot/guardrails.md#spam-detection). If it stopped on every conversation, check that the Messenger integration is enabled.

## Frequently asked questions

> [accordion] Can I connect more than one Facebook page?
>
> Yes. Select several pages during setup, or add more later with **Connect a new Facebook page** in the Messenger dashboard.

> [accordion] Can different pages use different AI agents?
>
> Yes. Each Facebook Page connects to one AI agent at a time. Open the AI agent you want to use, go to **Channels > Manage**, and add the page through **Connect a new Facebook Page** and **Edit previous settings**. See [Connecting different AI agents to different pages](#connecting-different-ai-agents-to-different-pages).

> [accordion] Does the AI agent reply to comments on my posts?
>
> No. The AI agent doesn't respond to comments. Turn on **Comment monitoring** in the channel settings to create a Chatbase Helpdesk ticket when a comment arrives. Your team replies from the ticket, and the reply is posted under the original comment. See [Comment monitoring](#comment-monitoring).

> [accordion] How do I reply to a customer myself?
>
> Turn on [human takeover](#human-takeover) for the conversation from **Activity > Conversations**, or let the customer reach your team through an [Escalations](https://chatbase.co/docs/user-guides/chatbot/actions/escalate-to-human.md) ticket in Chatbase Helpdesk. Either way, the AI agent stops answering that conversation until you hand it back.

> [accordion] How many message credits does Messenger use?
>
> Each reply uses message credits based on your AI agent's [model](https://chatbase.co/docs/user-guides/chatbot/models-comparison.md) (**Auto** by default). A reply that triggers an Action, such as looking up an order, costs twice that, and [attachments](https://chatbase.co/docs/user-guides/chatbot/channels.md#attachments) add credits per image or PDF page.

## Next steps

> [card] [Instagram](https://chatbase.co/docs/user-guides/integrations/instagram.md)
>
> Connect the Instagram accounts linked to your Facebook pages for the same treatment.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.