Problem when creating webhook
in Development
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
Ah, I forgot to put https:// infront of the link...
@JanPortheine ,
That's correct, you'll need to have https