Repository navigation
fix(comment-automation): send private reply flows on instagram channels - #1018
Merged
Merged
Conversation
Flow-type private replies on instagram/instagramFacebook were enqueued without a commentAnchor, so the flow went out as a normal DM gated by the 24-hour messaging window and failed for commenters outside it. Mirror the messenger fix: deliver the first flow message through Meta's comment_id-anchored Send API (7-day comment window), resolving the Instagram messaging policy lazily so the up-front window check no longer kills the exempt anchored send. Also stamps metadata on IG private replies so coexist echo webhooks dedup them.
realcodesiman
pushed a commit
that referenced
this pull request
Aug 23, 2026
Both `docs/fb-comment-automation.md` and the `fb-comment-automation` skill still
claimed Instagram comment automation was unimplemented ("the builder always stores
`type = "messenger"`", "IG private-DM text is out of scope"), which has been wrong
since #874 shipped the `ig-comments` builder feature and the `instagram` /
`instagramFacebook` channel types. #831 and #1018 then moved flow-based private
replies onto Meta's comment_id-anchored Send API. None of those PRs touched the
docs, so the guidance actively told readers (and AI agents) not to work on IG.
Rewrite the scope banner, the `type` option row, the reply-type table, the known-gap
bullet and skill trap 6 to describe the three `CommentAutomationChannelType` values,
and record the real per-channel limits: comment liking is messenger +
instagramFacebook only, and the hide image/video attachment lookup is messenger only.
Claude-Session: https://claude.ai/code/session_01Jr3BRqH3woCzbcePEBPira
Co-authored-by: Claude Opus 5 <[email protected]>
viethung0o0
pushed a commit
that referenced
this pull request
Sep 7, 2026
…ls (#1018) Flow-type private replies on instagram/instagramFacebook were enqueued without a commentAnchor, so the flow went out as a normal DM gated by the 24-hour messaging window and failed for commenters outside it. Mirror the messenger fix: deliver the first flow message through Meta's comment_id-anchored Send API (7-day comment window), resolving the Instagram messaging policy lazily so the up-front window check no longer kills the exempt anchored send. Also stamps metadata on IG private replies so coexist echo webhooks dedup them. Co-authored-by: Deathgiver <[email protected]>
viethung0o0
pushed a commit
that referenced
this pull request
Sep 7, 2026
Both `docs/fb-comment-automation.md` and the `fb-comment-automation` skill still
claimed Instagram comment automation was unimplemented ("the builder always stores
`type = "messenger"`", "IG private-DM text is out of scope"), which has been wrong
since #874 shipped the `ig-comments` builder feature and the `instagram` /
`instagramFacebook` channel types. #831 and #1018 then moved flow-based private
replies onto Meta's comment_id-anchored Send API. None of those PRs touched the
docs, so the guidance actively told readers (and AI agents) not to work on IG.
Rewrite the scope banner, the `type` option row, the reply-type table, the known-gap
bullet and skill trap 6 to describe the three `CommentAutomationChannelType` values,
and record the real per-channel limits: comment liking is messenger +
instagramFacebook only, and the hide image/video attachment lookup is messenger only.
Claude-Session: https://claude.ai/code/session_01Jr3BRqH3woCzbcePEBPira
Co-authored-by: Claude Opus 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
instagram/instagramFacebookcomment automations were enqueued without acommentAnchor, so the flow went out as a normal DM gated by the 24-hour messaging window and failed for commenters outside it (text replies already used the comment_id-anchored API and worked).recipient: { comment_id }Send API (7-day comment window, exempt from the 24h rule); subsequent messages use the normal path.metadata: SENT_FROM_CHATBOTX, so coexist message_echo webhooks dedup them instead of re-ingesting our own reply as an incoming message.Changes
apps/worker/src/integration/handlers/comment-automation/private-reply.ts— always attach the privatecommentAnchortosendFlowjobs (was messenger-only).apps/worker/src/chat/handlers/send-flow-step.ts— defensive channel gate now also allowsinstagram; stale "no Instagram private_replies equivalent" comment corrected.integrations/instagram+integrations/instagram-facebook— newsendPrivateReplyMessageAPI (full message payload, metadata stamp,retry: 0);sendPrivateReplydelegates to it;sendFlowStepconsumes the anchor for the first yielded message.integrations/instagram—resolveInstagramMessagingPolicyis now resolved lazily (memoized) insendFlowStepso the up-frontinstagram_response_window_expiredthrow no longer kills the exempt anchored send; non-anchored sends keep the exact same enforcement.packages/sdk—CommentAnchorJSDoc updated to reflect Messenger + Instagram support.send-flow-step-comment-anchor.test.tsfor both IG integrations (incl. the >24h regression case both ways); worker tests flipped from asserting the old messenger-only behavior; API tests updated for the metadata stamp.Test plan
vitest— instagram 58/58, instagram-facebook 32/32, messenger 209/209, worker 1596/1596turbo check-types— 56/56 packages (pre-commit hook)ultracite/biome clean (pre-commit hook)instagram_response_window_expiredin worker logs, no duplicate incoming message (echo dedup)