Skip to content

Instantly share code, notes, and snippets.

@yurenju
Last active September 21, 2016 14:52
Show Gist options
  • Save yurenju/37dcc7989b7d1a73fc00932ba6928ee0 to your computer and use it in GitHub Desktop.
Save yurenju/37dcc7989b7d1a73fc00932ba6928ee0 to your computer and use it in GitHub Desktop.
'use strict';
require('dotenv').config();
const fetch = require('node-fetch');
const LineBot = require('line-bot-sdk');
module.exports = {
receive(event, context, cb) {
const message = `postback ${event.body.result[0].content.text}`;
const userId = event.body.result[0].content.from;
const client = LineBot.client({
channelID: process.env.LINE_CHANNEL_ID,
channelSecret: process.env.LINE_CHANNEL_SECRET,
channelMID: process.env.LINE_MID
});
client.sendText(userId, message)
.then(res => cb(null, res))
.catch(err => cb(err));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment