Created
March 23, 2017 13:21
-
-
Save pmutua/c4fbb500f4075452b09e4004301b5c9d to your computer and use it in GitHub Desktop.
bot
This file contains 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' | |
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") | |
}) | |
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