Skip to content

Instagram step 2: customers' direct messages reach the inbox (ADR-0028) - #212

Merged
yatping merged 2 commits into
instagram-step-1from
instagram-step-2
Dec 3, 2026
Merged

yatping merged 2 commits into
instagram-step-1from
instagram-step-2

Conversation

@yatping

@yatping yatping commented Dec 2, 2026

Copy link
Copy Markdown
Member

Step 2 of ADR-0028, stacked on #211.

  • Receiving: the Messenger webhook now stores Instagram direct messages for the connection's account, while Instagram is on. They go through the same identities, conversations, R2 media job and profile job as Messenger, with channel_kind = 'instagram'.
  • Migration 0043: messenger_identities.channel (default 'messenger', expand only). Export and the profile job use it to tell the two apart. This deviates slightly from the ADR's "tables unchanged"; it will be noted in the ADR.
  • What only Instagram sends: story replies and mentions, shares and reels, view-once media, unsent and unsupported messages each become a line, with Meta's link where there is one. An unsent message gets its own key (unsent:<mid>), so it isn't taken for a repeat. Files are also accepted from cdninstagram.com. Contacts are named from Meta's name, else @username.
  • Until step 3: replies get 409 instagram_replies_unavailable, notes still work, and the assistant doesn't answer.
  • API minor 12: instagram as a channel, and instagram identities in contact export.
  • Dashboard: Instagram mark, a note for each Instagram kind, notes-only composer. 11 languages, machine-translated.
  • Docs: inbox guide, admin guide, data model, background jobs, known issues.

pnpm verify passes. A real-Cloudflare test on preview-ig is next.

Cloud needs its own migration (0009, allowance triggers for channel_kind = 'instagram') before it takes this.

🤖 Generated with Claude Code

yatping and others added 2 commits December 2, 2026 12:38
- The Messenger webhook stores Instagram messages for the connection's
  account while Instagram is on, through the same identities,
  conversations, media and profile jobs, with channel_kind 'instagram'.
- Migration 0043: messenger_identities.channel ('messenger' default,
  'instagram'), so export and the profile job tell them apart.
- Story replies and mentions, shares, view-once media, unsent and
  unsupported messages become lines saying what they were, with Meta's
  link where there is one. Instagram's CDN is allowed for files. Names
  come from Meta's name, else @username.
- Until step 3, replies are refused with 409
  instagram_replies_unavailable and the assistant does not answer.
- API minor 12: 'instagram' channel, `instagram` in contact export.
- Dashboard: Instagram mark, notes for its kinds, notes-only composer,
  11 languages (machine-translated). Docs updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Patrick Ng <yatping0617@gmail.com>
Found on real Cloudflare: Instagram's CDN (lookaside.fbsbx.com
ig_messaging_cdn) redirects a request with no User-Agent, which is what
a Worker's fetch sends, to facebook.com/unsupportedbrowser, so the photo
failed. Any User-Agent gets the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Patrick Ng <yatping0617@gmail.com>
@yatping
yatping merged commit 792a7ab into instagram-step-1 Dec 3, 2026
4 checks passed
yatping added a commit that referenced this pull request Dec 3, 2026
…8) (#216)

Same content as #212, which was merged into its stacked base branch by mistake instead of main.

Signed-off-by: yatping <yatping0617@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant