This guide explains how to comment on a Facebook Page post or comment on a Facebook Page post and @mention or tag a specific person or Page who has published a post on your Page or commented on a Page post using the Pages API from Meta.
For a person who can perform tasks on the page, you will need to implement Facebook Login or Business on your app to ask for the following permissions and receive a Page access token:
When testing an API call, you can include the access_token parameter set to your access token. However, when making secure calls from your app, use the access token class.
To get the comments for a Page post, send a GET request to the /page_post_id/comments endpoint with the fields parameter set to a comma-separated list that includes the message field, to get the content for the comment and the from field, to get the Page-scoped ID (PSID) for the person or Page who commented on the post, if you would like to @mention the person or Page in the comment.
You can reply to a specific person or Facebook Page by mentioning, or tagging, the person in a comment. A notification will be sent to the person who has been mentioned by the Page. The most common uses for @mentions are:
Replying to a specific Facebook Page or person who commented on a Page post or Page post comment that received multiple comments
Batch replying to multiple people who commented on a Page post or commented on a Page post comment.
When testing your app before going live, you must be an admin or a developer of the app and use Pages (both to make the API call, and to be used in a mention) for which you are an admin.
To mention a person or a Page who published a post on your Facebook Page, send a POST request to the ID for the Page post with the message parameter set to your comment content that includes the @ symbol with the person's PSID or the Page's ID.
To mention a person or a Page who commented on your Facebook Page post, send a POST request to the ID for the comment with the message parameter set to your comment content that includes the @ symbol followed by an an array with the person's PSID or the Page's ID.
To mention multiple people, use an array of a comma-separated of PSIDs.
Learn how to start conversations with people who are interested in your Page and how to send a private reply to a specific person who has posted or commmented on your Page.
Comments and @mentions
This guide explains how to comment on a Facebook Page post or comment on a Facebook Page post and @mention or tag a specific person or Page who has published a post on your Page or commented on a Page post using the Pages API from Meta.
Before you start
This guide assumes you have read the Overview and the Posts guide for the Facebook Pages API.
Permissions
For a person who can perform tasks on the page, you will need to implement Facebook Login or Business on your app to ask for the following permissions and receive a Page access token:
pages_manage_engagementpages_read_engagementpages_read_user_engagementPage tasks
Your app user must be able to perform the following tasks on the in the API requests:
MODERATECREATE_CONTENTPage features
Your app will need the following features:
IDs
Best Practices
When testing an API call, you can include the
access_tokenparameter set to your access token. However, when making secure calls from your app, use the access token class.Comments
You can comment on a Page post or a comment on a comment. The author of the comment will be the Page.
Limitations
1705error code with"message":"(#1705) There was an error posting to this wall".Comment on a Post
To comment on a Page post, send a
POSTrequest to the/page_post_id/commentsendpoint with themessageparameter set to the content for your comment.Example Request
Formatted for readability. Replace bold, italics values, such as page_post_id, with your values.
On success, your app receives the following JSON response with
idset to the comment ID:Comment on a comment
To comment on a comment, you will need to get the comments for a Page post, then get the ID for the comment you want to comment on.
Get comments
To get the comments for a Page post, send a
GETrequest to the/page_post_id/commentsendpoint with thefieldsparameter set to a comma-separated list that includes themessagefield, to get the content for the comment and thefromfield, to get the Page-scoped ID (PSID) for the person or Page who commented on the post, if you would like to @mention the person or Page in the comment.Example Request
Formatted for readability. Replace bold, italics values, such as page_post_id, with your values.
On success, your app receives the following JSON response with the commentor's name, PSID, message and the comment ID:
@mention or tag
You can reply to a specific person or Facebook Page by mentioning, or tagging, the person in a comment. A notification will be sent to the person who has been mentioned by the Page. The most common uses for @mentions are:
Limitations
Testing
When testing your app before going live, you must be an admin or a developer of the app and use Pages (both to make the API call, and to be used in a mention) for which you are an admin.
Reply to a Post
To mention a person or a Page who published a post on your Facebook Page, send a
POSTrequest to the ID for the Page post with themessageparameter set to your comment content that includes the@symbol with the person's PSID or the Page's ID.Example Request
Formatted for readability. Replace bold, italics values, such as page_post_id, with your values.
On success, your app receives the following JSON response with
idset to the ID for your comment:Reply to a Comment
To mention a person or a Page who commented on your Facebook Page post, send a
POSTrequest to the ID for the comment with themessageparameter set to your comment content that includes the@symbol followed by an an array with the person's PSID or the Page's ID.To mention multiple people, use an array of a comma-separated of PSIDs.
Example Request
Formatted for readability. Replace bold, italics values, such as page_post_id, with your values.
On success, your app receives the following JSON response with
idset to the ID for your comment:Next Steps
Learn how to start conversations with people who are interested in your Page and how to send a private reply to a specific person who has posted or commmented on your Page.
See Also