# Instagram story mentions and story replies in the webhook

> How story mentions and story replies arrive in the Instagram messages webhook, what the CDN URL allows, which permissions apply and how to reply.

Published 2026-11-04. Z-API Omni team.

Both events arrive in the `messages` webhook field. A story mention is a message with an attachment of type `story_mention`, and its `payload.url` is the story's CDN URL ([story mentions, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/instagram-messaging/features/story-mention)). A story reply is a message that carries a `reply_to.story` object with the story's `url` and `id` ([Instagram messaging webhooks, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/instagram-messaging/webhooks)). You answer either one with an ordinary Send API call to the sender's IGSID. Meta documents no story-specific reply call.

## Which Instagram stack each fact comes from

Meta documents two Instagram stacks, and the story pages don't cover them evenly.

| Stack | Host and token | Messaging permissions | Story events Meta documents |
| --- | --- | --- | --- |
| Instagram API with Instagram Login | `graph.instagram.com`, Instagram User access token | `instagram_business_basic`, `instagram_business_manage_messages` | `reply_to.story` in the webhook examples; story mentions listed as a way a conversation begins |
| Messenger API for Instagram (Facebook Login) | `graph.facebook.com`, Page access token | `instagram_basic`, `instagram_manage_messages`, `pages_manage_metadata` | The `story_mention` sample, `reply_to.story` and the Conversations API `story` field |

The `story_mention` payload sample exists only on the Facebook Login page. The Instagram Login pages show none, so send yourself a test mention before you ship a parser for that stack.

## The story mention payload

Meta sends a mention when someone tags your professional account in a story. Meta's webhooks page says "Only story mentions will trigger a webhook," so a tag on a feed post sends nothing ([Instagram messaging webhooks, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/instagram-messaging/webhooks)).

