Published 2 hours ago
This workflow demonstrates how to use the LINE Messaging API to handle two scenarios:
To simplify the setup process, create a Header Auth credential in n8n:
Authorization
Bearer {line token}
POST
{n8n-webhook-page}
message
.{{ $json.body.events[0].type }} equals "message"
POST
https://api.line.me/v2/bot/message/reply
{
"replyToken": "{{ $('Webhook from Line Message').item.json.body.events[0].replyToken }}",
"messages": [
{
"type": "text",
"text": "收到您的訊息 : {{ $('Webhook from Line Message').item.json.body.events[0].message.text }}"
}
]
}
line_uid
: Uxxxxxxxxxxxx
POST
https://api.line.me/v2/bot/message/push
{
"to": "{{ $json.line_uid }}",
"messages": [
{
"type": "text",
"text": "推播測試"
}
]
}
此工作流程展示如何使用 LINE Messaging API 處理兩種情境:
為簡化設定流程,請在 n8n 中建立 Header Auth 憑證:
Authorization
Bearer {line token}
POST
{n8n-webhook-page}
message
。{{ $json.body.events[0].type }} 等於 "message"
POST
https://api.line.me/v2/bot/message/reply
{
"replyToken": "{{ $('Webhook from Line Message').item.json.body.events[0].replyToken }}",
"messages": [
{
"type": "text",
"text": "收到您的訊息 : {{ $('Webhook from Line Message').item.json.body.events[0].message.text }}"
}
]
}
line_uid
:Uxxxxxxxxxxxx
POST
https://api.line.me/v2/bot/message/push
{
"to": "{{ $json.line_uid }}",
"messages": [
{
"type": "text",
"text": "推播測試"
}
]
}
完成示意圖 (Storyboard Example):
Implement complex processes faster with n8n