I have 2 zaps. First finishes with Code by Zapier
block, where I parse input information from previous steps getting array with data e.g.:
var elements = [{id: 12, calculatedValue: 13},{id: 13, calculatedValue: 'red'}]
then in a loop I traverse it, create requests bodies
var options = {
"url": "https://hooks.zapier.com/hooks/catch/xxxxxx/xxxxxx/",
"method": "POST"
},
requests = elements.map(mapDataToSettings);
function mapDataToSettings(elem) {
var settings = Object.assign({}, options);
settings.data = JSON.stringify(elem);
return settings;
};
Then I'm doing HTTP calls with Fetch API
for all those requests:
Promise.all(requests.map(grabContent))
.then(function(data){ callback(null, {requestsMade: data});});
function grabContent(options) {
return fetch(options.url, options)
.then(function(res) {return res.json();});
};
N.B. callback
is function of Zapier to handle async results.
This code successfully runs and I can see results:
But those requests are not registered in webhook (address is correct. double checked.)
What may be the reason for this? How to fix my code to make requests activate webhook?