Skip to main content
Question

How to Loop through results of a Webhook Action

  • 18 July 2024
  • 3 replies
  • 51 views

Hi folks, 

I was able to set up a webhook action to grab bill information from the LegiScan API and when I look at the data out it looks great. I see a visual representation of the data like it’s in an array for each search result: 

What I would like to do is set up a loop that does something with each item in the array searchresult.

When I go to do any other action, what I have is separate line items for every piece of information:

I also can’t take advantage of the Code action to group this information together because I’d have to add each of those results (9 pieces of information and 100 results = 900 variables). I’m not sure where to go from here to put each search result into Airtable rows. 

Anyone else run into this? Any help greatly appreciated!

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Userlevel 7
Badge +14

Hi @dev_ttse 

Try this trick:

 

Then you can use a Code step to parse and prep the data.

 

The Looping app can then be used to iterate the items: https://zapier.com/apps/looping/help

Thanks so much @Troy Tessalone this is indeed totally what I’m looking for, however, maybe I’m not implementing it correctly?

I set up the second zap and sent the data to the second zap through a webhook just like the guide recommended, sending as a “form” or as “json” worked but still ultimately returned the same individual variables as the first zap. I switched to the Catch Raw Hook option and that was closer to what I was looking for with the raw API response coming through.

Now I’m trying to parse the json with the Code action and when I parse the JSON Zapier again removes the array:

Any other tips on how to parse this out to line items? I really appreciate your help.

Userlevel 7
Badge +14

@dev_ttse 

You can’t just parse the raw JSON.

You need to add custom code to parse the raw JSON to create new arrays.