This guide discusses how a business using your app can increase their number of subscribers. A subscription token represents a person who has subscribed, opted in to receiving marketing messages from a business' Facebook Page. We show you how to increase a business' number of subscribers using the following options:
For businesses that have a list of customer data such as phone numbers and emails, you can upload this data to match to Facebook users and have subscription tokens be created.
Send a POST request tto the act_<AD_ACCOUNT_ID>/customaudiences endpoint with the following required parameters:
customer_file_source – set to USER_PROVIDED_ONLYdescription – set to the description of the custom audiencemarketing_message_channels – set to an object with MESSENGER set to the business' Facebook Page IDname – set to the name of the custom audiencesubscription_info – set to an array with "MESSENGER" as the only itemsubtype – set to CUSTOMuse_for_products – set to an array with "MARKETING_MESSAGES" as the only itemFormatted for readability.
curl -X POST "https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/customaudiences" \
-H "Authorization: Bearer <SYSTEM_USER_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"subtype": "CUSTOM",
"customer_file_source": "USER_PROVIDED_ONLY",
"name": "<CUSTOM_AUDIENCE_NAME>",
"description": "<CUSTOM_AUDIENCE_DESCRIPTION>",
"use_for_products": ["MARKETING_MESSAGES"],
"subscription_info": ["MESSENGER"],
"marketing_message_channels": {
"MESSENGER": "<PAGE_ID>"
}
}'
On success, your app receives a JSON object with a custom audience ID.
{
"data": [
{
"id": "<CUSTOM_AUDIENCE_ID>"
}
]
}
After creating a custom audience, you can upload custom information to match with Facebook users. Every user that is matched in the upload will be given a subscription token. You can add an unlimited number of records to an audience, but only up to 10000 at a time. Changes to your Custom Audiences don't happen immediately and usually take up to 24 hours. Match rates typically range from 20% to 70% depending on multiple factors such as the quality of the list and type of identifiers provided.
To safeguard user privacy, the /<PAGE_ID>/notification_message_tokens endpoint will only return subscription tokens for a given Custom Audience if there are 100 or more matched users in the upload. If fewer than 100 users match, tokens for that Custom Audience will be excluded from the response.
Send a POST request to the /<CUSTOM_AUDIENCE_ID>/users endpoint with the following required parameters:
| Name | Description |
|---|---|
| Required For each row in Expected format for
For additional schema options such as Example {
"schema": [
"EMAIL",
"PHONE",
"FN",
"LN",
]
"data":
[
[
"<HASHED_EMAIL>",
"<HASHED_PHONE>",
"<HASHED_FIRST_NAME>",
"<HASHED_LAST_NAME>"
],
[
"<HASHED_EMAIL>",
"<HASHED_PHONE>",
"<HASHED_FIRST_NAME>",
"<HASHED_LAST_NAME>"
],
[
"<HASHED_EMAIL>",
"<HASHED_PHONE>",
"<HASHED_FIRST_NAME>",
"<HASHED_LAST_NAME>"
],
]
} |
curl -X POST "https://graph.facebook.com/<API_VERSION>/<CUSTOM_AUDIENCE_ID>/users" \
-H "Authorization: Bearer <SYSTEM_USER_ACCESS_TOKEN>" \
-H "Content-Type: application/json" \
-d '{
"payload": {
"schema":[
"EMAIL",
"PHONE",
"FN",
"LN",
]
"data":
[
[
"<HASHED_EMAIL>",
"<HASHED_PHONE>",
"<HASHED_FIRST_NAME>",
"<HASHED_LAST_NAME>"
],
[
"<HASHED_EMAIL>",
"<HASHED_PHONE>",
"<HASHED_FIRST_NAME>",
"<HASHED_LAST_NAME>"
],
[
"<HASHED_EMAIL>",
"<HASHED_PHONE>",
"<HASHED_FIRST_NAME>",
"<HASHED_LAST_NAME>"
],
]
}
}'
On success, your app receives a JSON object with the number of valid and invalid entries. A job will run asyncronously to match the customer infromation to Facebook users and create the subscription tokens.
{
"audience_id": "<CUSTOM_AUDIENCE_ID>",
"num_received": 3,
"num_invalid_entries": 0,
"invalid_entry_samples": {
}
}
Each time a batch of uploaded customer rows matching process completes, a notification is sent to apps subscribed to the marketing_messages_subscriber_upload_status event for that page. To receive these notifications through a webhook, follow the setup instructions in the Meta Webhooks for Messenger Platform.
{
"field": "marketing_messages_subscriber_upload_status",
"app_id": 12313123123123,
"page_id": 134141414124123,
"custom_audience_id": 140984918491243,
"ad_account_id": 12348141984909088,
"timestamp": 41412414141,
"num_rows": 1000,
"business_id": 12313123123123,
"approximate_count_lower_bound": 105,
"approximate_count_upper_bound": 120,
"batch_uploading_status": "SUCCESS"
}
| Property | Description |
|---|---|
|
|
| Application ID |
| Page ID |
| Custom Audience ID |
| Ad Account ID |
| Timestamp when the event happened |
| Number of uploaded customer rows that have been processed |
| The end business ID for the page |
| Lower bound of the approximate number of people in this Custom Audience |
| Upper bound of the approximate number of people in this Custom Audience |
| Status of the upload for this batch of uploaded customers |
In order to get a list of Messenger marketing message custom audiences, you can add the following fields and filter to the /act_<AD_ACCOUNT_ID>/customaudiences endpoint.
fields=id,name,messenger_marketing_messages_page
Filters:
filtering=[{"field":"data_source.subtype","operator":"IN","value":[1010]}]
Filters (URL Encoded version):
filtering=%5B%7B%22field%22%3A%22data_source.subtype%22%2C%22operator%22%3A%22IN%22%2C%22value%22%3A%5B1010%5D%7D%5D
curl -X GET "https://graph.facebook.com/<API_VERSION>/act_<AD_ACCOUNT_ID>/customaudiences?fields=id,name,messenger_marketing_messages_page&filtering=%5B%7B%22field%22%3A%22data_source.subtype%22%2C%22operator%22%3A%22IN%22%2C%22value%22%3A%5B1010%5D%7D%5D" \
-H "Authorization: Bearer <SYSTEM_USER_ACCESS_TOKEN>" \
-H "Content-Type: application/json"
Customers or potential customers who click and respond to Click to Messenger ads are automatically subscribed to receive marketing messages; no additional opt-in flow is needed.
Businesses that have onboarded to your app automatically get this functionality for all Click to Messenger ad campaigns.
Visit our Marketing API documentation to learn more about Ads that Click to Messenger.
A customer, or potential customer, must first send a message via Messenger to the business' Facebook Page. This event triggers a webhook notification that is sent to your server. This webhook notification contains a Page-scoped ID (PSID) that represents the customer. Your app then uses this PSID to send the customer an opt-in request from the business' Facebook Page.
Visit our Messenger Platform documentation to learn ways to send opt-in requests.
The following is an example of an opt-in request.
Send a POST request to the /<PAGE_ID>/messages endpoint, where <PAGE_ID> is the ID for the business’s Facebook Page, and include the following properties:
recipient – an object with id set to the customer's PSIDpage – set to the business' Facebook Page IDmessage.attachment – an object with the following parameters:
type – set to templatepayload – an object set to the message content and any additional information to be sent in the webhooks information
template_type – set to notification_messagesnotification_messages_timezone – set to the customer's time zonetitle – set to the message titleimage_url – set to the url for the image in the messagepayload – set to any addition webhook information
curl -X POST "https://graph.facebook.com/<API_VERSION>/<PAGE_ID>/messages" \
-H "Authorization: Bearer <PAGE_ACCESS_TOKEN>" \
-Header "Content-Type: application/json" \
-d '{
"recipient": { "id": "<PSID>" },
"page": "<PAGE_ID>",
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "notification_messages",
"notification_messages_timezone": "<CUSTOMERS_TIME_ZONE>",
"title": "<MESSAGE_TITLE>",
"image_url": "<IMAGE_URL>",
"payload": "<ADDITIONAL_WEBHOOK_INFORMATION>"
}
}
}
}'
On success, your app receives a JSON response with the recipient's PSID and message ID.
{
"recipient": {
"id":"<PSID>",
"message_id":"<MESSAGE_ID>",
}
}
Visit the Messenger Plaform documentation to learn more about available message attachment properties.
When a customer opts in, the messaging_optin webhook event is triggered and a notification is sent to your webhooks server. This webhook contains the subscription token ID your app uses to send marketing messages.
{
"sender": {
"id": "<PSID>",
},
"recipient": {
"id": "<PAGE-ID>",
},
"timestamp": "<TIMESTAMP>}",
"optin": {
"type": "notification_messages",
"payload": "<ADDITIONAL-WEBHOOK-INFORMATION>",
"notification_messages_token": "<SUBSCRIPTION_TOKEN_ID>", // Subscription token
"notification_messages_timezone": "<TIMEZONE-ID>",
"user_token_status": "<TOKEN-STATUS>"
"notification_messages_status": "<MESSAGE-STATUS>",
"title": "<TITLE-FOR-THE-NOTIFICATION>"
}
}
Development for the Business Settings page to enable and disable the automations is in progress. Until then, businesses can only adjust these settings through the onboarding flow.
Enabling organic automations during the business onboarding flow helps boost user engagement and streamline communication. Currently, two automation types are available:
High-Intent Comments:
When a user comments on a business’s public Facebook post with one of six key intents—Purchase, Price, Payment, Product Inquiry, or Appointment Booking—they’re automatically prompted to sign up for updates and promotions through Messenger.
Stale Thread Follow-Up (No Reply in 48 Hours):
If a Messenger conversation between a business’s Facebook Page and a user goes inactive (no replies for 48 hours), the user will receive a prompt inviting them to sign up for updates and promotions via Messenger.
These automations make it easy for businesses to re-engage interested users and nurture leads, creating more opportunities for meaningful connections.
Use the text to explain how to grow marketing messages audience in your app.
Now that you have subscription tokens, start sending marketing messages.