Last active
September 21, 2016 14:52
-
-
Save yurenju/37dcc7989b7d1a73fc00932ba6928ee0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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