Skip to content

Add first comments to Instagram posts and Reels - #539

Open
paulocastellano wants to merge 16 commits into
mainfrom
paulocastellano/instagram-first-comment
Open

paulocastellano wants to merge 16 commits into
mainfrom
paulocastellano/instagram-first-comment

Conversation

@paulocastellano

@paulocastellano paulocastellano commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add an optional, text-only first comment to Instagram feed posts and Reels on both login variants. The composer previews the comment and uses the same meta.thread_replies contract as the API and MCP.
  • Request the comments scope through the existing optional-permission flow. Channels with older grants can save the comment in a draft and reconnect when needed.
  • Publish the comment against the confirmed media ID. Keep enough progress to retry without publishing the media twice, and stop automatic replay when Instagram has not confirmed the comment.

Meta permissions

Connection Comments scope
Instagram Login instagram_business_manage_comments
Facebook Login instagram_manage_comments

Instagram Login asks for instagram_business_manage_comments by default, so first comments are on there; an explicit INSTAGRAM_SCOPES list can leave it out to turn them off. Facebook Login does not ask for instagram_manage_comments by default, so first comments stay off there until INSTAGRAM_FACEBOOK_SCOPES adds it once Meta grants access.

The endpoint reference lists a Facebook User token. The moderation guide lists a Page token for its flows, and TryPost stores a Page token for Facebook Login. Validate creation with that token in a Meta test account before enabling the feature in production. Meta documents an additional Ads permission for some Page roles granted through Business Manager. Media comments reference · Comment moderation guide

Verification

  • Focused backend and browser coverage, including both login variants, permissions, approval, drafts, previews, Stories, and publisher recovery.
  • MySQL full suite, with 11,998 passing tests, one skipped test and one todo.
  • PostgreSQL full suite, with 11,998 passing tests and one todo. The queue-lock case failed during the parallel run and passed on an isolated rerun.
  • Chromium suite, with 1,461 passing tests. The channel-permission fixture was updated to grant the new scope and its test passed on rerun.
  • Build, Vue type check, Pint, and scoped ESLint and Prettier checks.

Manual checks

  • Confirm Advanced Access for both comments permissions in the Meta app.
  • With Instagram Login, reconnect a test channel with a previous grant, publish a Feed post with a first comment and confirm the comment appears once.
  • With Facebook Login, add instagram_manage_comments to INSTAGRAM_FACEBOOK_SCOPES, publish a Reel with a first comment and confirm the Page token works and the comment appears once.
  • On a test account, verify the app's 2,200-character boundary and switch a draft with a comment to Story. Confirm the draft keeps the text and scheduling works after removing the comment.

Paulo Castellano added 16 commits November 23, 2026 11:37
- Measure a reply the same way in the reply field and the composer card
  (replyDisplayText), and read stored replies with null text or media.
- Move the comment text mirror to lib/plainText.ts as a step-by-step copy
  of ContentSanitizer::plainText(), covered by PlainTextParityTest.
- Say "Comments are not available" instead of the thread copy when a
  network's comments are off (posts.form.thread.comment_unsupported).
- End an Instagram post that went live without a media id as published
  without its comment, with a warning on its card, instead of failing it.
- Add Post::contentTypeOn() for the type resolution repeated in three
  places, and document first comments in AGENTS.md and .env.example.
- Treat a pending first comment as unconfirmed only while no comment id
  was checkpointed, so a stuck post whose comment went out times out
  instead of asking to check the comment, and posts:retry always drops
  the pending flag.
- Refuse a retry with a pending comment and no checkpointed post with the
  unconfirmed copy, and drop the unused comment_media_unconfirmed key.
- Say "one comment" again in the list-content-types tool description.
Web, API and MCP refuse a second comment, a comment with media and a comment over 2,200 characters with the same field and message.
The reply field's own counter reads the comment as the publisher sends it, so entities that decode to fewer characters no longer mark it over the limit.

This branch has not been deployed

No deployments
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