Node.js FB Messenger机器人程序:消息传递\u events.length-->;无法读取属性长度
您好,我的机器人有一个问题,即我的webhook没有及时响应facebook-我从开发者页面收到以下消息: 您对回调URL的Webhooks订阅至少有10分钟未接受更新。请验证您的回调服务器是否正常工作。请访问我们的参考文档,了解如何更新回调URL 如果您的回调URL在50分钟后仍然失败,您的订阅将被禁用。要重新激活,只需使用相同的参数发出POST请求,或访问应用程序仪表板中的Webhooks选项卡 因此,bot已被禁用。我的机器人托管在heroku上,当我转到webhook页面时,我得到以下结果: [禁止]() 然而,作为页面和bot应用程序的管理员,我仍然能够看到并测试bot的功能,即使是在开发者模式下。我已经验证了bot通过messenger返回正确的响应,但是webhook url仍然失败。有人能帮我吗?我的代码和日志将在下面找到 代码:Node.js FB Messenger机器人程序:消息传递\u events.length-->;无法读取属性长度,node.js,heroku,facebook-messenger-bot,Node.js,Heroku,Facebook Messenger Bot,您好,我的机器人有一个问题,即我的webhook没有及时响应facebook-我从开发者页面收到以下消息: 您对回调URL的Webhooks订阅至少有10分钟未接受更新。请验证您的回调服务器是否正常工作。请访问我们的参考文档,了解如何更新回调URL 如果您的回调URL在50分钟后仍然失败,您的订阅将被禁用。要重新激活,只需使用相同的参数发出POST请求,或访问应用程序仪表板中的Webhooks选项卡 因此,bot已被禁用。我的机器人托管在heroku上,当我转到webhook页面时,我得到以下结
var express=require(“express”);
var请求=要求(“请求”);
var rp=要求(“要求承诺”);
var bodyParser=require(“主体解析器”);
var stringsearch=require(“字符串搜索”);
var async=require(“异步”);
var crypto=require('crypto');
var-app=express();
//use(bodyParser.json());
use(bodyParser.json());
use(bodyParser.urlencoded({extended:false}));
app.listen((process.env.PORT | | 5000));
const Rules=require('./script.json');
//可以从应用程序仪表板检索应用程序机密
const APP_SECRET=process.env.APP_SECRET;
//用于验证webhook的任意值
const-VERIFICATION_-TOKEN=process.env.VERIFICATION;
//从应用程序仪表板为页面生成页面访问令牌
const PAGE_ACCESS_TOKEN=process.env.PAGE_ACCESS_TOKEN;
//服务器索引页
应用程序获取(“/”,函数(请求,恢复){
res.send(“已部署!”);
});
//Facebook网络钩子
//用于验证
app.get(“/webhook/”,函数(req,res){
if(请求查询[“集线器验证令牌”]==应用程序密钥){
log(“已验证的webhook”);
res.status(200).send(请求查询[“hub.challenge”]);
}否则{
错误(“验证失败。令牌不匹配”);
res.sendStatus(403);
}
});
app.post('/webhook/',函数(req,res){
//var rn=Math.floor((Math.random()*1000)+1);
//var rn_string=rn.toString();
//log(“@APP POST,生成的随机数:”+rn_字符串);
console.log(“@apppost”);
var数据=请求主体;
如果(data.object=='page'){
//迭代每个条目-如果批处理,则可能有多个条目
data.entry.forEach(函数(条目){
//获取webhook event.entry.messaging是一个数组,但是
//将只包含一个事件,因此我们得到索引0
让webhook_event=entry.messaging[0];
log(“收到WEBHOOK”);
console.log(webhook_事件);
let sender=webhook\u event.sender.id
if(webhook_事件回发){
让有效负载=webhook_event.postback.payload
log(“检测到回发!”);
控制台日志(“有效载荷:+有效载荷);
如果(有效载荷=“问候语”){
processPostback2(webhook_事件);
}否则{
processPostback(webhook_事件“”);
}
}
否则{
console.log(“不是回发”);
}
});
//对所有事件返回“200 OK”响应
res.status(200).发送('EVENT_RECEIVED');
}否则{
//如果事件不是来自页面订阅,则返回“404未找到”
res.sendStatus(404);
}
});
函数getUserProfile(事件){
console.log(“@USERPROFILE”);
var senderId=event.sender.id;
var first_name='首字母';
const user_profile_options={
网址:'https://graph.facebook.com/v2.6/“+senderId+”?字段=名字、姓氏、配置文件图片和访问令牌=“+PAGE访问令牌,
方法:“GET”,
json:true
};
返回rp(用户配置文件选项);
}
函数processPostback2(事件){
console.log(“@PROCESSPOSTBACK2”);
getUserProfile(事件)。然后(响应=>{
日志(“响应的数据类型:+typeof(响应));
log(“响应内容:+JSON.stringify(响应));
var first\u name=response.first\u name;
processPostback(事件,名字);
决议(1);
}).catch(错误=>{
//你有一些错误
});
}
函数sendTextMessage(发送者,文本){
让messageData={text:text}
请求({
网址:'https://graph.facebook.com/v2.6/me/messages',
qs:{access_token:PAGE_access_token},
方法:“POST”,
json:{
收件人:{id:sender},
message:messageData,
}
},函数(错误、响应、正文){
如果(错误){
console.log('发送消息时出错:',错误)
}else if(response.body.error){
console.log('Error:',response.body.Error)
}
})
}
函数processPostback(事件,名字){
console.log(“@PROCESSPOSTBACK”);
//first_name=userProfile(事件);
log(“使用此名字输入进程回发进程:“+first_name”);
var senderId=event.sender.id;
var有效负载=event.postback.payload;
if(Rules.hasOwnProperty(payload.toUpperCase())){
sendSingleJsonMessage(senderId,规则[payload.toUpperCase()],名字);
}
}
//向用户发送消息
函数sendMessage(recipientId,message){
请求({
url:“https://graph.facebook.com/v2.6/167446456648112/messages",
qs:{access_token:PAGE_access_token},
var express = require("express");
var request = require("request");
var rp = require("request-promise");
var bodyParser = require("body-parser");
var stringSearcher = require("string-search");
var async = require("async");
var crypto = require('crypto');
var app = express();
//app.use(bodyParser.json());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: false}));
app.listen((process.env.PORT || 5000));
const Rules = require('./script.json');
// App Secret can be retrieved from the App Dashboard
const APP_SECRET = process.env.APP_SECRET ;
// Arbitrary value used to validate a webhook
const VERIFICATION_TOKEN = process.env.VERIFICATION;
// Generate a page access token for your page from the App Dashboard
const PAGE_ACCESS_TOKEN = process.env.PAGE_ACCESS_TOKEN;
// Server index page
app.get("/", function (req, res) {
res.send("Deployed!");
});
// Facebook Webhook
// Used for verification
app.get("/webhook/", function (req, res) {
if (req.query["hub.verify_token"] === APP_SECRET) {
console.log("Verified webhook");
res.status(200).send(req.query["hub.challenge"]);
} else {
console.error("Verification failed. The tokens do not match.");
res.sendStatus(403);
}
});
app.post('/webhook/', function (req, res) {
//var rn = Math.floor((Math.random() * 1000) + 1);
//var rn_string = rn.toString();
//console.log("@APP POST, GENERATED RANDOM NUMBER: "+rn_string);
console.log("@APP POST");
var data = req.body;
if (data.object === 'page') {
// Iterate over each entry - there may be multiple if batcheds
data.entry.forEach(function(entry) {
// Get the webhook event. entry.messaging is an array, but
// will only ever contain one event, so we get index 0
let webhook_event = entry.messaging[0];
console.log("WEBHOOK RECEIVED");
console.log(webhook_event);
let sender = webhook_event.sender.id
if(webhook_event.postback){
let payload = webhook_event.postback.payload
console.log("POSTBACK DETECTED!");
console.log("PAYLOAD: "+payload);
if(payload == "Greeting") {
processPostback2(webhook_event);
} else {
processPostback(webhook_event, '');
}
}
else {
console.log("NOT A POSTBACK");
}
});
// Return a '200 OK' response to all events
res.status(200).send('EVENT_RECEIVED');
} else {
// Return a '404 Not Found' if event is not from a page subscription
res.sendStatus(404);
}
});
function getUserProfile(event) {
console.log("@USERPROFILE");
var senderId = event.sender.id;
var first_name = 'INITIAL';
const user_profile_options = {
url: 'https://graph.facebook.com/v2.6/'+senderId+'?fields=first_name,last_name,profile_pic&access_token='+PAGE_ACCESS_TOKEN,
method: 'GET',
json: true
};
return rp(user_profile_options);
}
function processPostback2(event) {
console.log("@PROCESSPOSTBACK2");
getUserProfile(event).then(response => {
console.log("DATA TYPE OF RESPONSE: "+typeof(response));
console.log("CONTENT OF RESPONSE: "+JSON.stringify(response));
var first_name = response.first_name;
processPostback(event, first_name);
resolve(1);
}).catch(err => {
// you have some error
});
}
function sendTextMessage(sender, text) {
let messageData = { text:text }
request({
url: 'https://graph.facebook.com/v2.6/me/messages',
qs: {access_token: PAGE_ACCESS_TOKEN},
method: 'POST',
json: {
recipient: {id:sender},
message: messageData,
}
}, function(error, response, body) {
if (error) {
console.log('Error sending messages: ', error)
} else if (response.body.error) {
console.log('Error: ', response.body.error)
}
})
}
function processPostback(event, first_name) {
console.log("@PROCESSPOSTBACK");
//first_name = userProfile(event);
console.log("ENTERED PROCESS POSTBACK PROCESS WITH THIS FIRSTNAME: "+first_name);
var senderId = event.sender.id;
var payload = event.postback.payload;
if (Rules.hasOwnProperty(payload.toUpperCase())) {
sendSingleJsonMessage(senderId,Rules[payload.toUpperCase()], first_name);
}
}
// sends message to user
function sendMessage(recipientId, message) {
request({
url: "https://graph.facebook.com/v2.6/167446456648112/messages",
qs: {access_token: PAGE_ACCESS_TOKEN},
method: "POST",
json: {
recipient: {id: recipientId},
message: message,
}
}, function(error, response, body) {
if (error) {
console.log("Error sending message: " + response.error);
}
});
}
//send single JSON message
function sendSingleJsonMessage(recipientId,filename, first_name) {
console.log("@SENDSINGLEJSONMESSAGE");
try {
filename = "./script/" + filename;
var json = require(filename);
var fullMessage = { recipient: { id: recipientId }};
var body = JSON.stringify(json);
console.log("ORIGINAL BODY: "+body);
console.log("SEND SINGLE JSON MESSAGE "+first_name);
const promise = stringSearcher.find(body, '<first_name>')
.then(function(resultArr) {
console.log("replace first_name with "+first_name);
if (body.search("<first_name>") != -1) {
console.log("FOUND");
body = body.replace("<first_name>", first_name);
} else {
console.log("NOT FOUND");
}
console.log("NEW BODY: "+body);
});
const promise2 = promise.then (function (result){
fullMessage.message = JSON.parse(body);
console.log(JSON.stringify(fullMessage));
});
const promise3 = promise2.then(function (result2){
sendFullAPI(fullMessage);
});
}
catch (e)
{
message = "catch section ";
sendMessage(recipientId, {text: message});
console.log("error in sendSingleJsonMessage " + e.message + " " + filename + " " + fullMessage);
}
}
// sends card to user
function sendFullAPI(message) {
console.log("@SENDFULLAPI");
console.log(JSON.stringify(message));
request({
url: "https://graph.facebook.com/v2.6/me/messages",
qs: {access_token: PAGE_ACCESS_TOKEN},
method: "POST",
json: message,
}, function(error, response, body) {
if (error) {
console.log("Error sending message: " + response.error);
}
});
}
2018-08-08T08:29:29.027786+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=32f7c71f-309b-4816-ae27-bd2199966acd fwd="69.171.240.83" dyno=web.1 connect=0ms service=3ms status=200 bytes=213 protocol=https
2018-08-08T08:29:29.025741+00:00 app[web.1]: @APP POST
2018-08-08T08:29:29.025778+00:00 app[web.1]: WEBHOOK RECEIVED
2018-08-08T08:29:29.025912+00:00 app[web.1]: { recipient: { id: '167446456648112' },
2018-08-08T08:29:29.025914+00:00 app[web.1]: timestamp: 1533716968745,
2018-08-08T08:29:29.025915+00:00 app[web.1]: sender: { id: '2434229289927905' },
2018-08-08T08:29:29.025917+00:00 app[web.1]: postback: { payload: 'Greeting', title: 'Get Started' } }
2018-08-08T08:29:29.025958+00:00 app[web.1]: POSTBACK DETECTED!
2018-08-08T08:29:29.026014+00:00 app[web.1]: PAYLOAD: Greeting
2018-08-08T08:29:29.026075+00:00 app[web.1]: @PROCESSPOSTBACK2
2018-08-08T08:29:29.026128+00:00 app[web.1]: @USERPROFILE
2018-08-08T08:29:29.103406+00:00 app[web.1]: DATA TYPE OF RESPONSE: object
2018-08-08T08:29:29.103476+00:00 app[web.1]: CONTENT OF RESPONSE: {"first_name":"Aldon","last_name":"Galido","profile_pic":"https://platform-lookaside.fbsbx.com/platform/profilepic/?psid=2434229289927905&width=1024&ext=1536308969&hash=AeQ_wx1iW_uBVIx6","id":"2434229289927905"}
2018-08-08T08:29:29.103529+00:00 app[web.1]: @PROCESSPOSTBACK
2018-08-08T08:29:29.103580+00:00 app[web.1]: ENTERED PROCESS POSTBACK PROCESS WITH THIS FIRSTNAME: Aldon
2018-08-08T08:29:29.103650+00:00 app[web.1]: @SENDSINGLEJSONMESSAGE
2018-08-08T08:29:29.103771+00:00 app[web.1]: ORIGINAL BODY: {"attachment":{"type":"template","payload":{"template_type":"button","text":"Hello <first_name>!\n\nHow can we help you?","buttons":[{"type":"postback","title":"General Inquiry","payload":"GENERAL INQUIRY"},{"type":"postback","title":"Custom Message","payload":"CUSTOM MESSAGE"}]}}}
2018-08-08T08:29:29.103823+00:00 app[web.1]: SEND SINGLE JSON MESSAGE Aldon
2018-08-08T08:29:29.104435+00:00 app[web.1]: replace first_name with Aldon
2018-08-08T08:29:29.104498+00:00 app[web.1]: FOUND
2018-08-08T08:29:29.104566+00:00 app[web.1]: NEW BODY: {"attachment":{"type":"template","payload":{"template_type":"button","text":"Hello Aldon!\n\nHow can we help you?","buttons":[{"type":"postback","title":"General Inquiry","payload":"GENERAL INQUIRY"},{"type":"postback","title":"Custom Message","payload":"CUSTOM MESSAGE"}]}}}
2018-08-08T08:29:29.104676+00:00 app[web.1]: {"recipient":{"id":"2434229289927905"},"message":{"attachment":{"type":"template","payload":{"template_type":"button","text":"Hello Aldon!\n\nHow can we help you?","buttons":[{"type":"postback","title":"General Inquiry","payload":"GENERAL INQUIRY"},{"type":"postback","title":"Custom Message","payload":"CUSTOM MESSAGE"}]}}}}
2018-08-08T08:29:29.104738+00:00 app[web.1]: @SENDFULLAPI
2018-08-08T08:29:29.104803+00:00 app[web.1]: {"recipient":{"id":"2434229289927905"},"message":{"attachment":{"type":"template","payload":{"template_type":"button","text":"Hello Aldon!\n\nHow can we help you?","buttons":[{"type":"postback","title":"General Inquiry","payload":"GENERAL INQUIRY"},{"type":"postback","title":"Custom Message","payload":"CUSTOM MESSAGE"}]}}}}
2018-08-08T08:29:29.264501+00:00 app[web.1]: @APP POST
2018-08-08T08:29:29.265125+00:00 app[web.1]: TypeError: Cannot read property '0' of undefined
2018-08-08T08:29:29.265128+00:00 app[web.1]: at /app/index.js:60:39
2018-08-08T08:29:29.265130+00:00 app[web.1]: at Array.forEach (<anonymous>)
2018-08-08T08:29:29.265132+00:00 app[web.1]: at /app/index.js:56:14
2018-08-08T08:29:29.265136+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.265139+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2018-08-08T08:29:29.265141+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2018-08-08T08:29:29.265143+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.265145+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22
2018-08-08T08:29:29.265146+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2018-08-08T08:29:29.265148+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2018-08-08T08:29:29.265149+00:00 app[web.1]: at urlencodedParser (/app/node_modules/body-parser/lib/types/urlencoded.js:82:7)
2018-08-08T08:29:29.265151+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.265152+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2018-08-08T08:29:29.265154+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2018-08-08T08:29:29.265156+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2018-08-08T08:29:29.265157+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2018-08-08T08:29:29.265159+00:00 app[web.1]: at /app/node_modules/body-parser/lib/read.js:130:5
2018-08-08T08:29:29.265160+00:00 app[web.1]: at invokeCallback (/app/node_modules/raw-body/index.js:224:16)
2018-08-08T08:29:29.265162+00:00 app[web.1]: at done (/app/node_modules/raw-body/index.js:213:7)
2018-08-08T08:29:29.265163+00:00 app[web.1]: at IncomingMessage.onEnd (/app/node_modules/raw-body/index.js:273:7)
2018-08-08T08:29:29.265164+00:00 app[web.1]: at emitNone (events.js:106:13)
2018-08-08T08:29:29.265166+00:00 app[web.1]: at IncomingMessage.emit (events.js:208:7)
2018-08-08T08:29:29.265167+00:00 app[web.1]: at endReadableNT (_stream_readable.js:1064:12)
2018-08-08T08:29:29.265168+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:138:11)
2018-08-08T08:29:29.265169+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:180:9)
2018-08-08T08:29:29.266257+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=2f2bc8ca-a0fb-4a8f-aaf8-a5130f41cf0e fwd="173.252.85.199" dyno=web.1 connect=0ms service=1ms status=500 bytes=404 protocol=https
2018-08-08T08:29:29.509418+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=d4953a8c-5ed4-47ca-8f39-0449af107cee fwd="173.252.84.115" dyno=web.1 connect=0ms service=3ms status=500 bytes=404 protocol=https
2018-08-08T08:29:29.507548+00:00 app[web.1]: @APP POST
2018-08-08T08:29:29.510342+00:00 app[web.1]: TypeError: Cannot read property '0' of undefined
2018-08-08T08:29:29.510344+00:00 app[web.1]: at /app/index.js:60:39
2018-08-08T08:29:29.510347+00:00 app[web.1]: at Array.forEach (<anonymous>)
2018-08-08T08:29:29.510348+00:00 app[web.1]: at /app/index.js:56:14
2018-08-08T08:29:29.510349+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.510351+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2018-08-08T08:29:29.510352+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2018-08-08T08:29:29.510353+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.510354+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22
2018-08-08T08:29:29.510356+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2018-08-08T08:29:29.510357+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2018-08-08T08:29:29.510358+00:00 app[web.1]: at urlencodedParser (/app/node_modules/body-parser/lib/types/urlencoded.js:82:7)
2018-08-08T08:29:29.510359+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.510360+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2018-08-08T08:29:29.510361+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2018-08-08T08:29:29.510362+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2018-08-08T08:29:29.510363+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2018-08-08T08:29:29.510365+00:00 app[web.1]: at /app/node_modules/body-parser/lib/read.js:130:5
2018-08-08T08:29:29.510366+00:00 app[web.1]: at invokeCallback (/app/node_modules/raw-body/index.js:224:16)
2018-08-08T08:29:29.510367+00:00 app[web.1]: at done (/app/node_modules/raw-body/index.js:213:7)
2018-08-08T08:29:29.510368+00:00 app[web.1]: at IncomingMessage.onEnd (/app/node_modules/raw-body/index.js:273:7)
2018-08-08T08:29:29.510369+00:00 app[web.1]: at emitNone (events.js:106:13)
2018-08-08T08:29:29.510370+00:00 app[web.1]: at IncomingMessage.emit (events.js:208:7)
2018-08-08T08:29:29.510371+00:00 app[web.1]: at endReadableNT (_stream_readable.js:1064:12)
2018-08-08T08:29:29.510372+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:138:11)
2018-08-08T08:29:29.510373+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:180:9)
2018-08-08T08:29:29.752490+00:00 app[web.1]: @APP POST
2018-08-08T08:29:29.753085+00:00 app[web.1]: TypeError: Cannot read property '0' of undefined
2018-08-08T08:29:29.753087+00:00 app[web.1]: at /app/index.js:60:39
2018-08-08T08:29:29.753089+00:00 app[web.1]: at Array.forEach (<anonymous>)
2018-08-08T08:29:29.753090+00:00 app[web.1]: at /app/index.js:56:14
2018-08-08T08:29:29.753092+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.753093+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13)
2018-08-08T08:29:29.753094+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2018-08-08T08:29:29.753096+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.753097+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22
2018-08-08T08:29:29.753098+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2018-08-08T08:29:29.753099+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2018-08-08T08:29:29.753100+00:00 app[web.1]: at urlencodedParser (/app/node_modules/body-parser/lib/types/urlencoded.js:82:7)
2018-08-08T08:29:29.753101+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2018-08-08T08:29:29.753103+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13)
2018-08-08T08:29:29.753104+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7
2018-08-08T08:29:29.753105+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2018-08-08T08:29:29.753106+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)
2018-08-08T08:29:29.753107+00:00 app[web.1]: at /app/node_modules/body-parser/lib/read.js:130:5
2018-08-08T08:29:29.753108+00:00 app[web.1]: at invokeCallback (/app/node_modules/raw-body/index.js:224:16)
2018-08-08T08:29:29.753109+00:00 app[web.1]: at done (/app/node_modules/raw-body/index.js:213:7)
2018-08-08T08:29:29.753111+00:00 app[web.1]: at IncomingMessage.onEnd (/app/node_modules/raw-body/index.js:273:7)
2018-08-08T08:29:29.753112+00:00 app[web.1]: at emitNone (events.js:106:13)
2018-08-08T08:29:29.753113+00:00 app[web.1]: at IncomingMessage.emit (events.js:208:7)
2018-08-08T08:29:29.753114+00:00 app[web.1]: at endReadableNT (_stream_readable.js:1064:12)
2018-08-08T08:29:29.753115+00:00 app[web.1]: at _combinedTickCallback (internal/process/next_tick.js:138:11)
2018-08-08T08:29:29.753116+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:180:9)
2018-08-08T08:29:29.753422+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=8c837396-d1d9-4c4f-a5a0-0b44d0175a65 fwd="173.252.84.112" dyno=web.1 connect=1ms service=3ms status=500 bytes=404 protocol=https
2018-08-08T08:29:31.187104+00:00 app[web.1]: @APP POST
2018-08-08T08:29:31.187170+00:00 app[web.1]: WEBHOOK RECEIVED
2018-08-08T08:29:31.187437+00:00 app[web.1]: { sender: { id: '167446456648112' },
2018-08-08T08:29:31.187439+00:00 app[web.1]: recipient: { id: '2434229289927905' },
2018-08-08T08:29:31.187441+00:00 app[web.1]: timestamp: 1533716969732,
2018-08-08T08:29:31.187443+00:00 app[web.1]: message:
2018-08-08T08:29:31.187444+00:00 app[web.1]: { is_echo: true,
2018-08-08T08:29:31.187446+00:00 app[web.1]: app_id: 400867433721637,
2018-08-08T08:29:31.187454+00:00 app[web.1]: mid: 'Mxpu1fCA5OB_R1eOhi_jtRsjxze7cyi3viFlvr2evRk99WHkP7p6u5_13sBtT4Zfp1Kyqf0Hy6PS3KKWxePKEw',
2018-08-08T08:29:31.187456+00:00 app[web.1]: seq: 3012628,
2018-08-08T08:29:31.187458+00:00 app[web.1]: text: 'Hello Aldon!\n\nHow can we help you?',
2018-08-08T08:29:31.187459+00:00 app[web.1]: attachments: [ [Object] ] } }
2018-08-08T08:29:31.187507+00:00 app[web.1]: NOT A POSTBACK
2018-08-08T08:29:31.415870+00:00 app[web.1]: @APP POST
2018-08-08T08:29:31.415885+00:00 app[web.1]: WEBHOOK RECEIVED
2018-08-08T08:29:31.416043+00:00 app[web.1]: { sender: { id: '2434229289927905' },
2018-08-08T08:29:31.416045+00:00 app[web.1]: recipient: { id: '167446456648112' },
2018-08-08T08:29:31.416047+00:00 app[web.1]: timestamp: 1533716970492,
2018-08-08T08:29:31.416049+00:00 app[web.1]: delivery:
2018-08-08T08:29:31.416051+00:00 app[web.1]: { mids:
2018-08-08T08:29:31.416053+00:00 app[web.1]: [ 'Mxpu1fCA5OB_R1eOhi_jtRsjxze7cyi3viFlvr2evRk99WHkP7p6u5_13sBtT4Zfp1Kyqf0Hy6PS3KKWxePKEw' ],
2018-08-08T08:29:31.416055+00:00 app[web.1]: watermark: 1533716969732,
2018-08-08T08:29:31.416056+00:00 app[web.1]: seq: 0 } }
2018-08-08T08:29:31.416077+00:00 app[web.1]: NOT A POSTBACK
2018-08-08T08:29:31.188389+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=2e36a22c-b95c-497c-b135-bc14fdd44362 fwd="45.64.41.8" dyno=web.1 connect=0ms service=2ms status=200 bytes=213 protocol=https
2018-08-08T08:29:31.417388+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=8873871c-94c2-4ebb-b0f3-8f9d24fddacf fwd="45.64.41.10" dyno=web.1 connect=0ms service=2ms status=200 bytes=213 protocol=https
2018-08-08T08:29:31.570000+00:00 app[web.1]: @APP POST
2018-08-08T08:29:31.570181+00:00 app[web.1]: WEBHOOK RECEIVED
2018-08-08T08:29:31.570338+00:00 app[web.1]: { sender: { id: '2434229289927905' },
2018-08-08T08:29:31.570341+00:00 app[web.1]: recipient: { id: '167446456648112' },
2018-08-08T08:29:31.570363+00:00 app[web.1]: timestamp: 1533716970699,
2018-08-08T08:29:31.570365+00:00 app[web.1]: delivery:
2018-08-08T08:29:31.570367+00:00 app[web.1]: { mids:
2018-08-08T08:29:31.570369+00:00 app[web.1]: [ 'Mxpu1fCA5OB_R1eOhi_jtRsjxze7cyi3viFlvr2evRk99WHkP7p6u5_13sBtT4Zfp1Kyqf0Hy6PS3KKWxePKEw' ],
2018-08-08T08:29:31.570371+00:00 app[web.1]: watermark: 1533716969732,
2018-08-08T08:29:31.570373+00:00 app[web.1]: seq: 0 } }
2018-08-08T08:29:31.570401+00:00 app[web.1]: NOT A POSTBACK
2018-08-08T08:29:31.570963+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=feac2305-cec0-40dd-8ab2-7951951e4d05 fwd="45.64.41.8" dyno=web.1 connect=0ms service=2ms status=200 bytes=213 protocol=https
2018-08-08T08:30:52.087932+00:00 app[web.1]: @APP POST
2018-08-08T08:30:52.088066+00:00 app[web.1]: WEBHOOK RECEIVED
2018-08-08T08:30:52.088380+00:00 app[web.1]: { sender: { id: '2434229289927905' },
2018-08-08T08:30:52.088383+00:00 app[web.1]: recipient: { id: '167446456648112' },
2018-08-08T08:30:52.088385+00:00 app[web.1]: timestamp: 1533717051208,
2018-08-08T08:30:52.088387+00:00 app[web.1]: read: { watermark: 1533716969732, seq: 0 } }
2018-08-08T08:30:52.088491+00:00 app[web.1]: NOT A POSTBACK
2018-08-08T08:30:52.089403+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=df114f8a-7e8f-472e-9dea-a3631a4b6585 fwd="45.64.40.182" dyno=web.1 connect=1ms service=4ms status=200 bytes=213 protocol=https
2018-08-08T08:31:09.525673+00:00 heroku[router]: at=info method=GET path="/webhook" host=istoryabot.herokuapp.com request_id=64e7434d-45f8-4bf5-bc47-6dd6607baad6 fwd="202.92.130.203" dyno=web.1 connect=0ms service=1ms status=403 bytes=215 protocol=https
2018-08-08T08:31:09.528449+00:00 app[web.1]: Verification failed. The tokens do not match.
2018-08-08T08:31:49.642921+00:00 heroku[router]: at=info method=GET path="/" host=istoryabot.herokuapp.com request_id=d2b1432e-e3da-4985-a87d-b73deb973c0a fwd="202.92.130.203" dyno=web.1 connect=0ms service=1ms status=200 bytes=207 protocol=https
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2018-08-08T08:30:52.088066+00:00 app[web.1]: WEBHOOK RECEIVED
2018-08-08T08:30:52.088380+00:00 app[web.1]: { sender: { id: '2434229289927905' },
2018-08-08T08:30:52.088385+00:00 app[web.1]: timestamp: 1533717051208,
2018-08-08T08:30:52.088383+00:00 app[web.1]: recipient: { id: '167446456648112' },
2018-08-08T08:30:52.088387+00:00 app[web.1]: read: { watermark: 1533716969732, seq: 0 } }
2018-08-08T08:30:52.088491+00:00 app[web.1]: NOT A POSTBACK
2018-08-08T08:30:52.089403+00:00 heroku[router]: at=info method=POST path="/webhook" host=istoryabot.herokuapp.com request_id=df114f8a-7e8f-472e-9dea-a3631a4b6585 fwd="45.64.40.182" dyno=web.1 connect=1ms service=4ms status=200 bytes=213 protocol=https
2018-08-08T08:31:09.525673+00:00 heroku[router]: at=info method=GET path="/webhook" host=istoryabot.herokuapp.com request_id=64e7434d-45f8-4bf5-bc47-6dd6607baad6 fwd="202.92.130.203" dyno=web.1 connect=0ms service=1ms status=403 bytes=215 protocol=https
2018-08-08T08:31:09.528449+00:00 app[web.1]: Verification failed. The tokens do not match.
2018-08-08T08:31:49.642921+00:00 heroku[router]: at=info method=GET path="/" host=istoryabot.herokuapp.com request_id=d2b1432e-e3da-4985-a87d-b73deb973c0a fwd="202.92.130.203" dyno=web.1 connect=0ms service=1ms status=200 bytes=207 protocol=https