I'm having trouble with triggering multiple webhooks via Zapier like explained on Zapiers website Did anyone manage to use this functionality?
I'm trying to create "an array of properly formed JSON objects". To be able to select it as data source in the next step it needs to be a simple array (thats why I stringify the jsons inside the array).
Here is the json array I'm creating in Zapier Code trying to use to trigger two separate webhooks being triggered
var jsonArray = ['{"id":1,"data":111}','{"id":2,"data":222}'];
output = {jsonArrayOut: jsonArray};
Here is a screenshot of a custom webhook request in Zapier
No matter how I format the data I always get one request, not two.
Could anyone please tell me what am I missing?
Cool, so what you described in this comment should totally be possible.
Your zap will be the following:
{id, data}
(see below)This takes advantage of an undocumented feature of code steps where if they return arrays, the zap branches and subsequent steps run multiple times. Note that there's no UI for this and it'll look confusing, but it will work.
Your JS code will be something like the following:
// parse email code
// get items and their quantities
// return object that looks like this
return [{id: 1, data: 123}, {id: 2, data: 456}]
In step 3 (however you're doing that), you'll be able to select id
and data
as mappable inputs. When you're setting the zap up, you'll only see 1
and 123
as options, but when the zap is on and runs for real, step 3 will get run for each array element returned in step 2.