Skip to content

feat(worker): add AI agent reply support to comment automation - #729

Merged
sung17 merged 1 commit into
mainfrom
fix/comment-automation-reply-detection
Jul 13, 2026
Merged

sung17 merged 1 commit into
mainfrom
fix/comment-automation-reply-detection

Conversation

@sung17

@sung17 sung17 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds AI-agent-generated replies to comment automation (public comment reply or private DM) via a new commentAIReply job
  • Fixes post-id matching, link/keyword detection, and adds a cross-post reply dedup option

Changes

  • apps/worker/src/integration/handlers/comment-automation/ai-reply.ts — new job handler
  • apps/worker/src/integration/handlers/automated-response/replies.ts — generateAIReplyText (tool-free AI generation)
  • apps/worker/src/integration/handlers/comment-automation/index.ts — post-id normalization, link regex, case-insensitive keywords, cross-post skip
  • packages/business/src/fb-comment-automation/service.ts — hasRepliedOnOtherPost
  • packages/worker-config/src/queues/integration/index.ts — new job type
  • .agents/skills/fb-comment-automation/, docs/fb-comment-automation.md — new skill/docs

Test plan

  • pnpm lint
  • pnpm --filter worker check-types
  • pnpm --filter worker test comment-automation (22 passed)
  • manual verification

- Add commentAIReply job and processCommentAIReply handler that generates
  an AI agent reply and delivers it as a public comment reply or private
  DM based on the automation's configured reply channel
- Add generateAIReplyText, a tool-free variant of replyByAI that returns
  plain text instead of sending, so the caller controls delivery
- Fix matchPost to compare normalized {pageId}_{storyId} post ids so
  automations match regardless of which picker (published/ads/reels)
  stored the post id
- Fix LINK_RE to catch bare domains and www. links, not just explicit
  http(s):// links
- Fix willSendReply/executePublicReply/executePrivateReply to require an
  AIAgent value before treating an AIAgent reply as sendable
- Make hasKeywords matching case-insensitive
- Add hasRepliedOnOtherPost + replyToUsersWhoCommentedOnOtherPosts skip
  to avoid re-engaging contacts who already replied on a different post
- Add fb-comment-automation skill and docs
@sung17
sung17 force-pushed the fix/comment-automation-reply-detection branch from 35ea858 to b6ba468 Compare July 13, 2026 06:44
@sung17
sung17 merged commit 983d119 into main Jul 13, 2026
7 checks passed
viethung0o0 pushed a commit that referenced this pull request Sep 7, 2026
- Add commentAIReply job and processCommentAIReply handler that generates
  an AI agent reply and delivers it as a public comment reply or private
  DM based on the automation's configured reply channel
- Add generateAIReplyText, a tool-free variant of replyByAI that returns
  plain text instead of sending, so the caller controls delivery
- Fix matchPost to compare normalized {pageId}_{storyId} post ids so
  automations match regardless of which picker (published/ads/reels)
  stored the post id
- Fix LINK_RE to catch bare domains and www. links, not just explicit
  http(s):// links
- Fix willSendReply/executePublicReply/executePrivateReply to require an
  AIAgent value before treating an AIAgent reply as sendable
- Make hasKeywords matching case-insensitive
- Add hasRepliedOnOtherPost + replyToUsersWhoCommentedOnOtherPosts skip
  to avoid re-engaging contacts who already replied on a different post
- Add fb-comment-automation skill and docs

Co-authored-by: Deathgiver <[email protected]>

This branch was previously deployed

1 inactive deployment
dev — b6ba468d Deployed Jul 13, 2026 by sung17 via Build builder #1864
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