<!-- Generated from the canonical 99 Digital API documentation. Do not edit this file. -->

Canonical page: https://docs.99digital.co.il/facebook-api/webhooks/facebook-post

# Facebook Post

**Webhook.** Sent to the webhook URL you configure.

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](https://docs.99digital.co.il/facebook-api/webhooks/set-webhook) for that
connection. Delivery, retries and duplicates are explained on the
[Webhook Events](https://docs.99digital.co.il/facebook-api/webhooks/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](https://docs.99digital.co.il/facebook-api/facebook-pages/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`:

| `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:

- `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](https://docs.99digital.co.il/facebook-api/webhooks/facebook-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:**

| Setting | Value |
| --- | --- |
| URL | Your URL — set it with [Set Webhook](https://docs.99digital.co.il/facebook-api/webhooks/set-webhook) |
| Method | JSON via POST |

**With every Facebook post event, you will get some of the following:**

```json
{
  "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](https://docs.99digital.co.il/facebook-api/facebook-pages/edit-post), [Delete Post](https://docs.99digital.co.il/facebook-api/facebook-pages/delete-post), [Create Comment](https://docs.99digital.co.il/facebook-api/facebook-pages/create-comment) and [All Comments](https://docs.99digital.co.il/facebook-api/facebook-pages/all-comments) — and, for a visitor's post, [Private Reply](https://docs.99digital.co.il/facebook-api/facebook-pages/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

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `event` | string | "post" always, for post webhooks. Always `post`. |
| `action` | string | What happened to the post. One of: `created` — A new post on your Page — your own (`fromSelf` true) or a visitor's (`fromSelf` false). A visitor's new post is sent as `created` although Facebook reports it as an edit; `edited` — The post's text was changed. `text` is the new text and `timestamp` the time of the edit. Every edit is its own event; `deleted` — The post was deleted. `text` is null, there is no `textFetched`, and `postType` is "post". `actor` says who deleted it; `hidden` — The post was hidden. `actor` says who hid it. Not seen on a real event yet; `unhidden` — The post was made visible again. `actor` says who did it. Not seen on a real event yet. Example: `created`. |
| `eventId` | string | The ID of this event (`fbw_` and 32 characters). Use it to ignore an event you already received. In rare cases the same post event arrives twice with two different `eventId` values: treat a post event with the same `postId`, `action` and `text` as one you already processed. Example: `fbw_8b2e5d1a9c7f40e3b6d2a8c5f1e9b034`. |
| `platform` | string | "facebook" always, for Facebook Pages. Always `facebook`. |
| `from` | string | The ID of your connection — the `from` you use to call our API. Example: `463745743546345`. |
| `facebook_type` | integer | 3 always (Facebook Pages). Always `3`. |
| `pageId` | string | Your Facebook Page ID. Example: `104857362910483`. |
| `postId` | string | The post ID. Use it with Edit Post, Delete Post, Create Comment and All Comments — and, for a visitor's post, Private Reply. Match post events by `postId`. Example: `104857362910483_122110934857201`. |
| `postType` | string | 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, so never match events of one post by `postType`. Example: `photo`. |
| `author` | object \| null | Who wrote the post, or null when it is not known. On deleted, hidden and unhidden it is taken from the post's `created` event we received earlier, and is null when we never received it. |
| `author.id` | string | The writer's Facebook ID (for your Page, the Page ID). Example: `104857362910483`. |
| `author.name` | string \| null | The writer's name, or null when Facebook does not give it. Example: `My Flowers Shop`. |
| `actor` | object \| null | Only on deleted, hidden and unhidden (and always there): who deleted, hid or unhid the post — your own Page, or the person who wrote the post. Check `actor.id` = `pageId` to know if your Page did it. |
| `actor.id` | string | The Facebook ID of who deleted, hid or unhid the post. Example: `104857362910483`. |
| `actor.name` | string \| null | Their name, or null when Facebook does not give it. Example: `My Flowers Shop`. |
| `fromSelf` | boolean | 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. Example: `true`. |
| `text` | string \| null | 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. Example: `Our new spring bouquets are here!`. |
| `published` | boolean | 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. Example: `true`. |
| `link` | string \| null | The link of the post when Facebook sends one, otherwise null. Example: `null`. |
| `photos` | array of string | Links to the post's photos when Facebook sends them, otherwise an empty list. |
| `timestamp` | integer | 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. Example: `1795590000`. |
| `textFetched` | boolean | true — `text` was fetched from Facebook (the text as it is now). false — we fetched and got no text, so `text` is null (a post without text, or Facebook refused or did not answer); the IDs are still valid. Not in a `deleted`, `hidden` or `unhidden` event, or when Facebook sent the text itself. Example: `true`. |

### Example: Created by your Page

Your Page published a photo post — `fromSelf` is true.

```json
{
  "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
}
```

### Example: Visitor post

A visitor wrote a post on your Page — `postType` is "post", `author` is the visitor and `fromSelf` is false. Facebook reports it as an edit; we send it as `created`, with `timestamp` = the time it was written. You can answer it with Private Reply and its `postId`.

```json
{
  "event": "post",
  "action": "created",
  "eventId": "fbw_1d6f3b9e0a4c27d8e5b1f9a3c6d0e742",
  "platform": "facebook",
  "from": "463745743546345",
  "facebook_type": 3,
  "pageId": "104857362910483",
  "postId": "104857362910483_122111209384756",
  "postType": "post",
  "author": {
    "id": "8273645190283746",
    "name": "Dana Cohen"
  },
  "fromSelf": false,
  "text": "Hi, do you ship to Eilat?",
  "published": true,
  "link": null,
  "photos": [],
  "timestamp": 1795596000,
  "textFetched": true
}
```

### Example: Edited

The post's text was changed — `text` is the new text and `timestamp` the time of the edit.

```json
{
  "event": "post",
  "action": "edited",
  "eventId": "fbw_5a0e8c3f7b2d49a1c6e0b8f4d3a7c925",
  "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 — order until Thursday!",
  "published": true,
  "link": null,
  "photos": [],
  "timestamp": 1795603200,
  "textFetched": true
}
```

### Example: Deleted

Your Page deleted a visitor's post — `author` is the visitor who wrote it, `actor` is your Page, and `fromSelf` is false. `postType` is "post", `text` is null and there is no `textFetched`.

```json
{
  "event": "post",
  "action": "deleted",
  "eventId": "fbw_e4b7a1d0c9f362e8b5a0d4c7f1e3b289",
  "platform": "facebook",
  "from": "463745743546345",
  "facebook_type": 3,
  "pageId": "104857362910483",
  "postId": "104857362910483_122111209384756",
  "postType": "post",
  "author": {
    "id": "8273645190283746",
    "name": "Dana Cohen"
  },
  "actor": {
    "id": "104857362910483",
    "name": "My Flowers Shop"
  },
  "fromSelf": false,
  "text": null,
  "published": true,
  "link": null,
  "photos": [],
  "timestamp": 1795606800
}
```

### Example: Your post deleted

Your Page deleted its own post — `author` and `actor` are both your Page, and `fromSelf` is true. `postType` is "post" (the post was a "photo" when it was created).

```json
{
  "event": "post",
  "action": "deleted",
  "eventId": "fbw_7c2a5e9d1b4f60a3e8c1d7b5f9a2e046",
  "platform": "facebook",
  "from": "463745743546345",
  "facebook_type": 3,
  "pageId": "104857362910483",
  "postId": "104857362910483_122110934857201",
  "postType": "post",
  "author": {
    "id": "104857362910483",
    "name": "My Flowers Shop"
  },
  "actor": {
    "id": "104857362910483",
    "name": "My Flowers Shop"
  },
  "fromSelf": true,
  "text": null,
  "published": true,
  "link": null,
  "photos": [],
  "timestamp": 1795610400
}
```

## Responses

### 200 — 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.

### default — 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.
