Line Messaging API: Push Message & Reply
# Workflow Description This workflow demonstrates how to use the **LINE Messaging API** to handle two scenarios: 1. Replying to a user's message using a **reply token**. 2. Sending a **push message** to a specific LINE user using their **user ID**. --- ## Key Features 1. **Webhook Integration**: Receives and processes incoming messages from LINE using a webhook. 2. **Conditional Logic**: Checks if the received event type is a message and handles it accordingly. 3. **Reply Message**: Automatically responds to the user's message using the LINE reply token. 4. **Push Message**: Sends a test message to a specific LINE user using their unique user ID. --- ## Pre-Configuration To simplify the setup process, create a **Header Auth** credential in n8n: - **Name**: `Authorization` - **Value**: `Bearer {line token}` This will authenticate all API requests to the LINE Messaging API. --- ## Node Configurations ### 1.1. Webhook from LINE Message - **Purpose**: Captures incoming events from the LINE Messaging API. - **Configuration**: - **HTTP Method**: `POST` - **Path**: `{n8n-webhook-page}` --- ### 1.2. If Condition - **Purpose**: Checks if the received event type is `message`. - **Configuration**: - **Condition**: - `{{ $json.body.events[0].type }} equals message` --- ### 1.3. Line: Reply with Token - **Purpose**: Replies to the user's message using the LINE reply token. - **Configuration**: - **Method**: `POST` - **URL**: `https://api.line.me/v2/bot/message/reply` - **JSON Body**: ```json { "replyToken": {{ $(Webhook from Line Message).item.json.body.events[0].replyToken }}, "messages": [ { "type": "text", "text": "Received: {{ $(Webhook from Line Message).item.json.body.events[0].message.text }}" } ] } ``` --- ### 2.1. Manual Trigger: Test Workflow - **Purpose**: Triggers the workflow for testing the push message functionality. - **Configuration**: No additional setup required. --- ### 2.2. Edit Fields - **Purpose**: Prepares the unique LINE user ID for the push message. - **Configuration**: - **Field**: - `line_uid`: `Uxxxxxxxxxxxx` --- ### 2.3. Line: Push Message - **Purpose**: Sends a test message to a specific LINE user. - **Configuration**: - **Method**: `POST` - **URL**: `https://api.line.me/v2/bot/message/push` - **JSON Body**: ```json { "to": {{ $json.line_uid }}, "messages": [ { "type": "text", "text": "Hello!" } ] } ```
Workflow Description
This workflow demonstrates how to use the LINE Messaging API to handle two scenarios:
- Replying to a user's message using a reply token.
- Sending a push message to a specific LINE user using their user ID.
Key Features
- Webhook Integration: Receives and processes incoming messages from LINE using a webhook.
- Conditional Logic: Checks if the received event type is a message and handles it accordingly.
- Reply Message: Automatically responds to the user's message using the LINE reply token.
- Push Message: Sends a test message to a specific LINE user using their unique user ID.
Pre-Configuration
To simplify the setup process, create a Header Auth credential in n8n:
- Name:
Authorization - Value:
Bearer {line token}This will authenticate all API requests to the LINE Messaging API.
Node Configurations
1.1. Webhook from LINE Message
- Purpose: Captures incoming events from the LINE Messaging API.
- Configuration:
- HTTP Method:
POST - Path:
{n8n-webhook-page}
- HTTP Method:
1.2. If Condition
- Purpose: Checks if the received event type is
message. - Configuration:
- Condition:
{{ $json.body.events[0].type }} equals message
- Condition:
1.3. Line: Reply with Token
- Purpose: Replies to the user's message using the LINE reply token.
- Configuration:
- Method:
POST - URL:
https://api.line.me/v2/bot/message/reply - JSON Body:
{ "replyToken": {{ $(Webhook from Line Message).item.json.body.events[0].replyToken }}, "messages": [ { "type": "text", "text": "Received: {{ $(Webhook from Line Message).item.json.body.events[0].message.text }}" } ] }
- Method:
2.1. Manual Trigger: Test Workflow
- Purpose: Triggers the workflow for testing the push message functionality.
- Configuration: No additional setup required.
2.2. Edit Fields
- Purpose: Prepares the unique LINE user ID for the push message.
- Configuration:
- Field:
line_uid:Uxxxxxxxxxxxx
- Field:
2.3. Line: Push Message
- Purpose: Sends a test message to a specific LINE user.
- Configuration:
- Method:
POST - URL:
https://api.line.me/v2/bot/message/push - JSON Body:
{ "to": {{ $json.line_uid }}, "messages": [ { "type": "text", "text": "Hello!" } ] }
- Method:
New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.
Secure checkout powered by Stripe
Support
How to import this workflow into n8n
- 1Purchase or download the workflow to get the n8n workflow JSON file.
- 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
- 3Open each node marked with a credential warning and connect your own accounts and API keys.
- 4Run the workflow once manually to verify the data flow, then toggle it to Active.
Related Communication workflows
- Automate Outbound Calls with Ultravox AI and Twilio$4.99
- Automate Intelligent Email Classification with AI in Gmail$4.99
- Generate AI videos and carousels with Blotato for Instagram and TikTok$9.99
- Automating WhatsApp Replies Using GoHighLevel with Redis and Anthropic$24.99
- Automate Gmail Email Labeling with AI for Enhanced Organization$14.99
- Automate Email Summarization and Logging with AI and Google Sheets$9.99
More from darrell_tw
Need this deployed? We'll set it up for you.
Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.