Skip to content

LINE Message API Push Message Node

Jatuphum Tungsilsukchai edited this page Apr 19, 2022 · 7 revisions

push-node

NODE-RED node for pushing message to LINE Messaging API channel. You can use LINE Messaging API, push message, through this Node.

Usage

  1. Create LINE Messaging API Channel in LINE Developer console. Use this official document Getting started with the Messaging API to create your own LINE Messaging API.

  2. Obtain a Channel Access Token and Channel Secret from your created LINE Messaging API Channel (Actually, LINE Message API Push Message Node use only Channel Access Token, but LINE Messaging API Configuration Node requires both Channel Access Token and Channel Secret for configuration).

  3. Add Messaging API Channel to LINE application.

  4. Find User IDs or Group IDs for push message. Go to How to find User Id, Group Id or replyToken for testing Messaging API for easy finding.

  5. Add LINE Message API Push Message Node in Node-RED workspace.

  6. Configure LINE Messaging API Channel Access Token and Channel Secret in Push Message Node. See using LINE Messaging API Configuration Node

push-config

  1. Setup Node values

push-destination

  • Use/Don't use ID data from wired node. If use ID from wired node, it does not use ID from Node Input.

  • Desitnation ID. Specified destination ID for push message.

push-message-notifacation

  • Use/Don't use Message data from wired node. If use message data from wired node, it does not use message type and message content from Node Input.
  • Message Type, Normal Text (string) or Custom Message Format (JSON)
  • Message, message for push.
  • Disabled Push Notification, the user does/doesn't receive push notification when the message is sent.
  1. Run workflow

  2. Check result.

API Input

When setup node values to 'Use ID data from wired node', it uses msg object instead node input.

Property Mandatory Type Description
destinationId No (Yes, if select 'Use ID data from wired node') string Specified destination ID for push message to

When setup node values to 'Use message data from wired node', it uses msg object instead node input.

Property Mandatory Type Description
messageType No (Yes, if select 'Use Message data from wired node') int 0 : for normal text message for push message.
1 : for custom message format for push message.
payload No (Yes, if select 'Use Message data from wired node') string
or
JSON
string : for normal text message
JSON : for custom message format
Payload push message is validated at runtime.

API Output

Result from push message by using msg object.

Property Type Description
status number Result status code
payload string Result status message
  • Output success case

status = 0 payload = Push message success: {"x-line-request-id":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"}

Remark : {"x-line-request-id":"xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx"} is result from LINE Messaging API response.

  • Output Fail case

status = <Error Number> payload = <Error message>

Examples

After install package, see usage examples at Node-RED Import menu at node-red-contrib-node-line-api, then line-push-message-examples.

More details