Quick Overview
This workflow answers Instagram DMs using a Google Gemini RAG agent backed by a Qdrant vector store, while automatically ingesting new PDF files from Google Drive into the knowledge base and refreshing the Instagram access token on a schedule.
How it works
- Triggers when an Instagram message is received and filters out echoes and empty messages.
- Uses a Google Gemini chat model with chat memory and a Qdrant retriever tool to generate a context-grounded FAQ response.
- Sends the generated reply back to the sender as an Instagram DM.
- Runs on a daily schedule to refresh the Instagram access token.
- Triggers when a new file is created in a specific Google Drive folder and allows only supported MIME types (PDF).
- Downloads the file, processes items in batches, generates embeddings with Google Gemini, and inserts the document vectors into a Qdrant collection for retrieval.
Setup
- Add Instagram Graph API credentials, set the trigger verify token, and configure the Instagram app/webhook to call the workflow’s Instagram trigger.
- Add Google Gemini (PaLM) API credentials for both the chat model and embedding generation.
- Add Qdrant credentials and ensure the target collection (for example, "n8n-rag-template") exists and matches your embedding dimensions.
- Add Google Drive OAuth2 credentials and set the folder to watch (and ensure it contains the PDFs you want indexed).
- Adjust the allowed MIME type filters and schedule interval to match your content types and token refresh needs.