0

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 Answers1

0

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);
      }
  );
};
michoel
  • 3,725
  • 2
  • 16
  • 19
  • hello. i am not actually well-versed in google cloud function. can you please explain how and where can i add that snippet so facebook can pass thru it before calling the netsuite external suitelet. thanks a lot. – Julius Benedict Cuanan Jan 02 '20 at 22:30
  • do you mean i should change my webhook url to this google cloud function and this google cloud function will redirect to the netsuite external suitelet? – Julius Benedict Cuanan Jan 02 '20 at 22:32