Back to Templates

Automate LINE Customer Support with RAG-Powered AI & Supabase FAQ Database

Created by

Created by: Masaki Go || pippi

Masaki Go

Last update

Last update 9 hours ago

Share


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

  1. Receive Questions: An n8n webhook receives messages from your LINE Official Account.
  2. 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.
  3. AI Generation: The OpenAI GPT model generates a context-aware answer based on the retrieved information and conversation history.
  4. Reply: The response is sent back to the user via the LINE Messaging API.
  5. 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

  1. Configure Credentials: Register credentials for OpenAI, Supabase, PostgreSQL, and LINE Messaging API in n8n.
  2. Prepare Databases: Create your tables in Supabase (for FAQs) and PostgreSQL (for conversation history).
  3. Customize the Prompt: In the "RAG AI Agent" node, edit the system prompt to fit your business and tone.
  4. 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.