# Set up the Messenger Send API with a Page access token

> Create the Meta app, connect a Page, get a Page access token with pages_messaging, subscribe the webhook and send a Messenger reply with Graph API v26.0.

Published 2026-11-04. Z-API Omni team.

To send a Messenger message, POST a JSON body to `https://graph.facebook.com/v26.0/<PAGE_ID>/messages` with a Page access token that carries `pages_messaging`. The body names the recipient's Page-scoped ID (PSID), a `messaging_type` and the message. The person has to write to your Page first, and a plain reply must go out within 24 hours of their message. Meta now keeps these rules on its "Send a Message" guide, because the old Send API reference page no longer loads ([Send a Message, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/send-messages)).

## What you need before the first call

Meta's overview lists three things ([Messenger overview, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/overview)). You need a Meta developer account, a Meta app with the Messenger use case, and a Facebook Page linked to that app. Business Verification comes in "if people without a Role on the app will use it".

Meta's pages qualify the App Review rule. The overview says you don't need it if you only message for your own Page. Other pages narrow that. Under Standard Access, the default, your webhook receives events only from people with a role on the app ([Webhooks, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/webhooks)). The quick start adds a limit before App Review ([Quick start, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/getting-started/quick-start)). Until then, Page tokens only work with accounts holding the Administrator, Developer or Tester role. Test with role accounts, and submit for Advanced Access before customers write in.

When you add the use case "Engage with customers on Messenger from Meta", the dashboard attaches five permissions you can't remove ([Create an app, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/create-an-app)).

| Permission | Why the Send API needs it |
| --- | --- |
| `pages_messaging` | Sending and receiving messages for the Page |
| `pages_manage_metadata` | Subscribing the Page to webhook fields |
| `pages_show_list` | Listing the Pages a user manages, used to fetch Page tokens |
| `business_management` | A dependency of `pages_messaging` and `pages_show_list` |
| `public_profile` | Required by the use case |

Meta's create-an-app page spells the second one `page_manage_metadata`. The overview and webhooks pages use `pages_manage_metadata`, which is the real name. The overview also asks you to mention the `business_management` dependency in your App Review submission.

## Connect the Page and the webhook in the dashboard

1. Open Dashboard, select the Messenger use case and click the option to customize it.
2. In **Generate access tokens**, click **Connect**, pick your Pages, then Continue, Save and Got it.
3. In **Configure webhooks**, enter the **Callback URL** and a **Verify token** you choose.
4. Back in Generate access tokens, use **Add Subscriptions**, select `messages` and `messaging_postbacks`, and click **Confirm**.

The callback URL needs HTTPS with a valid certificate. Meta's webhooks page says "Self-signed certificates are not supported."

## Get a Page access token

Meta documents four routes.

| Route | What Meta says |
| --- | --- |
| Dashboard | Token Generation shows a token when you select a Page. The UI doesn't store it, and each selection makes a new one while older tokens keep working (quick start) |
| `GET /me/accounts` | Call with a User token that has `pages_show_list`; each Page in the response carries an `access_token` ([Get started](https://developers.facebook.com/documentation/business-messaging/messenger-platform/get-started)) |
| Long-lived | Start from a long-lived User token. The resulting Page tokens "do not have an expiration date and only expire or are invalidated under certain conditions" ([Long-lived tokens](https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived)) |
| System user | Meta recommends a "stable access token backed by a system user"; the app and the Page must belong to the same business ([General best practices](https://developers.facebook.com/documentation/business-messaging/messenger-platform/introduction/general-best-practices)) |

Meta's `/me/accounts` sample breaks the URL across two lines, so it fails as published. Here it is on one line.

```bash
curl -i -X GET "https://graph.facebook.com/v26.0/me/accounts?access_token=USER_ACCESS_TOKEN"
```

The response, from Meta's sample with its inline comments removed so it parses.

```json
{
  "data": [
    {
      "access_token": "EAABkWcj...",
      "category": "Pet Service",
      "category_list": [
        {
          "id": "144982405562750",
          "name": "Pet Service"
        }
      ],
      "name": "Cisco Dog Page",
      "id": "4225...",
      "tasks": ["ADVERTISE", "ANALYZE", "CREATE_CONTENT", "MESSAGING", "MODERATE", "MANAGE"]
    }
  ]
}
```

`id` is the Page ID and `access_token` is the Page token. Check `tasks`. Meta's get-started guide says sending needs a token "requested by someone who can perform the `MESSAGING` task on the Page". The webhooks page asks for the `MODERATE` task to subscribe the Page.

For the long-lived route, swap in a long-lived User token and call the same edge on the user's app-scoped ID. Meta's version also wraps the URL, so this one is joined.

```bash
curl -i -X GET "https://graph.facebook.com/v26.0/APP_SCOPED_USER_ID/accounts?access_token=LONG_LIVED_USER_ACCESS_TOKEN"
```

A token backed by a person can be ended by that person, and some of their account actions invalidate it. Meta's best-practices page tells you to handle error 190 by notifying Page or app admins so they issue a new token. For anything that runs unattended, use the system user route.

## Subscribe the Page and verify the webhook

Install the app on the Page by subscribing it. This is Meta's sample, which has no version segment and subscribes `messages` only.

```bash
curl -i -X POST "https://graph.facebook.com/PAGE_ID/subscribed_apps?subscribed_fields=messages&access_token=PAGE_ACCESS_TOKEN"
```

It returns `{"success": "true"}`. To add postbacks in the same call, the usual Graph form is a comma-separated list, `subscribed_fields=messages,messaging_postbacks`. That is an adaptation. Meta's page doesn't show it.

Meta verifies the callback with a GET carrying `hub.mode` (always `subscribe`), `hub.verify_token` and `hub.challenge`. Return the challenge with a 200 when the token matches your string, and a 403 when it doesn't. Every POST carries `X-Hub-Signature-256`, an HMAC-SHA256 of the payload keyed with your App Secret. Meta computes it over the escaped-Unicode form of the payload with lowercase hex, so `äöå` is hashed as `\u00e4\u00f6\u00e5`. The check works the same way as on WhatsApp, shown in [webhook signature verification](/academy/articles/whatsapp-webhook-signature-verification-x-hub-signature-256/).

Answer every POST with a 200 at once and process the event afterwards. The webhooks page asks for a response "within 5 or less seconds", while the App Review page says 20, so build for 5. Meta retries right away when you miss it. After 15 minutes of failures you get an alert. After an hour Meta unsubscribes the app from the Page, and you have to subscribe it again.

This is Meta's text message event, compacted. The `sender.id` inside `entry[].messaging[]` is the PSID you reply to.

```json
{
  "object": "page",
  "entry": [
    {
      "id": "<PAGE_ID>",
      "time": 1458692752478,
      "messaging": [
        {
          "sender": { "id": "<PSID>" },
          "recipient": { "id": "<PAGE_ID>" },
          "timestamp": 1458692752478,
          "message": {
            "mid": "mid.1457764197618:41d102a3e1ae206a38",
            "text": "hello, world!"
          }
        }
      ]
    }
  ]
}
```

Route on whether the event has `message` or `postback`. In a `messaging_postbacks` event every property is a string, the timestamp included ([messaging_postbacks, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/webhooks/webhook-events/messaging_postbacks)). That timestamp marks when Meta sent the notification, not the click. Events can arrive out of order, so sort by `timestamp`, and dedupe because retries repeat them.

## Send the message

This is Meta's text sample, which runs as published. Only the placeholders are renamed.

```bash
curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"PSID"
  },
  "messaging_type": "RESPONSE",
  "message":{
    "text":"Hello, world!"
  }
}' "https://graph.facebook.com/v26.0/PAGE_ID/messages?access_token=PAGE_ACCESS_TOKEN"
```

A success returns `recipient_id` and `message_id`. Meta's attachment, reaction and quick-start samples post to `/me/messages` with the same token, and both paths appear in current samples. For an image, set `message.attachment` with `"type":"image"` and a `payload.url`. Audio, video and files use the same shape. Up to 30 images fit in one `message.attachments` array, and a `reply_to` object with a `mid` quotes an earlier message.

The recipient can be a PSID, a User Ref from a plugin or postback button, or a post or comment ID for Private Replies. App-scoped user IDs from Facebook Login don't work.

### Pick the messaging type

| `messaging_type` | When Meta allows it |
| --- | --- |
| `RESPONSE` | A reply to a received message inside the standard window |
| The proactive type Meta calls "Updates" | A message you start, still inside the window |
| `MESSAGE_TAG` | Outside the window, with a tag for an approved use case and no promotional content |

The window lasts 24 hours "for most user actions", and up to 7 days after a first message from a Click-to-Messenger ad. Since April 27, 2026, requests with `CONFIRMED_EVENT_UPDATE`, `ACCOUNT_UPDATE` or `POST_PURCHASE_UPDATE` return error 100. The tags that still work, including the Human Agent tag with its 7-day period, are in [Messenger message tags](/academy/articles/messenger-platform-message-tags-outside-24-hours/).

Typing indicators and read receipts go in a separate request. Meta's sender actions page says such a request "should only include the `sender_action` parameter and the `recipient` object" ([Sender actions, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/send-messages/sender-actions)). The values are `typing_on`, `typing_off`, `mark_seen`, `react` and `unreact`.

## Errors and rate limits

| Code | Meaning on the Send a Message guide |
| --- | --- |
| 10 | Permissions: "Verify your app has the `pages_messaging` permission and a valid Page access token." |
| 100 | Invalid parameter, also returned for the removed tags |
| 190 | Access token expired |
| 551 | Person unavailable: blocked, deactivated or unreachable |
| 613 | Rate limit exceeded |
| 1545041 | Person not available right now |

Meta's rate-limiting page sets a Page quota of `200 * Number of Engaged Users` calls per 24 hours ([Rate limits, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/overview/rate-limiting)). Engaged users are the people the business can message. Per second, per Page, the Send API takes 300 calls for text, links, reactions and stickers, and 10 for audio or video. Above 40 messages per second, Meta blocks inbox display and sending until volume drops. On a 613, back off and retry later.

When a person on your team needs to take over a thread from the bot, the Page uses Conversation Routing, covered in [the handover protocol post](/academy/articles/messenger-handover-protocol-bot-to-human/). To keep Messenger next to WhatsApp, Instagram and Telegram in one codebase, see [one message model for four channels](/academy/articles/whatsapp-instagram-messenger-telegram-one-message-model/). Z-API Omni puts those four channels in one subscription with webhooks included ([View documentation](https://developer.omni.z-api.io/en)).

*Z-API Omni team*
