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

# Messenger Setup

> Connect your Facebook Page to receive Messenger and Marketplace chats

This guide walks you through connecting a Facebook Page to Zavu so you can receive and reply to Messenger conversations, including Facebook Marketplace chats.

## Prerequisites

* A **Facebook Page** (personal profiles cannot be connected)
* Admin access to that Page

## Step 1: Open Messenger Setup

1. Go to **Senders** in your Zavu dashboard
2. Select your sender or create a new one
3. In the **Channels** tab, click **Add** next to Messenger

## Step 2: Connect with Meta

1. Click **Connect with Meta**
2. Log in with the Facebook account that manages your Page
3. Grant the requested permissions (Page messaging and Page access)
4. Select the Facebook Page you want to connect
5. Click **Save**

<Note>
  The login popup must be allowed by your browser. If nothing happens, check your popup blocker.
</Note>

## Step 3: Webhooks (Automatic)

When you save the connection, Zavu automatically subscribes your Page to messaging webhooks. Inbound Messenger and Marketplace chats start flowing into your Inbox immediately — no manual webhook configuration needed.

## Testing the Connection

1. Open your Facebook Page (or a Marketplace listing on that Page)
2. From another Facebook account, send a message to the Page
3. Check your Zavu **Inbox** — the conversation appears with the sender's user ID
4. Reply from the Inbox or via the API:

<CodeGroup>
  ```typescript TypeScript theme={null}
  const result = await zavu.messages.send({
    to: "24025631120151183", // User ID from the inbound message
    text: "Thanks for reaching out!",
    channel: "messenger",
  });
  ```

  ```python Python theme={null}
  result = zavu.messages.send(
      to="24025631120151183",  # User ID from the inbound message
      text="Thanks for reaching out!",
      channel="messenger"
  )
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.zavu.dev/v1/messages \
    -H "Authorization: Bearer $ZAVU_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "to": "24025631120151183",
      "text": "Thanks for reaching out!",
      "channel": "messenger"
    }'
  ```
</CodeGroup>

## Marketplace Chats

No extra configuration is needed for Marketplace: buyer messages sent from your listings arrive through the same Page messaging webhook as regular Messenger chats.

<Warning>
  Meta may restrict programmatic access to Marketplace conversations for some Page types or regions. If Marketplace messages don't arrive but regular Page messages do, verify your Page's Marketplace access with Meta.
</Warning>

## Auto-Reply with AI Agents

To answer Messenger chats automatically, configure an [AI Agent](/guides/ai-agents/overview) on the same sender. The agent triggers on inbound Messenger messages and replies within the 24-hour window.

## Troubleshooting

| Problem                             | Solution                                                                                |
| ----------------------------------- | --------------------------------------------------------------------------------------- |
| No pages listed after login         | Make sure your account is an admin of the Page and you granted Page access during login |
| Inbound messages not arriving       | Reconnect the Page from the channel settings to refresh the webhook subscription        |
| Sends fail with window closed error | The user's last message is older than 24 hours — wait for them to message again         |
| Login popup blocked                 | Allow popups for the Zavu dashboard and retry                                           |
