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

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

# Instagram Comment

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

Instagram Comment allows you to receive a webhook whenever a new comment, or a reply to a comment, is written on your Instagram account's posts (`event` "comment").

It is sent for an Instagram connection (`facebook_type` 4), 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.

- `action` is always "created": a new comment on a post (`parentId` is
  null), or a reply to a comment (`parentId` is the comment it answers).
- The text of the comment comes from Instagram itself, in `text`. There is
  no `textFetched` on Instagram events.
- Instagram does **not** report when a comment is hidden, unhidden,
  deleted or edited — Meta has no webhook for it. So none of these sends
  you anything, also when you do it yourself with
  [Hide Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/hide-comment) or
  [Delete Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/delete-comment).
- Instagram sends no webhook when a new post is published. A post that was
  created in the Instagram app (or on the web) — or any older post that was
  never announced — is announced to you when its **first comment**
  arrives: you get an
  [Instagram Post](https://docs.99digital.co.il/facebook-api/webhooks/instagram-post) event first, and
  this comment about 5 seconds later. The few seconds are not exact: order
  events by `timestamp`.
- A comment on an ad is sent to you as a comment event
  (`mediaProductType` "AD", `adId` set), but it does not announce a post.

:::warning
Comments that your own Instagram account writes — also replies you send
with [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/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](https://docs.99digital.co.il/facebook-api/webhooks/set-webhook) |
| Method | JSON via POST |

**With every Instagram comment event, you will get some of the following:**

```json
{
  "event": "comment",
  "action": "created",
  "eventId": "fbw_b8e1d4a7c0f95263e8b1d4a7c0f9e316",
  "platform": "instagram",
  "from": "463745743546390",
  "facebook_type": 4,
  "igUserId": "17841458392017465",
  "mediaId": "18054729384756120",
  "mediaProductType": "FEED",
  "commentId": "17938475610293847",
  "parentId": null,
  "author": { "id": "17841401234567890", "username": "dana.cohen" },
  "fromSelf": false,
  "text": "Love it! How much is the big bouquet?",
  "adId": null,
  "timestamp": 1795620000
}
```

### Response explained

| Parameter | Description / Example |
| --- | --- |
| `event` | "comment" always, for comment webhooks. |
| `action` | "created" always: a new comment or a reply. |
| `eventId` | The unique ID of this event (`fbw_` and 32 characters). The same comment always comes with the same `eventId`, so use it to ignore an event you already received. |
| `platform` | "instagram" always, for Instagram. |
| `from` | The ID of your connection — the `from` you use to call our API. |
| `facebook_type` | 4 always (Instagram). |
| `igUserId` | Your Instagram account ID. |
| `mediaId` | The post the comment is on. Use it with [All Comments](https://docs.99digital.co.il/facebook-api/instagram-pages/all-comments), [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/create-comment) and [All Posts](https://docs.99digital.co.il/facebook-api/instagram-pages/all-posts). |
| `mediaProductType` | Where the post is, as Instagram reports it: for example "FEED", "REELS", "STORY", or "AD" for an ad. null when Instagram does not send it. |
| `commentId` | The comment ID. Use it with [Create Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/create-comment) (to reply), [Hide Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/hide-comment), [Delete Comment](https://docs.99digital.co.il/facebook-api/instagram-pages/delete-comment) and [Private Reply](https://docs.99digital.co.il/facebook-api/instagram-pages/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 `username` (`username` can be null). null when it is not known. |
| `fromSelf` | true when the comment was written by your own Instagram account. |
| `text` | The text of the comment, or null when it has none. |
| `adId` | When the comment is on an ad: the ad ID. null otherwise. |
| `timestamp` | When the comment was written, as Instagram reports it (Unix time in seconds, UTC). |

## Webhook payload

Content type: `application/json`

| Field | Type | Description |
| --- | --- | --- |
| `event` | string | "comment" always, for comment webhooks. Always `comment`. |
| `action` | string | "created" always: a new comment or a reply. Always `created`. |
| `eventId` | string | The unique ID of this event (`fbw_` and 32 characters). The same comment always comes with the same `eventId`, so use it to ignore an event you already received. Example: `fbw_b8e1d4a7c0f95263e8b1d4a7c0f9e316`. |
| `platform` | string | "instagram" always, for Instagram. Always `instagram`. |
| `from` | string | The ID of your connection — the `from` you use to call our API. Example: `463745743546390`. |
| `facebook_type` | integer | 4 always (Instagram). Always `4`. |
| `igUserId` | string | Your Instagram account ID. Example: `17841458392017465`. |
| `mediaId` | string \| null | The post the comment is on. Use it with All Comments, Create Comment and All Posts. Example: `18054729384756120`. |
| `mediaProductType` | string \| null | Where the post is, as Instagram reports it: for example "FEED", "REELS", "STORY", or "AD" for an ad. null when Instagram does not send it. Example: `FEED`. |
| `commentId` | string | The comment ID. Use it with Create Comment (to reply), Hide Comment, Delete Comment and Private Reply. Example: `17938475610293847`. |
| `parentId` | string \| null | On a reply — the comment it answers. null for a comment on the post itself. Example: `null`. |
| `author` | object \| null | Who wrote the comment, or null when it is not known. |
| `author.id` | string | The writer's Instagram ID (for your account, `igUserId`). Example: `17841401234567890`. |
| `author.username` | string \| null | The writer's Instagram username, or null when Instagram does not give it. Example: `dana.cohen`. |
| `fromSelf` | boolean | true when the comment was written by your own Instagram account. false otherwise (or when `author` is null). Example: `false`. |
| `text` | string \| null | The text of the comment, or null when it has none. Example: `Love it! How much is the big bouquet?`. |
| `adId` | string \| null | When the comment is on an ad — the ad ID. null otherwise. Example: `null`. |
| `timestamp` | integer | When the comment was written, as Instagram reports it (Unix time in seconds, UTC). Example: `1795620000`. |

### Example: Comment

A follower wrote a comment on one of your posts.

```json
{
  "event": "comment",
  "action": "created",
  "eventId": "fbw_b8e1d4a7c0f95263e8b1d4a7c0f9e316",
  "platform": "instagram",
  "from": "463745743546390",
  "facebook_type": 4,
  "igUserId": "17841458392017465",
  "mediaId": "18054729384756120",
  "mediaProductType": "FEED",
  "commentId": "17938475610293847",
  "parentId": null,
  "author": {
    "id": "17841401234567890",
    "username": "dana.cohen"
  },
  "fromSelf": false,
  "text": "Love it! How much is the big bouquet?",
  "adId": null,
  "timestamp": 1795620000
}
```

### Example: Reply by your account

Your account replied to the comment — `parentId` is set and `fromSelf` is true. Skip it in a bot that replies automatically.

```json
{
  "event": "comment",
  "action": "created",
  "eventId": "fbw_d2a5f8c1e4b79036a2d5f8c1e4b7a940",
  "platform": "instagram",
  "from": "463745743546390",
  "facebook_type": 4,
  "igUserId": "17841458392017465",
  "mediaId": "18054729384756120",
  "mediaProductType": "FEED",
  "commentId": "17938475610299012",
  "parentId": "17938475610293847",
  "author": {
    "id": "17841458392017465",
    "username": "my_flowers_shop"
  },
  "fromSelf": true,
  "text": "Hi Dana, it's 180 NIS — sent you the details in DM!",
  "adId": null,
  "timestamp": 1795620300
}
```

### Example: Comment on an ad

A comment on an ad — `mediaProductType` is "AD" and `adId` is set. It does not announce a post.

```json
{
  "event": "comment",
  "action": "created",
  "eventId": "fbw_f6c9b2e5a8d10347c6f9b2e5a8d1c053",
  "platform": "instagram",
  "from": "463745743546390",
  "facebook_type": 4,
  "igUserId": "17841458392017465",
  "mediaId": "18061234567890123",
  "mediaProductType": "AD",
  "commentId": "17938475610305566",
  "parentId": null,
  "author": {
    "id": "17841409876543210",
    "username": "yossi.levi"
  },
  "fromSelf": false,
  "text": "Do you deliver to Haifa?",
  "adId": "120211938475610290",
  "timestamp": 1795621800
}
```

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