Skip to content
This repository has been archived by the owner on Dec 28, 2019. It is now read-only.

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Examples

Echo

const LineBot = require('@3846masa/linebot/lib/LineBot').LineBot;

const bot = new LineBot({
  channelSecret: 'XXXXXXXXXX',
  channelToken: 'XXXXXXXXXX',
});

bot.on('webhook:*', (ev) => {
  console.log('You got a event!', ev);
});

bot.on('webhook:message', (ev) => {
  const message = ev.message;
  ev.reply(message);
});

bot.listen(process.env.PORT || 3000);

Push message

Simple

const LineBot = require('@3846masa/linebot/lib/LineBot').LineBot;
const TextMessage = require('@3846masa/linebot/lib/LineMessages').TextMessage;

const bot = new LineBot({
  channelSecret: 'XXXXXXXXXX',
  channelToken: 'XXXXXXXXXX',
});

const message = new TextMessage({
  text: 'Hello World',
});

bot.push('USER_ID', message);