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 (
fromSelftrue — also the ones you publish with Create Post), and posts that visitors write on your Page (fromSelffalse — see "A visitor's new post" below). - edited — the post's text was changed.
textis the new text, andtimestampis the time of the edit. - deleted — the post was deleted.
textis null and there is notextFetched: the post no longer exists, so nothing is fetched.actorsays who deleted it. - hidden / unhidden — the post was hidden, or made visible again.
actorsays who did it. We have not seen these two on a real event yet, so theirauthor(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:
textFetched | Meaning |
|---|---|
true | text was fetched from Facebook: the post's text as it is now (for edited, the new text). |
false | We 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:
actoris who deleted, hid or unhid the post — your own Page, or the person who wrote the post. To know if your Page did it, checkactor.id=pageId.authoris the person who wrote the post. We take it from that post'screatedevent, which we received earlier (a visitor's post that we sent ascreatedcounts too). When we never received it (for example, the post was written before your connection was made, or more than a year ago),authoris null.fromSelfrefers to theauthoronly, never to theactor: it isfalsewhenauthoris null.- Nothing is fetched for these three actions, so there is no
textFetched, andtextis 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
eventIdvalues. Treat a post event with the samepostId,actionandtextas one you already processed. This also covers a new post that arrives ascreatedtwice (for example, when two of its edits are processed at the same moment). - Facebook can send an
editedevent a few seconds after a post was deleted (its text then can't be fetched:textis null andtextFetchedis false). We drop it when we already received the post'sdeletedevent — and we drop acreatedof that post that comes after itsdeletedthe same way. If both arrive at the same moment it can still reach you: ignore everycreatedoreditedevent for apostIdyou already sawdeleted.
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:
| Setting | Value |
|---|---|
| URL | Your URL — set it with Set Webhook |
| Method | JSON 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
| Parameter | Description / Example |
|---|---|
event | "post" always, for post webhooks. |
action | What happened: "created", "edited", "deleted", "hidden" or "unhidden". |
eventId | The 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. |
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 ID. Use it with Edit Post, Delete Post, Create Comment and All Comments — and, for a visitor's post, Private Reply. |
postType | The 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. |
author | Who 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. |
actor | Only 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. |
fromSelf | true 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. |
text | The 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. |
published | true for a live post. false when Facebook reports that the post is not published, for example a scheduled post that is not live yet. |
link | The link of the post when Facebook sends one, otherwise null. |
photos | Links to the post's photos when Facebook sends them, otherwise an empty list. |
timestamp | When 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. |
textFetched | Whether we fetched the text from Facebook — see the table above. Not in a deleted, hidden or unhidden 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.