{"product_id":"n8n-facebook-messenger-rag-chatbot-w-google-drive-supabase","title":"n8n Facebook Messenger RAG Chatbot w\/ Google Drive \u0026 Supabase","description":"\u003ch3\u003eTurn your Facebook page into a RAG-powered knowledge assistant—using Google Drive PDFs and a Supabase vector database\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow builds a Facebook Messenger chatbot that answers user questions by retrieving relevant passages from a Supabase vector knowledge base created from PDFs stored in Google Drive. It also keeps your index automatically synced when files are created, updated, or deleted.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eConnects to Facebook Messenger via Webhooks:\u003c\/b\u003e handles the Meta verification challenge by echoing the \u003ccode\u003ehub_challenge\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eProcesses incoming messages:\u003c\/b\u003e extracts sender\/page IDs and message text, and \u003cb\u003eignores messages sent by the page to itself\u003c\/b\u003e to avoid loops.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eRetrieves knowledge with RAG:\u003c\/b\u003e uses a LangChain AI Agent with \u003cb\u003ePostgres chat memory\u003c\/b\u003e to embed the user query (OpenAI embeddings) and fetch relevant passages from a \u003cb\u003eSupabase vector store\u003c\/b\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eGenerates grounded answers:\u003c\/b\u003e sends the user’s question plus retrieved context to an \u003cb\u003eOpenRouter chat model\u003c\/b\u003e, then replies back to the user via the \u003cb\u003eFacebook Graph API\u003c\/b\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eIndexes Google Drive PDFs automatically:\u003c\/b\u003e\n    \u003cul\u003e\n      \u003cli\u003eWhen a file is \u003cb\u003ecreated\u003c\/b\u003e in a specified Drive folder: downloads the PDF, extracts text, chunks it, generates OpenAI embeddings, and inserts vectors into Supabase.\u003c\/li\u003e\n      \u003cli\u003eWhen a file is \u003cb\u003eupdated\u003c\/b\u003e: deletes matching vectors in Supabase, then re-downloads, re-extracts, re-chunks, re-embeds, and re-indexes.\u003c\/li\u003e\n      \u003cli\u003eWhen a file appears in a designated Drive \u003cb\u003eTrash\u003c\/b\u003e folder: deletes matching vectors in Supabase and permanently deletes the file from Google Drive.\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSaaS support: answer “How do I…” questions from your help-center PDFs directly in Facebook Messenger.\u003c\/li\u003e\n  \u003cli\u003eSales enablement: respond with policy, product, or pricing documentation stored as Drive PDFs.\u003c\/li\u003e\n  \u003cli\u003eOps teams: maintain an always-current chatbot knowledge base without manual reindexing.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003en8n workflow triggers:\u003c\/b\u003e Facebook Messenger webhook + Google Drive events (create\/update\/trash).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eAI\/RAG components:\u003c\/b\u003e LangChain AI Agent, OpenAI embeddings, Supabase vector store, OpenRouter chat model.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eMemory \u0026amp; persistence:\u003c\/b\u003e Postgres chat memory for conversation context.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eNodes\/controls reflected in the workflow:\u003c\/b\u003e webhook, if, set, no op, supabase, sticky note.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46157941538995,"sku":"N8N-20337","price":28.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/q07s03KxwYAYGZ3v-5FUA_dmUHDWfY.png?v=1791019114","url":"https:\/\/buyflowscripts.com\/products\/n8n-facebook-messenger-rag-chatbot-w-google-drive-supabase","provider":"N8N Commerce","version":"1.0","type":"link"}