query1 returns an array of string (containing IDs). Then I use these IDs in a loop inside query2 which sends a GET request to Stripe ([Test] Read Invoices). Lastly, I run query3 to send an email about the output of my query2 loop.
How to set it up so that for every successful request, I immediately run query3 instead of waiting for all the request inside query2 loop to finish before starting query3?
You should create the Get request (stripeInvoiceQuery) and the Email (sendEmail) as a function within your workflow and setup the parameters for each as needed. What is currently query2 should then loop as JS Code with something like:
This should then send the emails per iteration instead of looping around again at the end. Here's an even more in depth setup example for these functions and how you can try/catch and handle errors following the loop.