Quick overview
This workflow ingests college documents from Google Drive into a Supabase vector store, then runs a WhatsApp-based admissions receptionist that handles text, voice, and image enquiries using OpenAI with retrieval and a reviewer step before replying and logging the conversation in Supabase.
How it works
- When a WhatsApp message is received, the workflow detects whether the user sent text, a voice note, or an image.
- For voice notes, it fetches the WhatsApp media URL, downloads the audio, and uses OpenAI to transcribe it into text.
- For images, it fetches the WhatsApp media URL, downloads the image, and uses OpenAI Vision to extract all readable content and combine it with any image caption.
- It normalizes all input types into a single “question” format, then creates a conversation record in Supabase.
- An OpenAI chat agent uses the Supabase vector-store retriever tool to look up relevant college information (with chat history stored in Postgres) and generates a draft reply.
- A second OpenAI reviewer validates the draft against the same Supabase knowledge base, then either approves it, retries generation once with correction instructions, or falls back to a safe response.
- The workflow updates the Supabase conversation record with the final response and sends the reply back to the user via WhatsApp.
Setup
- Connect WhatsApp Cloud API credentials for both the WhatsApp Trigger and WhatsApp nodes, then configure the webhook in Meta to point to the trigger URL.
- Add an OpenAI API credential for chat completions, audio transcription, image analysis, and embeddings.
- Create and connect a Supabase project with a documents table and a match_documents query (RPC) for vector search, then add Supabase API credentials and set the table name used by the vector store nodes.
- Connect a Postgres database for chat memory and ensure it is reachable from your n8n instance.
- Replace placeholders like YOUR_GOOGLE_DRIVE_FILE_ID, YOUR_CLIENT_UUID, and YOUR_USER_UUID, and ensure the Supabase conversations table contains the referenced columns (client_id, user_id, phone, user_message, message_type, ai_response, response_type, language, status).
Requirements
- WhatsApp Cloud API, OpenAI, Supabase with pgvector, PostgreSQL, and Google Drive credentials are required.
Customization
- Replace the college branding and placeholder IDs, then customize the AI prompts, supported languages, response tone, retry rules, and WhatsApp messages.