Facebook Comment
Webhook
Facebook Comment allows you to receive a webhook whenever a comment on your Facebook Page is written, edited, deleted, hidden or unhidden (event "comment").
It is sent for a Facebook Pages connection (facebook_type 3), to the URL
you set with Set Webhook for that
connection. Delivery, retries and duplicates are explained on the
Webhook Events page.
The types of comment events (action) you can get are:
- created — a new comment on a post, or a reply to a comment
(
parentIdis set on a reply). - edited — the comment's text was changed.
textis the new text. - deleted — the comment was deleted.
textis null and there is notextFetched: the comment no longer exists, so nothing is fetched.actorsays who deleted it. - hidden / unhidden — the comment was hidden from the public, or
made visible again (for example with
Hide Comment).
actorsays who did it.
The text of the comment. Meta's webhook does not include the text of
Facebook comments, only their IDs. So when the event arrives, we fetch the
current text from Facebook, and add textFetched:
textFetched | Meaning |
|---|---|
true | text was fetched from Facebook: the comment's text as it is now (for edited, the new text). |
false | We fetched and got no text. Either the comment has no text (for example, a photo only), or Facebook refused or did not answer (for example, the comment was deleted in the meantime). On created and edited, text is then null. On hidden and unhidden (we always fetch these), text may be null. The event is still sent and its IDs are valid: you can read the comment with All Comments. |
| (not in the event) | Nothing was fetched: a deleted comment (it no longer exists), or a created or edited comment whose text Facebook sent itself. |
Hidden, unhidden and deleted comments. Meta reports who hid, unhid or deleted the comment, not who wrote it. So on these three actions:
actoris who hid, unhid or deleted the comment — usually your own Page. A comment can also be deleted by the person who wrote it: thenactoris that person. To know if your Page did it, checkactor.id=pageId.authoris the person who wrote the comment. We take it from that comment'screatedevent, which we received earlier. When we never received it (the comment was written before your connection was made, more than a year ago, or it was hidden or deleted right after it was written — for example hidden by your Page's word filter),authoris null, also when the writer deleted their own comment.fromSelfrefers to theauthoronly, never to theactor: it isfalsewhenauthoris null.
Comments that your own Page writes — also replies you send with
Create Comment — arrive here
too, with fromSelf true. If you reply automatically to comments, skip
every event with fromSelf true, or your bot will answer itself in a
loop.
Settings:
| Setting | Value |
|---|---|
| URL | Your URL — set it with Set Webhook |
| Method | JSON via POST |
With every Facebook comment event, you will get some of the following:
{
"event": "comment",
"action": "created",
"eventId": "fbw_4c1e9a7d2b8f30e6a5d9c1b7e2f4a608",
"platform": "facebook",
"from": "463745743546345",
"facebook_type": 3,
"pageId": "104857362910483",
"postId": "104857362910483_122110934857201",
"commentId": "122110934857201_1093847561029384",
"parentId": null,
"author": { "id": "8273645190283746", "name": "Dana Cohen" },
"fromSelf": false,
"text": "Do you deliver on Fridays?",
"attachment": null,
"timestamp": 1795600000,
"textFetched": true
}
Response explained
| Parameter | Description / Example |
|---|---|
event | "comment" always, for comment webhooks. |
action | What happened: "created", "edited", "deleted", "hidden" or "unhidden". |
eventId | The unique ID of this event (fbw_ and 32 characters). The same event always comes with the same eventId, so use it to ignore an event you already received. |
platform | "facebook" always, for Facebook Pages. |
from | The ID of your connection — the from you use to call our API. |
facebook_type | 3 always (Facebook Pages). |
pageId | Your Facebook Page ID. |
postId | The post the comment is on. Use it with All Comments or Create Comment. |
commentId | The comment ID. Use it with Create Comment (to reply), Hide Comment, Delete Comment, Like Comment and Private Reply. |
parentId | On a reply: the comment it answers. null for a comment on the post itself. |
author | Who wrote the comment: id and name (name can be null). null when it is not known. On hidden, unhidden and deleted, see "Hidden, unhidden and deleted comments" above. |
actor | Only on hidden, unhidden and deleted (and always there): who hid, unhid or deleted the comment, id and name — usually your own Page. |
fromSelf | true when the comment was written by your own Page (the author, never the actor). |
text | The text of the comment, or null (a deleted comment, a comment without text, or textFetched false). |
attachment | When the comment has a photo or a video: type ("photo" or "video") and url. null otherwise. |
timestamp | When it happened, as Facebook reports it (Unix time in seconds, UTC). For an edit: the time of the edit when Facebook reports it, otherwise the time the comment was written. |
textFetched | Whether we fetched the text from Facebook — see the table above. Not in a deleted event. |
Webhook payload
Your response
- 200
- default
Received. Answer with any 2xx status (200, 201, 204 …) — we wait up to 5 seconds to connect and up to 15 seconds for your answer. The body of your answer is ignored.
Any other status, or no answer in time, counts as a failed delivery. We try again: immediately, then 5 minutes, 20 minutes, 1 hour, 4 hours and 24 hours after the previous failure. After that, the event is not sent again.