About This Template
This workflow automatically generates and sends AI-powered responses to user inquiries from a LINE Official Account.
It uses RAG (Retrieval-Augmented Generation) technology to produce natural, context-aware answers based on your FAQ database (Supabase/PostgreSQL).
How It Works
- Receive Questions: An n8n webhook receives messages from your LINE Official Account.
- FAQ Search: The n8n LangChain Agent analyzes the user’s question and performs a vector search on your Supabase FAQ database. It can also fetch user-specific data (e.g., reservation info) from PostgreSQL.
- AI Generation: The OpenAI GPT model generates a context-aware answer based on the retrieved information and conversation history.
- Reply: The response is sent back to the user via the LINE Messaging API.
- Admin Notifications: (Optional) If the AI cannot answer, the workflow can notify admins (e.g., via LINE WORKS or Slack).
Who It’s For
- Businesses wanting to automate customer support on LINE.
- Developers building intelligent chatbots with existing FAQ data.
- Organizations aiming for 24/7 customer service.
Requirements
- An n8n account (cloud or self-hosted)
- An OpenAI API key
- A Supabase account (for FAQ data)
- A PostgreSQL database (for conversation history)
- A LINE Official Account & Messaging API access token
Setup Steps
- Configure Credentials: Register credentials for OpenAI, Supabase, PostgreSQL, and LINE Messaging API in n8n.
- Prepare Databases: Create your tables in Supabase (for FAQs) and PostgreSQL (for conversation history).
- Customize the Prompt: In the "RAG AI Agent" node, edit the system prompt to fit your business and tone.
- Set Environment Variables: Update URLs, Channel IDs, and API endpoints in the nodes to match your environment.
Customization Options
- Change AI Model: Select a different model (e.g., gpt-4o) in the "OpenAI Chat Model" node.
- Add Data Sources: Add new "Tool" nodes (like an HTTP Request) to the "RAG AI Agent" to access other APIs (e.g., booking systems).
- Change Notifications: Replace the "LINE Works" nodes with a Slack or Email node to change the admin notification channel.