LINE Assistant with Google Calendar and Gmail Integration
Build a LINE chatbot in n8n that queries calendar, reads email, and replies with AI
- Who
- Small business owners, assistants, or project managers who manage scheduling and email via LINE
- You get
- Users send a LINE message and the AI automatically queries Google Calendar or Gmail and returns results
- You need
- n8n · openai · google-calendar · gmail · line · webhook
Constraints
Prerequisites: n8n instance, LINE Developer account with API Token, Google Calendar/Gmail OAuth2 credentials. Import the workflow JSON into n8n, configure the AI Agent node system prompt, set environment variables LINE_API_TOKEN and DYNAMIC_EMAIL, configure the Webhook URL in LINE Developer Console, then send a test message.
What they did
Author boriwatopal created an n8n workflow template: receive user messages via LINE Webhook, have an AI Agent (OpenAI GPT-4O-MINI) understand intent, call Google Calendar tools to query or create events and Gmail tools to read emails, format the answer through an OpenAI node, and reply to the user via a LINE HTTP Request node. The workflow includes an error-handling branch that returns a fixed prompt for non-text messages or when AI produces no output.
How it went
Published as a template on n8n.io with 2821 views at time of collection (author_report). No specific success rate or user feedback data is provided by the source.
Worth knowing
The AI Agent system prompt only includes the current date without specifying response language; the OpenAI formatting node's system prompt contains Thai, suggesting the original author targeted Thai speakers. The 'Line Answering (Error Case)' returns fixed Thai text and should be replaced with the target language in production. Google Calendar and Gmail nodes use $fromAI() for parameter extraction, which depends on model comprehension. workflow.json contains hardcoded example emails and token placeholders that must be replaced after import. This site has not tested the workflow.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- Google Calendar Create node: connect Google Calendar OAuth2 credentials.
- Google Calendar Read node: connect Google Calendar OAuth2 credentials.
- Gmail Read node: connect Gmail OAuth2 credentials.
Configuration to replace
- Source template is n8n public workflow #2671 (~14 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Prepare credentials and accounts
Configure two credential types in n8n: googleCalendarOAuth2Api (Google Calendar) and gmailOAuth2 (Gmail). Register a LINE Developer account, create a Messaging API Channel, and obtain the Channel Access Token and Webhook URL details.
Import workflow and configure core nodes
Import the source workflow.json into n8n. Verify the AI Agent node is connected to OpenAI Chat Model (gpt-4o-mini or gpt-4o), Window Buffer Memory, Wikipedia, Google Calendar Read/Create, and Gmail Read tool nodes. Confirm the 'Switch Between Text and Others' node routes text messages to the AI Agent.
Execution prompt · Source text。AI Agent node → Options → System Message field
=You are a helpful assistant. Here is the current date {{ $now }}Execution prompt · Source text。OpenAI node → Messages → System role Content field
Your task is to extract and condense the answer into an easily readable format. Don't provide a link or details such as "ดูเพิ่มเติม" or "ดูรายละเอียดได้ที่นี่."
Set environment variables
Enter LINE_API_TOKEN (LINE Channel Access Token) and DYNAMIC_EMAIL (default email for Gmail queries) in n8n environment variables or node parameters. For n8n Cloud, use Settings → Variables; for self-hosted, add to .env and restart.
Configure LINE Webhook
Activate the n8n workflow, copy the 'Line Receiving' Webhook node URL (path: linechatbotagent). Paste it into LINE Developer Console → Messaging API → Webhook URL, enable and verify. Ensure the URL is publicly accessible (n8n Cloud or reverse proxy).
Test and troubleshoot
Send a text message to the LINE Bot and observe execution logs: the message should pass through 'Switch' to AI Agent, which calls tools to query calendar/email, then passes through 'OpenAI' for formatting, 'Text Cleansing' for cleanup, and finally 'Line Answering (Ordinary Case)' for the reply. If AI produces no output, the 'Error Handling' branch returns a fixed Thai message via 'Line Answering (Error Case)'.
Prompt you can copy
Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are an n8n workflow setup assistant. The user wants to replicate a LINE chatbot integrating Google Calendar, Gmail, and OpenAI. First confirm they have: 1) an n8n instance; 2) a LINE Developer account and Channel Access Token; 3) Google OAuth2 credentials (Calendar + Gmail). Then guide them to import the workflow JSON, configure the AI Agent system prompt, set environment variables LINE_API_TOKEN and DYNAMIC_EMAIL, and configure the Webhook URL in LINE Developer Console. Finally suggest sending a test message.
Prepare LINE, Google, and OpenAI credentials before building
Source
LINE assistant with Google Calendar and Gmail integration · boriwatopal · n8n.io · 2024-12-23
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.