Noodles Practicing Medicine
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

line-bot-sdk-node

1.0.0 • Public • Published

LINE bot SDK

SDK of the LINE Messaging API for Node.js.

This is not official one.

CircleCI codecov

About the LINE Messaging API

See the official API reference documentation for more information.

https://devdocs.line.me/

Usage

Push

const SDK = require('line-bot-sdk');
const Client = SDK.Client;
 
const to = someSourceID;
const messages = [
  new SDK.TextMessage('Push message using line-bot-sdk.')
];
 
const client = new Client(process.env.LINE_ACCESS_TOKEN);
client.push(to, messages).then(res => {
  // Something as callback
});

Reply

const SDK = require('line-bot-sdk');
const EventsParser = SDK.EventsParser;
const Client = SDK.Client;
 
const client = new Client(process.env.LINE_ACCESS_TOKEN);
const events = EventsParser.parse(req.body.events);
 
events.forEach(event => {
  const messages = [
    new SDK.TextMessage('Reply message using line-bot-sdk.')
  ];
 
  client.reply(event.replyToken, messages);
});

How to run test

  1. eslint ./ for lint
  2. istanbul cover _mocha to run test and measure code coverage

Keywords

none

install

npm i line-bot-sdk-node

Downloadsweekly downloads

0

version

1.0.0

license

MIT

last publish

collaborators

  • avatar
Report a vulnerability