Skip to main content

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 (parentId is set on a reply).
  • edited — the comment's text was changed. text is the new text.
  • deleted — the comment was deleted. text is null and there is no textFetched: the comment no longer exists, so nothing is fetched. actor says who deleted it.
  • hidden / unhidden — the comment was hidden from the public, or made visible again (for example with Hide Comment). actor says 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:

textFetchedMeaning
truetext was fetched from Facebook: the comment's text as it is now (for edited, the new text).
falseWe 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:

  • actor is who hid, unhid or deleted the comment — usually your own Page. A comment can also be deleted by the person who wrote it: then actor is that person. To know if your Page did it, check actor.id = pageId.
  • author is the person who wrote the comment. We take it from that comment's created event, 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), author is null, also when the writer deleted their own comment.
  • fromSelf refers to the author only, never to the actor: it is false when author is null.
warning

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:

SettingValue
URLYour URL — set it with Set Webhook
MethodJSON 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​

ParameterDescription / Example
event"comment" always, for comment webhooks.
actionWhat happened: "created", "edited", "deleted", "hidden" or "unhidden".
eventIdThe 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.
fromThe ID of your connection — the from you use to call our API.
facebook_type3 always (Facebook Pages).
pageIdYour Facebook Page ID.
postIdThe post the comment is on. Use it with All Comments or Create Comment.
commentIdThe comment ID. Use it with Create Comment (to reply), Hide Comment, Delete Comment, Like Comment and Private Reply.
parentIdOn a reply: the comment it answers. null for a comment on the post itself.
authorWho 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.
actorOnly on hidden, unhidden and deleted (and always there): who hid, unhid or deleted the comment, id and name — usually your own Page.
fromSelftrue when the comment was written by your own Page (the author, never the actor).
textThe text of the comment, or null (a deleted comment, a comment without text, or textFetched false).
attachmentWhen the comment has a photo or a video: type ("photo" or "video") and url. null otherwise.
timestampWhen 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.
textFetchedWhether we fetched the text from Facebook — see the table above. Not in a deleted event.

Webhook payload

​

Your response​

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.