Facebook Webhook Test Button not working as expected

强颜欢笑 提交于 2020-01-16 09:04:13

问题


I have successfully added my callback url in my webhooks setup. At that time, the callback url was called successfully with proper logs and everything in the server. But when I click on the TEST button for the respective name (leadgen in this case), nothing AT ALL is being received by the server when in fact it should at least log the very first line. Note that I am using post and get.

Additional note: for NetSuite experienced developers, I am using a suitelet as the callback url for the webhook.

Thanks.


回答1:


Suitelets that are available externally without login will only work if the User-Agent header in the request mimics a browser. See for example SuiteAnswers # 38695.

I ran into a similar issue, and the workaround was to proxy the request using a Google Cloud Function that simply rewrote the User Agent:

const request = require('request');

exports.webhook = (req, res) => {
  request.post(
      {
        url: process.env.NETSUITE_SUITELET_URL,
        body: req.body,
        json: true,
        headers: {
          'User-Agent': 'Mozilla/5',
          Authorization: req.headers['authorization'],
        },
      },
      function(error, response, body) {
        res.send(body);
      }
  );
};


来源:https://stackoverflow.com/questions/58989315/facebook-webhook-test-button-not-working-as-expected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!