AI Facebook Comment & Messenger Responder
Replies to every Facebook comment and Messenger message with natural Egyptian-Arabic AI responses — with signed-webhook verification, PostgreSQL de-duplication and WhatsApp error alerts.
- 2
- channels: comments + Messenger
- 0
- duplicate replies (DB unique key)
- HMAC
- SHA-256 verified webhooks
- 24
- workflow nodes
- 01 · TriggerMeta webhook
- 02 · LogicVerify signature
- 03 · LogicRoute event
- 04 · DataStore & dedupe
- 05 · AIAI agent (Groq)
- 06 · ActionReply + private DM
Click to interact · zoom, pan and inspect each node. Credentials removed.
The problem
Busy Facebook pages get dozens of comments (“price?”, “available?”) and Messenger messages every day. Answering them manually is slow, replies come hours late, and the same comment sometimes gets answered twice — or not at all.
The solution
An n8n system connected to Meta Webhooks that handles both channels:
Messenger
Incoming messages are extracted and sent to an AI agent running on Groq, which writes a friendly, natural reply in Egyptian Arabic and sends it back through the Graph API.
Post comments
New comments are parsed (comment, post, commenter, permalink), stored in PostgreSQL, and — only if they’re new — the system replies publicly and sends the commenter a private message. Comments made by the page itself are ignored.
Technical details
Security first
- Handles Meta’s webhook verification handshake.
- Validates every event’s HMAC-SHA256 signature with the app secret and rejects anything invalid with the right HTTP status.
Exactly-once replies
Comments are inserted with a unique constraint on (page_id, comment_id). Meta can deliver the same event more than once; the database guarantees it’s only answered once. Original payloads are kept as JSONB for analytics.
Monitoring
An Error Trigger workflow catches any failed execution and sends a WhatsApp alert (via Evolution API) with the workflow name, failing node, error message and a link to the execution.
The result
Every customer gets an instant, human-sounding reply on the channel they used, the page never double-replies, and any failure is reported on WhatsApp before customers notice.