Created
June 13, 2016 11:38
-
-
Save miki2826/74c749f958bb4ae988e93f2c556abb65 to your computer and use it in GitHub Desktop.
example express server using botly
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
const express = require("express"); | |
const Botly = require("botly"); | |
const botly = new Botly({ | |
accessToken: pageAccessToken, //page access token provided by facebook | |
verifyToken: verificationToken, //needed when using express - the verification token you provided when defining the webhook in facebook | |
webHookPath: yourWebHookPath, //defaults to "/", | |
notificationType: Botly.CONST.REGULAR //already the default (optional) | |
}); | |
botly.on("message", (senderId, message, data) => { | |
let text = `echo: ${data.text}`; | |
botly.sendText(senderId, text); | |
}); | |
const app = express(); | |
app.use("/webhook", botly.router()); | |
app.listen(3000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment