1.0.17 • Published 7 years ago

line-msg-api v1.0.17

Weekly downloads
19
License
MIT
Repository
github
Last release
7 years ago

line-msg-api

Node.js package for LINE Messaging API. this code is based on LINE API https://devdocs.line.me

#How to install this

npm install line-msg-api

#How to use this

please get accessToken, channelSecret from https://business.line.me/services/bot if you don't have the digital certificates, you can get a free digital certificates from https://letsencrypt.org

The following code is a part of echoback_test.js, please see it if you want to know more functions.

var LineMsgApi = require('line-msg-api');
var bot = new LineMsgApi({
    accessToken: 'Put here your access token',
    channelSecret: 'Put here your channel secret',

    server: {
        port: 3000,
        key: 'Put here the file name of encript.key',
        cert: 'Put here the file name of encript_fullchain.crt'
    }
});
 
// Geting a message
bot.on(function (msg) {

    if (msg.events[0].message.type == 'text') {
	console.log("Message ----");
	console.log( msg.events[0].message.text);
	replyMessage = msg.events[0].message.text;

	// Replying a message
	bot.replyMessage(msg.events[0].replyToken, replyMessage);

	// Getting the user profile of the message sender
	bot.getProfile(msg.events[0].source.userId ,function(err,profile) {
	    console.log("profile= ", profile);
	    
	    if ( replyMessage == 'Push') {
		// Pushing a message
		bot.pushMessage(profile.userId, "Hello Tokyo");
	    }
	});
    }
});
1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago