line-bot-sdk-nodejs
SDK of the LINE BOT API for Node.js
Installation
The LINE BOT API SDK can be installed with NPM.
$ npm install line-bot-sdk
Usage
Require SDK
var LineBot = ;
Bot API Trial
var client = LineBot;
Business Connect
var client = LineBot;
Enable Debugging Mode
Use DEBUG
env var to enable debugging mode
Available values
- line-bot:log
- line-bot:error
$ DEBUG=line-bot:* node app.js
Sending Message
Note: mid can be either a string or an array of strings.
sendText(mid, text[, toType])
Send a text message to mid(s).
https://developers.line.me/bot-api/api-reference#sending_message_text
client;client;
sendImage(mid, imageURL, previewURL[, toType])
Send an image to mid(s).
https://developers.line.me/bot-api/api-reference#sending_message_image
client;
sendVideo(mid, videoURL, previewImageURL[, toType])
Send a video to mid(s).
https://developers.line.me/bot-api/api-reference#sending_message_video
client;
sendAudio(mid, audioURL, durationMillis[, toType])
Send a voice message to mid(s).
https://developers.line.me/bot-api/api-reference#sending_message_audio
client;
sendLocation(mid, text, latitude, longitude[, toType])
Send location information to mid(s).
https://developers.line.me/bot-api/api-reference#sending_message_location
client;
sendSticker(mid, stkid, stkpkgid, stkver[, toType])
Send a sticker to mid(s).
https://developers.line.me/bot-api/api-reference#sending_message_sticker
client;
sendRichMessage(mid, imageURL, altText, markup[, toType])
Send a rich message to mid(s).
https://developers.line.me/bot-api/api-reference#sending_rich_content_message_request
Note: Please see image url specifications
var Markup = LineBotMarkup;var markup = 1040; // height markup ; client;
sendMultipleMessages(mid, multipleMessages[, messageNotified])
Send multiple messages to mids(s).
https://developers.line.me/bot-api/api-reference#sending_multiple_messages_request
var MultipleMessages = LineBotMultipleMessages;var Markup = LineBotMarkup;var multipleMessages = ;var markup = 1040; // height // markup for rich messagemarkup ; multipleMessages ; client;
Getting User Profile Information
getUserProfile(mid)
Retrieve user profile(s) that is associated with mid(s).
https://developers.line.me/bot-api/api-reference#getting_user_profile_information_request
Note: mid can be either a string or an array of strings.
client ;
Other
validateSignature(rawJSON, signature)
Validate signature.
var isValid = client;
createReceivesFromJSON(json)
var receives = client;
Test
$ npm test
License
Copyright (c) 2016, Runnables Company Limited
Permission to use, copy, modify, and/or distribute this software for any purpose with
or without fee is hereby granted, provided that the above copyright notice and this
permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.