The mentioning account decides delivery. The webhook "will only flow in if the user mentioning the account has their account set up as public" ([older story mention page](https://developers.facebook.com/docs/messenger-platform/instagram/features/story-mention), accessed 2026-11-04). The current page adds that a private account's mention comes through only if that account follows yours.

This is Meta's sample. Its trailing comma after the `entry` array is removed here so it parses.

```json
{
  "object": "instagram",
  "entry": [
    {
      "id": "<IGID>",
      "time": 1569262486134,
      "messaging": [
        {
          "sender": { "id": "<IGSID>" },
          "recipient": { "id": "<IGID>" },
          "timestamp": 1569262485349,
          "message": {
            "mid": "<MESSAGE_ID>",
            "attachments": [
              {
                "type": "story_mention",
                "payload": { "url": "<CDN_URL>" }
              }
            ]
          }
        }
      ]
    }
  ]
}
```

`recipient.id` is your professional account and `sender.id` is the IGSID of the person who mentioned you. The sample has no text field.

### Fetch the story from the message ID

If you stored only the message ID, request its `story` field through the Conversations API. Meta prints only the path, so this curl adds the Facebook Login host and a Page token.

```bash
curl -X GET "https://graph.facebook.com/v26.0/MESSAGE_ID?fields=story&access_token=PAGE_ACCESS_TOKEN"
```

Meta's sample response follows.

```json
{
  "story": {
    "mention": {
      "link": "<CDN_URL>",
      "id": "<STORY_ID>"
    }
  },
  "id": "<MESSAGE_ID>"
}
```

## The story reply payload

When someone answers one of your stories, the `messages` notification carries `reply_to.story`. Meta's full `messages` sample on the Facebook Login page is an annotated field list with comments and duplicate keys, so it doesn't parse. The message object below is built from that field reference, not copied from Meta.

```json
{
  "mid": "<MESSAGE_ID>",
  "text": "<MESSAGE_TEXT>",
  "reply_to": {
    "story": {
      "url": "<CDN_URL>",
      "id": "<STORY_ID>"
    }
  }
}
```

The Instagram Login webhook examples show the same `reply_to.story` shape, so story replies are documented on both stacks ([webhook examples, accessed 2026-11-04](https://developers.facebook.com/documentation/instagram-platform/webhooks/examples)). Meta's webhooks page adds that "Story Replies webhook currently doesn't support GIF or sticker."

`reply_to` has a second shape. `reply_to.mid` marks an inline reply to an earlier message in the thread. Check for `story` before `mid` when you branch.

## Parse both events in one handler

This function sorts one `entry[].messaging[]` item. It runs on Python 3.9 with the standard library and uses Meta's mention sample as input.

```python
import json

SAMPLE = """{"object": "instagram", "entry": [{"id": "<IGID>", "time": 1569262486134,
  "messaging": [{"sender": {"id": "<IGSID>"}, "recipient": {"id": "<IGID>"},
  "timestamp": 1569262485349, "message": {"mid": "<MESSAGE_ID>",
  "attachments": [{"type": "story_mention", "payload": {"url": "<CDN_URL>"}}]}}]}]}"""

def classify(event):
    message = event.get("message")
    if message is None:
        return "other", {}
    reply_to = message.get("reply_to") or {}
    if "story" in reply_to:
        story = reply_to["story"]
        return "story_reply", {"story_id": story.get("id"), "cdn_url": story.get("url"),
                               "text": message.get("text")}
    for attachment in message.get("attachments") or []:
        kind = attachment.get("type")
        if kind == "story_mention":
            return "story_mention", {"cdn_url": (attachment.get("payload") or {}).get("url")}
        if kind == "ephemeral":
            return "ephemeral", {}
    if message.get("is_unsupported"):
        return "unsupported", {}
    if "mid" in reply_to:
        return "inline_reply", {"reply_to_mid": reply_to["mid"]}
    return "message", {"text": message.get("text")}

if __name__ == "__main__":
    body = json.loads(SAMPLE)
    for entry in body["entry"]:
        for event in entry["messaging"]:
            print(event["sender"]["id"], *classify(event))
```

The Facebook Login page lists the attachment types as "audio, file, image (image or sticker), share, story_mention, video, ig_reel or reel". Disappearing media arrives as `ephemeral`, and "no URL is included for ephemeral media". Meta says `is_unsupported` is "Included when a customer sends a message with unsupported media."

On Instagram Login, a new `ig_post` attachment is replacing `share`. Meta's Instagram page says the transition ended on February 1, 2026. The [Messenger changelog](https://developers.facebook.com/documentation/business-messaging/messenger-platform/changelog) of April 27, 2026 says `share` is removed gradually, "once rollout reaches your app" (accessed 2026-11-24). Accept both types. Meta says "New integrations must support the `ig_post` attachment type" ([new webhooks, accessed 2026-11-04](https://developers.facebook.com/documentation/instagram-platform/webhooks/new)). Add it to the type switch if you run that stack.

## What you may keep, and for how long

A story "disappears after 24 hours or when deleted by the user", and then "the URL will stop rendering", per the older story mention page. Meta gives no separate expiry for the CDN URL itself.

You may store the URL. You may not keep the media: "You must not store or cache the media content on your server." Downloading the image to your own bucket for an agent view breaks that rule.

Meta describes two ways to show a mention in an inbox. Load the CDN URL when an agent opens the thread, or show a placeholder with a view button. Once the URL stops loading, Meta recommends a placeholder saying the content is no longer available.

## Permissions and webhook setup

On Facebook Login you need `instagram_basic`, `instagram_manage_messages` and `pages_manage_metadata`. The overview also lists `pages_show_list` and `business_management` ([Instagram messaging overview, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/instagram-messaging/overview)). Meta's webhooks page says "Your app must be published, regardless of app review status, to receive webhooks." Until App Review, only people with a role on the app trigger them. Creator accounts must make one Conversations API request before they receive any.

On Instagram Login you need `instagram_business_basic` and `instagram_business_manage_messages`, with Advanced Access for accounts you don't own or manage ([messaging API, accessed 2026-11-04](https://developers.facebook.com/documentation/instagram-platform/instagram-api-with-instagram-login/messaging-api)). Subscribe to `messages` on either stack. Meta notes that messages delivered by webhook are not marked Read in the Instagram app inbox. Neither stack documents a story-specific permission.

## Reply to a mention or a story reply

Send a normal message to the IGSID from `sender.id`. This is Meta's Instagram Login text sample, with the line continuations it lacks added so it runs ([messaging API, accessed 2026-11-04](https://developers.facebook.com/documentation/instagram-platform/instagram-api-with-instagram-login/messaging-api)).

```bash
curl -X POST "https://graph.instagram.com/v26.0/IG_ID/messages" \
     -H "Authorization: Bearer INSTAGRAM_USER_ACCESS_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "recipient": { "id": "IGSID" },
           "message": { "text": "TEXT_OR_LINK" }
         }'
```

On Facebook Login the same body goes to `https://graph.facebook.com/v26.0/me/messages` with a Page access token. Meta's send page also documents a `reply_to` object with a `mid` that quotes a specific message. It doesn't mention stories, so quoting a mention's `mid` is untested.

### The messaging window after a mention

Meta's Instagram Login page says conversations "only begin when an Instagram user sends a message to your app user through" channels that include story mentions. No page says a mention or a story reply opens the 24-hour window. Treat a mention as a conversation start Meta lists, and test a reply before you promise customers that path.

The standard window lasts 24 hours "for most user actions", and up to 7 days after a Click-to-Direct ad. A person on your team can use the separate 7-day Human Agent window. [The Instagram 24-hour window and human agent tag](/academy/articles/instagram-messaging-api-24-hour-window-human-agent-tag/) covers both. Meta's Messenger Platform error table, which also covers Instagram, lists error 10 with subcode 2534022 for a send outside the window ([error codes, accessed 2026-11-04](https://developers.facebook.com/documentation/business-messaging/messenger-platform/error-codes)).

Comments on posts and reels follow a different path, covered in [private replies to Instagram comments](/academy/articles/instagram-comment-private-replies-api/). For the app, tokens and webhook subscription, start with [Instagram messaging API setup with Instagram Login](/academy/articles/instagram-messaging-api-setup-instagram-login/).

*Z-API Omni team*
