Skip to content

feat(comment-automation): run automations only on posts with given hashtags - #1722

Open
sung17 wants to merge 1 commit into
mainfrom
feat/comment-automation-post-hashtags
Open

sung17 wants to merge 1 commit into
mainfrom
feat/comment-automation-post-hashtags

Conversation

@sung17

@sung17 sung17 commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Comment automations can now target posts whose caption has given hashtags (e.g. only reply on #vip posts) on Facebook, Instagram (both connection kinds), Threads and TikTok.
  • Every channel exposes the caption through its API; TikTok needs the video.list scope, so older TikTok connections are warned to reconnect.

Changes

  • Schema (packages/database/src/partials/comment-automation.ts): new post target { type: "hashtags", value: string[] } + shared normalize/extract/match helpers (Unicode, whole-tag match, max 20).
  • Migration 20261115025035_comment_automation_post_hashtag_miss_reasons: adds miss reasons postHashtagNotMatched, postCaptionUnavailable (two ALTER TYPE ... ADD VALUE).
  • Service: hashtags normalized/validated on every create/update (UI + public API share it); templates keep hashtags on install.
  • Worker (comment-automation/post-caption.ts, index.ts): caption read lazily once per comment — Redis (10 min, 60 s for unavailable) → channel API (10 s timeout) → stored ChannelPost caption. Hashtag gate runs right after the post gate, before AI moderation; unreadable caption → skipped, never answered.
  • Builder: "Posts with hashtags" option + tag input in the 4 forms, TikTok reconnect warning, miss reason labels, i18n in all 21 locales. Fixes: account change no longer clears hashtags; Threads/TikTok edit no longer turns an unknown type into all.
  • Docs: docs/comment-automation.md, comment-automation skill channel matrix.

Test plan

  • pnpm lint
  • check-types for database, business, worker, builder
  • Worker comment-automation tests (gate cases, caption resolver), business post-target/service/template tests, database hashtag helper tests, builder hook test
  • Apply migration (db:migrate) on deploy
  • Manual: comment on a #vip post and a non-#vip post per channel; confirm reply vs. skip reason in the missed-comments dialog

…shtags

Adds a "hashtags" post target for Facebook, Instagram, Threads and TikTok
comment automations. The worker reads the post caption once per comment
(Redis 10 min -> channel API -> stored ChannelPost caption) and records the
new postHashtagNotMatched / postCaptionUnavailable misses.
@github-actions github-actions Bot added the feature New feature or request label Nov 15, 2026

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

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant