Skip to content

Instantly share code, notes, and snippets.

@pmutua
Created March 23, 2017 13:21
Show Gist options
  • Save pmutua/c4fbb500f4075452b09e4004301b5c9d to your computer and use it in GitHub Desktop.
Save pmutua/c4fbb500f4075452b09e4004301b5c9d to your computer and use it in GitHub Desktop.
bot
'use strict'
const express = require('express')
const bodyParser =require('request')
const app =express()
app.set('port',(process.env.PORT || 5000))
// Allows us to process the data
app.use(bodyParser.urlencoded({extend:false}))
app.use(bodyParser.json())
// ROUTES
app.get('/',fuction(req, res){
res.send("Hi iam a chatbot")
})
//Facebook
app.get('/webhook/', function(req,res){
if (req.query['hub.verify_token']==="blondiebytes"){
res.send(req.query['hub.challenge'])
}
res.send("Wrong token")
})
//start serer listen request
app.listen(app.get('port') function(){
console.log("running: port")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment