Skip to content

Instantly share code, notes, and snippets.

View miki2826's full-sized avatar

Michael Dimenshtein miki2826

View GitHub Profile
@miki2826
miki2826 / botly_example.js
Created June 13, 2016 11:38
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) => {
passport.use(new FacebookStrategy({
clientID: FACEBOOK_APP_ID,
clientSecret: FACEBOOK_APP_SECRET,
callbackURL: "http://localhost:3000/auth/facebook/callback"
},
function(accessToken, refreshToken, profile, cb) {
User.findOrCreate({ facebookId: profile.id }, function (err, user) {
return cb(err, user);
});
}
@miki2826
miki2826 / loader.js
Last active January 18, 2017 14:31
Node command line infinite loader
'use strict';
const readline = require('readline');
const DELAY = 100;
function startLoader() {
readline.cursorTo(process.stdout, 0);
process.stdout.write('/');
setTimeout(loaderStage1, DELAY);
}
"payload": {
"template_type":"generic",
"elements":[
{
"title":"<TITLE_TEXT>",
"image_url":"<IMAGE_URL_TO_DISPLAY>",
"subtitle":"<SUBTITLE_TEXT>",
"default_action": {
"type": "web_url",
"url": "<DEFAULT_URL_TO_OPEN>",
{
"type": "vertical",
"elements": [
{
"type": "image",
"url": "https://cdn.bgr.com/2016/08/iphone-8-concept.jpg?quality=98&strip=all",
"tooltip": "image tooltip"
},
{
"type": "text",