Skip to content

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

Merged
sung17 merged 3 commits into
mainfrom
feat/comment-automation-post-hashtags
Nov 16, 2026
Merged

sung17 merged 3 commits 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
Deathgiver and others added 2 commits November 16, 2026 23:04
Regenerate the miss-reason enum migration after main's
broadcast_status_reason so the snapshot chain no longer forks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sung17
sung17 merged commit 3e2b02e into main Nov 16, 2026
14 checks passed
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
…shtags (#1722)

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

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.

* fix(database): rebase comment automation hashtag migration onto main

Regenerate the miss-reason enum migration after main's
broadcast_status_reason so the snapshot chain no longer forks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Deathgiver <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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