Problem when creating webhook

JanPortheineJanPortheine Member Posts: 5

I am running a code from Google Script to create a webhook in Lightspeed but the response is an empty webhook;

Code:

function addWebhook() {

 var url = 'api.webshopapp.com/en/webhooks.json';

 var payload = {

  "isActive" : "true",

  "itemGroup" : "orders",

  "itemAction" : "paid",

  "language" : "en",

  "format" : "json",

  "address" : script_url 

 };

 var options = {

  "method" : "post",

  "Content-Type" : "application/json",

  'application': 'application/json',

  "payload" : JSON.stringify(payload),

  'headers': {'Authorization': 'Basic ' + Utilities.base64Encode(api_key + ':' + api_secret)},

  "muteHttpExceptions" : true

 };

 var res = UrlFetchApp.fetch(url, options);

  

 Browser.msgBox(res);

 Logger.log(res);

 res = JSON.parse(res);

}


Response:

{"webhooks":[]}

2 comments

Sign In or Register to comment.