feat(threads): add comment auto-reply automation - #1020
Draft
AlanSyue wants to merge 2 commits into
Draft
Conversation
The threads workspace re-exported the node vitest preset verbatim, and MSW is opt-in there (see packages/vitest-config/src/node.ts): without `mswSetupFiles` the shared `setupServer()` is never started, so every `server.use(...)` handler in `__tests__/auth.test.ts` and `__tests__/comment.test.ts` was registered against a server that was not listening. Those 11 tests reached the real graph.threads.com and failed on live OAuth errors. Opt into the MSW lifecycle the same way instagram, instagram-facebook and messenger do. No test assertion is changed; the handlers already existed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Jr3BRqH3woCzbcePEBPira
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.
Adds Threads as a comment-automation channel: connect a Threads account, define keyword-matched automations against your posts, and auto-reply publicly to matching comments — the same flow Facebook and Instagram comment automations already offer.
What's included
New integration package —
integrations/threads/refreshAuthfor the 60-day tokencommentchannel only. Threads has no Messaging API, so nomessagechannel is declared rather than declaring one that always fails.Database
IntegrationThreadstable (one row per connected account; unique onthreadsUserIdand oninboxId)fbCommentAutomationTypegains athreadsvalueWorker — comment automation extended to Threads
The existing pipeline now runs on Threads behind explicit capability predicates rather than silent no-ops:
POST /{comment-id}/likesequivalentAn automation configured with an action the channel cannot perform logs an unsupported-capability line instead of enqueuing a job that could only fail, and the dedup/counter accounting only records a reply that actually went out.
Token refresh registers into the existing
refreshChannelTokensadapter on the daily 02:00 run. Threads tokens are 60-day, so it deliberately does not join the midday short-lived pass.Builder
CHANNEL_CAPABILITIES, so it appears in the channel create picker and settings without any new hardcoded channel listthreads-commentsCRUD pages mirroring the existing Facebook and Instagram comment-automation screensuseTranslations(); 20 locale files updatedTesting
apps/workerapps/builder@chatbotx.io/integration-threads@chatbotx.io/integration-messenger@chatbotx.io/integration-instagram@chatbotx.io/integration-instagram-facebook@chatbotx.io/databasepnpm lintis clean, as arecheck-typesfor worker, builder and database.Notes for review
supports*predicate returnstrueformessenger/instagram/instagramFacebook, so all the new guards are no-ops on those channels.20260820152925_create_channel_api. The enum value is a separate migration because Postgres cannot use a newly added enum value inside the transaction that adds it.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jr3BRqH3woCzbcePEBPira