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
app.post('/webhook/', receiveMessage); | |
function receiveMessage(req, res, next){ | |
var message_instances = req.body.entry[0].messaging; | |
message_instances.forEach(function(instance){ | |
var sender = instance.sender.id; | |
if(instance.message && instance.message.text) { | |
fetchUserProfileAndReply(sender, conf.PROFILE_TOKEN); | |
} | |
}); |
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
{ | |
"7026": { | |
"operator": "IDEA", | |
"circle": "KARNATAKA" | |
}, | |
"7036": { | |
"operator": "IDEA", | |
"circle": "ANDHRA PRADESH" | |
}, | |
"7046": { |
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
function serialize(data) { | |
return Object.keys(data).map(function (keyName) { | |
return encodeURIComponent(keyName) + '=' + encodeURIComponent(data[keyName]) | |
}).join('&'); | |
} |
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
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; | |
var isFirefox = typeof InstallTrigger !== 'undefined'; | |
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0; | |
var isChrome = !!window.chrome && !this.isOpera; | |
var isIE = false || !!document.documentMode; |