Private Replies allows a business to send a single message to a person who published a post on your business' Facebook Page or who commented on a post or comment on the business' Facebook Page or Group. The message will contain a link to the post or comment that the person published.
You will need:
MESSAGING
task on the Pagepages_messaging
permission pages_feed
webhooks (recommended to avoid rate limiting) or an API call to the /page/feed
endpointOptional, but recommended:
groups_feed
webhooks field, if your business has a Facebook group.To receive webhooks for private replies, the group settings for private replies must be on. Private replies are On by default. To confirm this setting, the admin of the Facebook Page can go to the Facebok Group, tap Manage in the left panel and scroll down to Settings. Tap Group settings, scroll down to Manage discussion and look for On under Private replies.
All messaging types available for using the Send API are available for private replies.
To send a private reply to a post or comment, send a POST
request to the /PAGE-ID/messages
endpoint with the recipient
parameter with post_id
or comment_id
set to the ID for the post or comment and the message
parameter set to the message you wish to send.
The following example shows a reply to a post published on your Page by a customer:
Hi, I want to buy a gift for my nephew. Do you have any suggestions?
curl -X POST -H "Content-Type: application/json" -d '{
"recipient": {
"post_id": "PAGE-POST-ID"
},
"message": {
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text":"Of course, what is your budget for the gift?",
"buttons":[
{
"type": "postback",
"title": "LESS THAN $20",
"payload": "GIFT_BUDGET_20_PAYLOAD"
},
{
"type": "postback",
"title": "$20 TO $50",
"payload": "GIFT_BUDGET_20_TO_50_PAYLOAD"
},
{
"type": "postback",
"title": "MORE THAN $50",
"payload": "GIFT_BUDGET_50_PAYLOAD"
}
]
}
}
}
}' "https://graph.facebook.com/v21.0
/PAGE-ID/messages?access_token=<PAGE-ACCESS-TOKEN>"