首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FB : messaging_events.length ->不能读取属性长度

FB : messaging_events.length ->不能读取属性长度
EN

Stack Overflow用户
提问于 2018-08-08 08:54:34
回答 1查看 127关注 0票数 0

你好,我对我的机器人有一个问题,那就是我的web钩子没有及时响应facebook --我从开发者页面收到了以下消息:

您的Webhooks订阅回调URL https://istoryabot.herokuapp.com/webhook至少10分钟没有接受更新。请验证您的回调服务器是否正常工作。请访问我们的参考文档,了解如何更新回调URL。 如果您的回调URL在50分钟后仍然失败,您的订阅将被禁用。要重新激活,只需使用相同的参数发出POST请求,或者访问应用程序仪表板中的Webhooks选项卡。

因此,机器人已被禁用。我的机器人托管在heroku上,当我转到web钩子页面时,我得到了这个结果:

Forbidden

但是,作为页面和bot应用程序的管理员,即使在开发人员模式下,我仍然能够查看和测试bot的功能。我已经验证了机器人通过信使返回正确的响应,但是仍然,web钩子url失败了。有人能帮我吗?我的代码和日志将在下面找到。

代码:

代码语言:javascript
复制
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);
        }
    });
}

日志:

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

发布于 2018-08-08 09:11:16

确保"data.entry“是一个数组,然后只有"forEach”才能工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51742506

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档