An autonomous AI agent built in n8n that manages a commercial Facebook page for a beauty clinic in Cairo, Egypt. It listens to public feed comments, automatically replies publicly, and seamlessly transitions the user into a private Messenger chat to answer FAQs, promote offers, and book appointments using Google Gemini and LangChain.
# 📱 Facebook AI Community Manager (Public-to-Private Orchestration)
An autonomous AI agent built in n8n that manages a commercial Facebook page for a beauty clinic in Cairo, Egypt. It listens to public feed comments, automatically replies publicly, and seamlessly transitions the user into a private Messenger chat to answer FAQs, promote offers, and book appointments using Google Gemini and LangChain.
This project demonstrates advanced **Event-Driven Architecture** and **Omnichannel Handoffs**, bridging public social media engagement directly into a private, agentic sales funnel.
## 🚀 Business Value & Motivation
Converting social media engagement into actual sales requires immediate response times. When a customer comments on a promotional post asking for prices or booking details, delayed responses result in lost leads. This workflow acts as an automated lead-generation funnel. By instantly acknowledging a public comment and transitioning the customer to a private DM, it captures high-intent leads, answers their specific questions, and securely handles their data to finalize bookings without human intervention.
## 🏗️ Core Architecture & Pipeline Flow
The workflow relies on the Facebook Graph API and conditional routing to manage the state of the conversation:
### 1. Event Ingestion & Filtering
* **Webhooks (`Facebook Trigger`):** Actively listens to the Facebook Page's `feed` events to detect new user interactions.
* **Infinite Loop Protection (`If` Node):** Enforces a strict condition that verifies the incoming message's sender ID does not match the bot's own Page ID, preventing the agent from replying to itself.
### 2. Public-to-Private Handoff
* **Public Acknowledgment (`Comment_replier`):** Executes a POST request via the Facebook Graph API to reply directly to the user's public comment with a concise "Replied on Messenger 💬".
* **Private Dispatch (`message_sender`):** An HTTP Request node hits the Facebook Graph API `/me/messages` endpoint to pus …