LINE Chatbot Assistant with Google Calendar and Email Tools - n8n Workflow

Create a smart LINE chatbot assistant using n8n workflow templates. Integrate OpenAI tools for scheduling events in Google Calendar and reading Gmail directly via an intelligent n8n agent.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • LINE developers needing sophisticated backend logic for chatbots.

  • Users looking to automate personal assistant tasks (scheduling, email lookups) using a custom n8n workflow.

  • n8n users exploring advanced AI Agents, tools, and memory management within an n8n node setup.

Overview

This powerful n8n workflow demonstrates how to build a context-aware, multi-functional chatbot using the AI Agent framework within n8n. By leveraging several key n8n node types, the system processes incoming LINE messages, determines the user's intent (Q&A, scheduling, email check), and utilizes appropriate external services like Google Calendar, Gmail, and Wikipedia. This specific n8n workflow solution addresses the complexity of building conversational automation by providing session memory and conditional access to external APIs, transforming a simple chatbot into a valuable productivity tool. This flexible structure ensures that this n8n template can be customized for many business use cases.

How it Works


  1. The n8n trigger, Line Receiving (a Webhook), waits for incoming messages from the LINE platform, initiating the n8n workflow.

  2. The Switch Between Text and Others n8n node ensures that only standard text messages proceed to the AI logic; other message types are routed to an error response.

  3. The main intelligence is handled by the AI Agent n8n node, which uses the OpenAI Chat Model and Window Buffer Memory to maintain conversation context (session key is the LINE user ID).

  4. The Agent has access to multiple tools: Google Calendar Create, Google Calendar Read, Gmail Read, and Wikipedia. Based on the user's prompt, the AI determines which tool to use, making this a highly adaptive n8n workflow.

  5. The AI Agent output is fed into a final OpenAI n8n node, which refines and condenses the technical response into a clean, readable summary, suitable for direct chat response. The goal is to ensure the final output from the n8n workflow is polished.

  6. The Error Handling from AI Response switch checks the validity of the final AI text.

  7. The Text Cleansing n8n node performs necessary formatting, such as removing markdown and HTML tags from the response.

  8. Finally, the Line Answering (Ordinary Case) HTTP Request n8n node sends the processed, context-aware answer back to the LINE user via the reply token.

Installation Guide


  1. Import this n8n workflow JSON into your n8n instance.

  2. Configure the Line Receiving Webhook n8n trigger: Set the URL path (linechatbotagent) and save the resulting public webhook URL to your LINE Bot settings.

  3. Configure Credentials:

Set up credentials for the OpenAI integration (used by the OpenAI Chat Model and OpenAI refinement n8n nodes).
Configure OAuth2 credentials for Google Calendar (used by the Google Calendar Create and Google Calendar Read n8n nodes).
* Configure OAuth2 credentials for Gmail (used by the Gmail Read n8n node).

  1. Update LINE Authorization: In the Line Answering (Ordinary Case) and Line Answering (Error Case) HTTP Request n8n nodes, replace the placeholder Authorization Bearer token with your actual LINE Channel Access Token.

  2. Activate the n8n workflow to start processing messages.

Node Details

Line Receiving (Webhook n8n trigger): Function: Initiates the n8n workflow upon receiving a POST request from the LINE service. Key Configuration: Webhook path set to /linechatbotagent.
AI Agent (n8n node): Function: The core conversational engine. It processes user input using an LLM and decides which external tools to invoke. Key Configuration: Uses OpenAI Chat Model as the LLM and Window Buffer Memory for session tracking (based on the LINE user ID).
Window Buffer Memory (n8n node): Function: Stores recent conversation history, allowing the AI Agent to maintain context throughout the n8n workflow. Key Configuration: Session Key is dynamically set using the expression {{ $json.body.events[0].source.userId }}.
Google Calendar Create/Read (n8n node): Function: These are tools available to the Agent for scheduling new events or checking existing availability directly from the n8n workflow, using required credentials.
Gmail Read (n8n node): Function: A tool allowing the Agent to search and retrieve emails based on user queries, greatly extending the assistant's capabilities within this n8n template.
OpenAI (n8n node): Function: Used as a refinement step after the agent execution to condense and reformat the final AI output into a user-friendly chat message.
Text Cleansing (Set n8n node): Function: Cleans up the AI output by removing markdown, HTML tags, and newlines before the final message is sent to the user.
Line Answering (HTTP Request n8n node): Function: Sends the final text response back to the LINE user using the reply token received by the n8n trigger.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all
Created by

Automation consultant specializing in Data, AI, and Automation, founder of hundredtimesfaster.com and No Code AI community. Currently AI & Data Solutions Lead at Assetwise PCL, with a proven track record of driving innovation and efficiency in leading firms. Author of Practical Data Visualization & Analytics with Looker Studio. Book a consultation to explore custom solutions!

Featured*