Add wait time in a loop

Hi, I created an automation to grab all items from a google sheet and send them to an API, paginated, sending a few at a time. For this I used the loop shown below. Is there a way for me to a wait time in the loop? Like if I could add a node that makes the automation pause for 5 minutes, so that each HTTP request would be sent with a 5 minute interval between them.

Create a New Function Node and Add this code

const waitTimeSeconds = 300;

return new Promise((resolve) => {
  setTimeout(() => {
  }, waitTimeSeconds * 1000);

This code is for 5 minutes. You have to add between where you want to make delay.

You can change 300 to something else if you want to experiment.

Basically 300 Seconds = 5 Minutes


Hey @tiago.lcisolucoes!

Welcome to the community :sparkling_heart:

Did the solution provide by @mcnaveen work for you? Is that what you’re looking for?

Let us know if you need help :slight_smile:

1 Like

Hey @tiago.lcisolucoes!

If you update to the latest version of n8n, you can do this using the Wait node.


Adding here for others finding this post: the Wait node has the added benefit that it’ll “hibernate” the workflow if the wait time is more than 1 minute. This is helpful if you’re triggering the workflow a lot since each “in progress” execution doesn’t have to be stored in memory (it’s instead stored in the DB and resurrected when the wait is over).

So definitely recommend the Wait node for production scenarios, or any “long” waits.