Line Message API Auto-Responder and Push Notifications - n8n Workflow

Use this robust n8n workflow to implement instant auto-replies to Line messages using reply tokens and manage proactive push notification broadcasts. Learn how to use the HTTP Request n8n node for custom API integration.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Technical users and developers needing rapid integration with the Line Messaging API.

  • Businesses seeking to automate customer service responses on the Line platform.

  • Individuals looking for advanced n8n templates demonstrating custom API calls and webhooks.

  • n8n automation specialists interested in flow control using the If n8n node.

Overview

This comprehensive n8n workflow provides a dual-purpose automation system for the Line Messaging API. It solves two common needs: immediate customer interaction and proactive broadcasting. The primary flow uses an n8n trigger webhook to instantly capture messages sent by users on Line. It intelligently filters these events using an If n8n node, ensuring only legitimate user messages receive an automated response via a time-sensitive reply token. The secondary, manually triggered path demonstrates how to send push messages to specific Line User IDs, a crucial component for marketing or notification services. This n8n template showcases effective use of custom HTTP Request n8n node configurations for complex API interactions, making it an excellent learning resource for anyone building custom integrations within n8n.

How it Works

This n8n workflow operates via two distinct paths:

1. Auto-Reply Flow (Triggered by Line User)


  1. Webhook Trigger: The flow starts with the Webhook from Line Message n8n trigger, which is configured to listen for incoming POST requests from the Line API whenever an event occurs (like a user sending a message).

  2. Event Filtering: The If n8n node immediately follows, checking if the received event type is explicitly a message. This ensures the n8n workflow only processes actual messages and ignores events like user joins or reads, optimizing efficiency.

  3. Auto-Reply Action: If the condition is met, the flow proceeds to the Line : Reply with token n8n node (an HTTP Request node). This n8n node dynamically extracts the replyToken and the received text from the webhook payload. It constructs a JSON body and posts it to the Line reply endpoint, instantly echoing the user's message back to them.

2. Push Notification Flow (Manual Test)


  1. Manual Start: This path is initiated by the When clicking ‘Test workflow’ n8n trigger, allowing users to test push functionality without waiting for an incoming message.

  2. Set User ID: The Edit Fields n8n node (Set node) is used to define a specific placeholder lineuid (User ID).

  3. Push Message Action: The flow concludes with the Line : Push Message n8n node (an HTTP Request node). This n8n node uses the specified lineuid and sends a predefined text message (in this case, '推播測試') to the user, demonstrating the proactive push capability of the n8n workflow.

Installation Guide

To deploy this powerful n8n workflow, follow these steps:


  1. Import: Copy the provided JSON data and paste it directly into your n8n instance to create a new n8n workflow.

  2. Credentials Setup: This n8n workflow relies on a shared credential named Line n8n demo auth (HTTP Header Auth type).

Go to Credentials in n8n.
Create a new 'HTTP Header Auth' credential.
Set the Header Name to Authorization.
Set the Header Value to Bearer LINECHANNELACCESSTOKEN>.

  1. Webhook Configuration: Copy the Webhook URL generated by the Webhook from Line Message n8n trigger node and configure it as the webhook endpoint within your Line Developer Channel settings.

  2. Testing Push: Update the placeholder line_uid in the Edit Fields n8n node with a valid Line User ID before manually testing the push message path.

Node Details

Webhook from Line Message (n8n trigger):
Function: Serves as the primary entry point, listening for all events from the configured Line channel.
Key Configuration: Configured for a POST method on a unique webhook path.
If (n8n node):
Function: Filters the incoming webhook payload, ensuring the n8n workflow only proceeds if the event type is exactly message.
Key Configuration: Condition checks ={{ $json.body.events[0].type }} equals message.
Line : Reply with token (n8n node - HTTP Request):
Function: Uses the Line Messaging API reply endpoint to send an immediate response. It is crucial for replying within the required time window.
Key Configuration: URL is https://api.line.me/v2/bot/message/reply. Body dynamically uses {{ $('Webhook from Line Message').item.json.body.events[0].replyToken }} and the received message text.
When clicking ‘Test workflow’ (n8n trigger):
Function: Initiates the push notification demonstration path manually for testing purposes.
Edit Fields (n8n node - Set):
Function: Creates the required lineuid variable for the push message API call.
Key Configuration: Sets the value of line
uid (requires updating with a real user ID).
Line : Push Message (n8n node - HTTP Request):
Function: Uses the Line Messaging API push endpoint to send a message proactively to a specific user, independent of an incoming webhook.
* Key Configuration: URL is https://api.line.me/v2/bot/message/push. Body uses the stored {{ $json.line_uid }} for targeting.

Related n8n Workflows

Free

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

Martech Engineer with automation. here is my website: https://www.darrelltw.com/

Featured*