ChatbotX icon indicating copy to clipboard operation
ChatbotX copied to clipboard

Instagram: story mentions can't be detected in flows (the "story_mention" attachment type is dropped)

Open innovhub-stack opened this issue 1 month ago • 2 comments

Version: v1.12.0, and the same on main (caa0646, 11 Oct 2026). Instagram channel.

What happens

When someone mentions the connected Instagram account in their story, Meta sends a messages webhook whose attachment has type: "story_mention". The type is accepted by integrations/instagram/src/schema.ts, but getMessageEntity (integrations/instagram/src/handlers/message/incoming-message.ts) passes the downloaded media on as an ordinary attachment (fileType image/video from the MIME type), and contentAttributes is only set for story replies (reply_to.story). So in flows a story mention looks exactly like a photo or video sent by DM:

  • lastUserInputType is image or video (from resolveLastUserInputTracking), never anything mention-specific;
  • there is no trigger, automation or condition for "mentioned us in their story";
  • if downloading the story media fails, the message is stored with no text and no attachment at all.

Why it would help

A thank-you DM for story mentions is one of the most common Instagram automations, and it needs to tell a mention apart from a photo someone sends in a chat.

Suggestion

  1. In getMessageEntity, when messaging.message.attachments contains an item with type: "story_mention", set contentAttributes: { type: "story_mention", url: <payload.url> }, mirroring the existing story_reply handling.
  2. Make it usable in flows, for example a storyMention value for lastUserInputType (condition) and/or a "Story mention" automation next to Story reply that starts a flow.

Workaround we use for now

The workspace Default Reply flow checks lastUserInputType = image / video (or an empty lastUserInput) and replies with wording that fits both a story mention and a shared photo.

innovhub-stack avatar Oct 12 '26 00:10 innovhub-stack

Update: the workaround in the description does not work, and the gap is wider than story mentions. Messages with no text never reach keyword rules or the Default Reply at all: resolveIncomingTextRouting (apps/worker/src/integration/routing.ts) returns { type: "none" } when hasText is false, unless a Get User Data challenge is pending ("Automated (AI) responses stay text-driven only"). So photo/video-only messages, voice notes and story mentions cannot trigger any flow today, and there is no message:received hook for outgoing webhooks either.

It would help if media-only messages could still reach the Default Reply (or a dedicated Story mention automation), even if AI agents stay text-only. For now we poll GET /v1/conversations + GET /v1/contacts/{identifier}/messages every few minutes and alert a person.

innovhub-stack avatar Oct 12 '26 08:10 innovhub-stack

Thanks a lot for this report, @innovhub-stack, and for the follow-up comment. Pointing to getMessageEntity, resolveLastUserInputTracking and resolveIncomingTextRouting made this quick to confirm, and the polling workaround showed us how much the gap was costing you.

This is addressed in #1499:

  • Story mention automation: a new "Story mention" trigger next to Story reply. It can reply with a text, start a flow, or hand off to an AI agent, and it's also available through igStories.create / igStories.list with trigger: "storyMention".
  • Flow conditions: a new storyMention value for lastUserInputType, so flows and contact filters can tell a mention apart from a photo sent in the chat. It's also set when the story media fails to download.
  • Get User Data: a mention still answers a pending Get User Data step, and the automation stays silent while a human agent has the conversation.

One thing isn't in this PR: sending media-only messages in general (photos, videos, voice notes) to the Default Reply. That changes routing on every channel and would also make AI agents start replying to images, so we'll handle it separately.

Thanks again for the clear write-up!

sung17 avatar Oct 16 '26 15:10 sung17