English | 日本語
A library for easily sending push notifications to LINE Bot
npm install linebot-notifyCreate an instance by passing the LINE Bot channel access token as an argument.
Then simply execute the push method with any message as an argument.
Returns the remaining number of available pushes as the return value.
import{LineBotNotify}from"linebot-notify"constmain=async()=>{constnotify=newLineBotNotify({ channelAccessToken })constremainingQuota=awaitnotify.push("LINE Bot Notify!")console.log(remainingQuota)}main()Specify either a channel access token or a pair of channel ID and channel secret.
// Specify channel access tokenconstnotify=newLineBotNotify({ channelAccessToken })// Specify channel ID and channel secretconstnotify=newLineBotNotify({ channelId, channelSecret })Optional parameters can be specified in addition to the message.
| Parameter | Required | Type | Default | Description |
|---|---|---|---|---|
| message | ✔ | string | - | Specifies the message to send. |
| to | string | string[] | undefined | Specifies the recipient(s). For single recipient, specify a user ID or group ID. For multiple recipients, specify an array of user IDs. | |
| notificationDisabled | boolean | false | When set to true, notifications will not be sent when sending messages. |
// Send a message (broadcast)awaitnotify.push("LINE Bot Notify!")// Send a message to a specific user or groupawaitnotify.push("LINE Bot Notify!",{to: "<User ID or Group ID>"})// Send a message to multiple users (multicast)awaitnotify.push("LINE Bot Notify!",{to: ["<User ID>","<User ID>"]})// Send a message without notificationsawaitnotify.push("LINE Bot Notify!",{notificationDisabled: true})