Reply to Facebook comments with OpenRouter, Supabase, Postgres and Google Drive
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (16)
- Webhook
n8n-nodes-base.webhook - Respond to Webhook
n8n-nodes-base.respondToWebhook - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenRouter Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenRouter - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Facebook Graph API
n8n-nodes-base.facebookGraphApi - No Operation, do nothing
n8n-nodes-base.noOp - Google Drive Trigger
n8n-nodes-base.googleDriveTrigger - Google Drive
n8n-nodes-base.googleDrive - Extract from File
n8n-nodes-base.extractFromFile - Supabase Vector Store
@n8n/n8n-nodes-langchain.vectorStoreSupabase - Supabase
n8n-nodes-base.supabase - Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - Embeddings OpenAI
@n8n/n8n-nodes-langchain.embeddingsOpenAi - Postgres Chat Memory
@n8n/n8n-nodes-langchain.memoryPostgresChat
What it does
Quick overview This workflow auto-replies to Facebook Page comments using an OpenRouter-powered AI Agent with Postgres chat memory and a Supabase vector knowledge base, while keeping that knowledge base synced from PDFs in Google Drive (new, updated, and deleted files). How it works 1. Receives Meta webhook requests and returns the hub.challenge value to complete Facebook webhook verification when required. 2. Extracts the incoming Facebook comment details, ignores non-comment events, and skips comments authored by the Page itself to prevent reply loops. 3. Fetches the original Facebook post message via the Facebook Graph API to provide context for the reply. 4. Uses an AI Agent backed by an OpenRouter chat model, Postgres chat memory (per post and user), and a Supabase vector-store retrieval tool to draft a concise response. 5. Posts the AI-generated text back to Facebook as a reply to the specific comment via the Facebook Graph API. 6. Monitors Google Drive folders for PDF creations, updates, and “trash” events, then extracts text, generates OpenAI embeddings, and inserts or deletes matching vectors in Supabase to keep the knowledge base in sync. Setup 1. Create and connect Facebook Graph API credentials, subscribe your Facebook App/Page to the webhook, and configure Meta to call this workflow’s webhook URL. 2. Add an OpenRouter API credential and select the model you want the AI Agent to use. 3. Add Postgres credentials and ensure the database is reachable for storing chat history sessions. 4. Add Supabase credentials, create a documents table for vector storage, and ensure the vector store configuration matches your embeddings. 5. Add Google Drive OAuth credentials and update the folder IDs to the Drive folders you want to watch for new PDFs, updated PDFs, and trashed files.