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.
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.
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’: