Skip to content

Instantly share code, notes, and snippets.

@miki2826
Created June 13, 2016 11:38
Show Gist options
  • Save miki2826/74c749f958bb4ae988e93f2c556abb65 to your computer and use it in GitHub Desktop.
Save miki2826/74c749f958bb4ae988e93f2c556abb65 to your computer and use it in GitHub Desktop.
example express server using botly
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