Skip to main content

Prerequisites

Setup

1

Generate a Page Access Token

In Meta, open your apps, add Messenger to the app, and generate a Page Access Token for the page you send from.
2

Configure in Courier

Open the in Courier, enter your Page Access Token, then save.

Profile requirements

Facebook Messenger addresses the recipient by Page-Scoped ID, so the profile you send to needs a facebookPSID. Store it once with , which merges into the profile and creates it if it does not exist:
Then send to user_id and Courier resolves the address. For a one-off with no stored profile, pass it inline instead: "to": { "facebookPSID": "1254477777772919" }.

Send by user id

The call in every language, and the rest of the profile object.

Send to a recipient

Courier reads facebookPSID off the saved profile, so preferences apply and the value can change without touching this code.

Overrides

covers the two levels and which one wins. A provider override changes the request body Courier sends to Messenger, or swaps the Page Access Token and API URL.

Body overrides

You can override any of the fields in the request body that Courier sends to the Messenger Send API.

Config overrides

You can swap the Page Access Token or API URL at send time:

Provider details

Courier recommends routing to the channel. Naming this key in routing.channels instead is supported, and sends through just this provider.

Send to a specific provider

When that is worth doing, and what you give up: failover, channel priority, and providers you add later.