# Add an AI agent to Facebook Messenger > Connect your Facebook pages so your QwryAI agent handles Messenger conversations, with human takeover The Messenger channel connects your QwryAI 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, or local businesses answering about opening hours and bookings. > [card] What you can do: | /docs/user-guides/integrations/messenger#how-to-connect-messenger | Answer Messenger messages automatically, take over a conversation when you want to handle it yourself, and run different agents on different pages. > [!NOTE] > > Customers can send photos and documents, and your agent reads them before it replies. See [Images and attachments](/docs/user-guides/chatbot/behavior/images-and-attachments). > [!NOTE] > > You can connect more than one Facebook Page: select several during setup, or add more later with **Connect a new Facebook Page** on the Messenger channel's **Connection** tab. ## Use cases **Customer support.** Your agent answers from its [data sources](/docs/user-guides/chatbot/data-sources) and reads the photos and documents customers send. When a customer needs a person, the [Escalations](/docs/user-guides/chatbot/actions/escalate-to-human) Action opens a ticket and your team replies from the **Inbox**. **Shopping and orders.** With [Shopify](/docs/user-guides/integrations/shopify) connected, customers can find products and check their orders in Messenger. Choose which Actions run on Messenger on the channel's **Actions** tab. **Public comments.** [Comment monitoring](#comment-monitoring) turns comments on your Facebook posts into tickets, so your team sees questions like "How much is shipping?" in the same place as other tickets. ## Before you start * A QwryAI agent * A Facebook Page you manage, and the Facebook account that manages it ## How to connect Messenger **1. Open the Messenger channel** Open your agent and select **Channels** in the sidebar. On the **Messenger** card, *Connect your agent to a Facebook page and let it respond to messages from your customers*, select **Setup**. If you've connected pages before, the card shows **Manage**. ![The Channels page with the pointer on the Messenger card's Setup button.](annotated/01-card.webp "Channels › Messenger › Setup.") **2. Read the page selection note** QwryAI shows **Connect Messenger** before it opens Meta. Pages you select are granted access across your QwryAI agents, and unselecting a page that's already connected disconnects it from its agent. Select **I understand**. ![The Connect Messenger dialog explaining that unselecting connected pages disconnects them, with Cancel and I understand.](annotated/02-confirm.webp "Read this before Meta opens.") **3. Grant permission in Meta** Meta's window opens. Sign in with Facebook if asked and allow QwryAI to use your Pages. If you've connected pages before, choose to edit your previous settings. **4. Choose your pages and save** Select the Pages your agent should answer, review the permissions, and select **Save**, then **Done**. QwryAI connects the Pages in a few seconds. ![Meta's window: granting QwryAI access, choosing Facebook Pages, reviewing permissions and selecting Save, then the Messenger Connection tab listing the pages.](walkthroughs/messenger-meta-permissions.gif) **5. Check the Connection tab** On **Channels › Messenger › Manage**, the **Connection** tab lists your **Connected Facebook pages**. Each page has an **Active** switch and a menu with **Open in Messenger** and **Delete page**. Add Pages with **Connect a new Facebook Page**. ![The Messenger channel's Connection tab with Connected Facebook pages, a page card with its Active switch, and Connect a new Facebook Page.](connected/annotated/c01-connection.webp "Connected Facebook pages.") > [!TIP] > > Select **Open in Messenger** in a page's menu, send a message, and check that your agent replies. ![A Facebook page card with its menu open: Open in Messenger and Delete page.](connected/annotated/c02-page-menu.webp "Open in Messenger to test.") ## Human takeover Human takeover lets you take over a chat whenever you want and reply to the customer yourself. It works per conversation: the agent stops answering that conversation until you hand it back. ### Enable human takeover for a conversation 1. Open the **Inbox** and select **Messenger** in the **Channels** list. 2. Open the conversation. 3. Select **Take over**. The AI stops answering and your replies go to the customer in Messenger. 4. To give the conversation back, select **Hand back to AI**. ![Opening a Messenger conversation in the Inbox, selecting Take over, replying, then Hand back to AI.](walkthroughs/messenger-takeover.gif) To stop the agent without taking the conversation yourself, use **Pause AI** and **Resume AI**. > [!WARNING] > > When you delete a page, its conversations stay in the **Inbox**, but you can no longer reply to them, because QwryAI no longer has access to the page. ## Response delay Customers on Messenger often send several short messages in a row. If your agent replied at once, it would answer each one before the customer had finished. The response delay makes the agent wait after the customer's latest message; anything sent during the wait is answered in one reply. 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. Select **Save**. ![The Delay tab with Minimum delay, Maximum delay and Save for a Facebook page.](connected/annotated/c05-delay.webp "A minimum and a maximum per page.") For each reply, the agent waits a random time between the two values, so replies don't arrive at a mechanical interval. To always wait the same time, enter the same value twice. > [!NOTE] > > Both values must be from 2 to 30 seconds, and the maximum can't be lower than the minimum. A page you haven't set waits 2 seconds. ## Lead collection QwryAI can save each person who messages your Facebook Pages as a contact, with their name and profile picture. On the **Leads** tab, turn on **Enable automatic collection of leads** and tick the Pages. Collected leads appear in [Contacts](/docs/user-guides/chatbot/contacts/contacts-overview). ![The Messenger Leads tab: Automatically collect the name and profile picture of users who message your Facebook pages.](connected/annotated/c04-leads.webp "Leads from Messenger.") ## Comment monitoring Comment monitoring turns comments on your **Facebook posts into tickets** in QwryAI, so your team sees them alongside other tickets. **1. Open the channel settings** Go to **Channels › Messenger › Manage**. **2. Open Comments** Select the **Comments** tab. **3. Enable comment monitoring** Turn on **Enable comment monitoring** and tick the Facebook Pages to monitor. QwryAI shows *Comment monitoring enabled*. ![The Comments tab with Comment monitoring, Receive comments on your Facebook posts as tickets in QwryAI Helpdesk, and the Enable comment monitoring switch.](connected/annotated/c06-comments.webp "Comments become tickets.") **4. Receive comments as tickets** When someone comments on a post of a connected Page, QwryAI creates a ticket titled *Facebook comment from* the person's name, with the comment and a link to the post. **5. Reply on Facebook** Open the ticket, follow the post link, and reply under the comment on Facebook. ![A Facebook comment arriving as a ticket in QwryAI with the comment text and the post link.](walkthroughs/messenger-comment-ticket.gif) ## Connecting different AI agents to different pages Each Facebook Page answers with one agent at a time, so different Pages can use different agents. **1. Open the agent you want to connect** Open the agent, then **Channels › Messenger**: **Setup** or **Manage**. **2. Connect a new page** On the **Connection** tab, select **Connect a new Facebook Page**, then **I understand**, and in Meta's window choose to edit your previous settings. **3. Keep your existing pages selected** > [!WARNING] > > Don't unselect a page that's already connected. Unselecting it disconnects it from its agent. **4. Select the new page and save** Select the Page to add and save. It appears on this agent's **Connection** tab. A Page that already answers with another agent is listed under **Facebook pages connected to other agents**. To move it, delete it from that agent and connect it again from this one. ![The Delete Facebook page? dialog: This will permanently remove the QwryAI integration from this page.](connected/annotated/c03-delete.webp "Delete a page to move it to another agent.") > [!NOTE] > > To pause the agent on a page without disconnecting it, turn off the page's **Active** switch. New chats still appear in the **Inbox**. ## Channel settings **Overview** shows the model, data sources, Actions and instructions Messenger uses. Turn off **Sync with global instructions** to write instructions for Messenger only. **Actions** lists the Actions with a switch for each, so you choose which run on Messenger. ![The Messenger channel's Overview tab with the model, data sources, Actions and instructions.](connected/annotated/c07-overview.webp "Overview: what Messenger uses.") ## Limitations * **Deleting a page stops replies in its conversations.** The conversations stay in the **Inbox**. * **Unselecting a page in Meta's window disconnects it** from QwryAI, even if you only meant to add another. * **The agent doesn't answer comments.** Comment monitoring turns them into tickets; replies are posted on Facebook. ## Best practices > [card] Match agents to pages | /docs/user-guides/integrations/messenger#connecting-different-ai-agents-to-different-pages | If you run several Facebook Pages, such as one per brand or region, connect each to the agent trained for it. > [card] Edit page settings carefully | /docs/user-guides/integrations/messenger#connecting-different-ai-agents-to-different-pages | In Meta's window, keep every page you want connected selected. > [card] Turn comments into tickets | /docs/user-guides/integrations/messenger#comment-monitoring | Turn on comment monitoring so public questions under posts don't go unanswered. > [card] Give Messenger its own instructions | /docs/user-guides/integrations/messenger#channel-settings | Turn off Sync with global instructions on the Overview tab to write instructions for Messenger only. Changes to instructions and Actions go into a draft. Messenger customers keep talking to the live agent until you select **Publish**. See [Drafts and publishing](/docs/user-guides/chatbot/drafts-and-publishing). ## Troubleshooting > [accordion] A page card says Disconnected > > Facebook no longer accepts the page's access, for example after a password change. Select **Connect a new Facebook Page** and connect it again, keeping the page selected. > [accordion] A page stopped responding after you edited your settings > > The page was probably unselected in Meta's window, which disconnects it. Select **Connect a new Facebook Page** again and make sure the page is selected. > [accordion] The agent stopped replying in a conversation > > Check whether the conversation was taken over, paused, or has an open ticket. A conversation can also be paused by [spam detection](/docs/user-guides/chatbot/guardrails). If the agent is silent everywhere, check the page's **Active** switch. ## Frequently asked questions > [accordion] Can I connect more than one Facebook page? > > Yes. Select several during setup, or add more later with **Connect a new Facebook Page**. > [accordion] Can different pages use different agents? > > Yes. Each Page connects to one agent at a time. See [Connecting different AI agents to different pages](#connecting-different-ai-agents-to-different-pages). > [accordion] Does the agent reply to comments on my posts? > > No. Turn on [comment monitoring](#comment-monitoring) to get a ticket for each comment, and reply on Facebook. > [accordion] How do I reply to a customer myself? > > Select **Take over** on the conversation in the **Inbox**, or let the customer reach your team through an [Escalations](/docs/user-guides/chatbot/actions/escalate-to-human) ticket. Either way, the agent stops answering that conversation. > [accordion] How many message credits does Messenger use? > > Each reply uses message credits based on your agent's [model](/docs/user-guides/chatbot/models-comparison), the same as on every other channel. ## Next steps > [card] Instagram | /docs/user-guides/integrations/instagram | Connect your Instagram business accounts for the same treatment.