Skip to main content

Facebook Post

Webhook 

Facebook Post allows you to receive a webhook whenever a post on your Facebook Page is created, edited, deleted, hidden or unhidden (event "post").

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 post events (action) you can get are:

  • created — a new post on your Page: your own posts (fromSelf true — also the ones you publish with Create Post), and posts that visitors write on your Page (fromSelf false — see "A visitor's new post" below).
  • edited — the post's text was changed. text is the new text, and timestamp is the time of the edit.
  • deleted — the post was deleted. text is null and there is no textFetched: the post no longer exists, so nothing is fetched. actor says who deleted it.
  • hidden / unhidden — the post was hidden, or made visible again. actor says who did it. We have not seen these two on a real event yet, so their author (see "Deleted, hidden and unhidden posts" below) is not confirmed.

A visitor's new post. Facebook reports a post that a visitor writes on your Page only as an edit, without a "created" before it. So when the first edit of a post that we have never seen arrives and the post is at most 5 minutes old, we send it to you as created, with timestamp = the time the post was written. Later edits of that post arrive as edited. The first edit of an older post that we have never seen stays edited.

The text of the post. Meta's webhook does not include the text of Facebook posts, only their IDs. So when a created or edited event arrives, we fetch the current text from Facebook, and add textFetched:

textFetchedMeaning
truetext was fetched from Facebook: the post's text as it is now (for edited, the new text).
falseWe fetched and got no text, so text is null. Either the post has no text (for example, a photo only), or Facebook refused or did not answer (for example, the post was deleted in the meantime). The event is still sent and its IDs are valid.
(not in the event)Nothing was fetched: a deleted, hidden or unhidden post, or Facebook sent the text itself.

Deleted, hidden and unhidden posts. Meta reports who deleted, hid or unhid the post, not who wrote it. So on these three actions:

  • actor is who deleted, hid or unhid the post — your own Page, or the person who wrote the post. To know if your Page did it, check actor.id = pageId.
  • author is the person who wrote the post. We take it from that post's created event, which we received earlier (a visitor's post that we sent as created counts too). When we never received it (for example, the post was written before your connection was made, or more than a year ago), author is null.
  • fromSelf refers to the author only, never to the actor: it is false when author is null.
  • Nothing is fetched for these three actions, so there is no textFetched, and text is null unless Facebook sends it.

actor is only in these three post actions (and in hidden, unhidden and deleted comment events).

Match post events by postId. postType is the kind of post as Facebook reports it: "status", "photo", "video" and so on for your Page's own posts, but "post" for a visitor's post and for every deleted post. So never match events of one post by postType.

Post events need a little more care than other events:

  • Every edit of a post is a separate event, with its own eventId. Two edits of the same post within the same second can arrive as one event.
  • In rare cases, the same post event can arrive twice with two different eventId values. Treat a post event with the same postId, action and text as one you already processed. This also covers a new post that arrives as created twice (for example, when two of its edits are processed at the same moment).
  • Facebook can send an edited event a few seconds after a post was deleted (its text then can't be fetched: text is null and textFetched is false). We drop it when we already received the post's deleted event — and we drop a created of that post that comes after its deleted the same way. If both arrive at the same moment it can still reach you: ignore every created or edited event for a postId you already saw deleted.
warning

Posts that your own Page publishes arrive here too, with fromSelf true. If you reply automatically to posts, 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 post event, you will get some of the following:

{
"event": "post",
"action": "created",
"eventId": "fbw_8b2e5d1a9c7f40e3b6d2a8c5f1e9b034",
"platform": "facebook",
"from": "463745743546345",
"facebook_type": 3,
"pageId": "104857362910483",
"postId": "104857362910483_122110934857201",
"postType": "photo",
"author": { "id": "104857362910483", "name": "My Flowers Shop" },
"fromSelf": true,
"text": "Our new spring bouquets are here!",
"published": true,
"link": null,
"photos": ["https://scontent.example.com/v/spring-bouquets.jpg"],
"timestamp": 1795590000,
"textFetched": true
}

Response explained​

ParameterDescription / Example
event"post" always, for post webhooks.
actionWhat happened: "created", "edited", "deleted", "hidden" or "unhidden".
eventIdThe ID of this event (fbw_ and 32 characters). Use it to ignore an event you already received — and for posts, see "Post events need a little more care" above.
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 ID. Use it with Edit Post, Delete Post, Create Comment and All Comments — and, for a visitor's post, Private Reply.
postTypeThe kind of post, as Facebook reports it. Your Page's own posts: for example "status" (text), "photo", "video", "share" or "link". "post" for a visitor's post and on every deleted event.
authorWho wrote the post: id and name (name can be null). null when it is not known. On deleted, hidden and unhidden, see "Deleted, hidden and unhidden posts" above.
actorOnly on deleted, hidden and unhidden (and always there): who deleted, hid or unhid the post, id and name — your own Page, or the person who wrote the post.
fromSelftrue when the post was written by your own Page (the author, never the actor). false for a visitor's post, and when author is null.
textThe text of the post, or null (a deleted post, a post without text, or textFetched false). On hidden and unhidden it is not fetched: null unless Facebook sends it.
publishedtrue for a live post. false when Facebook reports that the post is not published, for example a scheduled post that is not live yet.
linkThe link of the post when Facebook sends one, otherwise null.
photosLinks to the post's photos when Facebook sends them, otherwise an empty list.
timestampWhen it happened (Unix time in seconds, UTC). For edited: the time of the edit. For a visitor's new post sent as created: the time the post was written.
textFetchedWhether we fetched the text from Facebook — see the table above. Not in a deleted, hidden or unhidden 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.