How to create min max wait time before continue flow?

Hi, i don’t know how to write script for this purpose. Usually I only use the Wait Node to pause for a fixed period before continuing the flow. But I think this node I can only set a single fixed value.

Is there anyway to create a min - max wait period using existing nodes combination? or maybe a simple code to achieve the same?

My use case:
I have list of telegram users ID from Loop Over Items node. I want to send message to each of them, instead of using a fixed interval (wait time) between messages, i want to randomize the message interval, for example: min 5 secs - max 30 secs. So each message will be sent at random wait time between 5-30 sec…

Any ideas?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Have you tried using an expression for the ‘Wait Amount’ field? Here’s one that should work:



Thank you! This seems to be working. I can adjust the (max - min) values in this bracket (30 - 5) right? If I want to make it random between 10 - 35 sec, I should change it to: (35 - 10) … + 10, correct?

By the way, is there any method that I can log or save the random number being used for each loop? Just to verify temporarily. Because when i checked the wait node after testing it, the number keep on changing for the same loop item, so I don’t now what are the exact interval value being used for each item when executed.

Exactly, I wrote it that way so you could just plug in the min and max values :slight_smile:

If you want to log the value, you’ll have to generate it with an Edit Fields node first. You can then use the value in the nodes after that, so you could log it first, and then use the value inside the wait node.

For example:

If these things are new to you, I recommend following our courses to get familiar with n8n:

1 Like

thanks so much! this working flawlessly. will surely checkout the courses.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.