How to wait after several subflows are run?

Hello! I need help with a flow!

I have a flow where I initially search for my Whatsapp contacts through the Z-API. Next, I use a Loop Over Items node to pass just one contact forward. Next, through the Z-API I evaluate which labels are assigned to this contact. Based on this, with the Switch node, the flow is directed to the independent subflows for each tag type. It is important to say that some contacts will have more than one label and, therefore, will run more than one subflow. Finally, it returns to the “Next Customer” node and returns to the loop.

However, currently the Switch node is directing to the subflows and when the first subflow ends it returns to looping even if other subflows have not yet finished running.

Therefore, I would like to create a condition to wait for all subflows to finish before returning to the loop and continuing with the next contact.

Is there any way to resolve this?

Information on your n8n setup

  • n8n version: 1.25.1
  • Database: PostgreSQL
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via: Docker Swarm
  • Operating system: Linux Debian 11

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:

This sounds like a good use case for the Wait node using the ‘On Webhook Call’ option?

I’d probably make one ‘master’ sub workflow that triggers the others, and when everything is complete have it call the webhook to signal to the wait node that it can resume operations.

Hello bartv, how are you?!

Thank you for your feedback and support!

I read the Wait node documentation here, but I still have a question. How could I signal the Wait node that all subflows have completed? Because in theory, if a contact has more than one label, the Wait node will be triggered as soon as the first subflow ends.

Could you help me with the construction of this stage?

Wait, I think I may have misunderstood you. Are you calling those sub workflows through a webhook? If so, make sure you set them to ‘Respond when last node finishes’:

With a simple setup like the one below, the script won’t continue until both webhooks are finished: