While Loop: Repeater with an exit condition

:bullseye: What is your goal?

I want to create something similar to a while-loop. Check 5 times if the call has the status “completed”. If the call is not completed then sleep for the maximum duration of 300s and check again.

:thinking: What is the problem?

If the call is completed I want to exit the loop. The top flow should be executed only once.

:camera_with_flash: Screenshots: scenario setup, module configuration, errors

Hey there,

you can try something like this. Basically you want to throw an error on the top route so it breaks the scenario and do the rest inside the error handler route. And if it doesnt go on the top route it will keep repeating until it does or you run out of repeats.

1 Like

1. Repeater (5 Retries)

2. API Call (Check Status)

3. Router (2 Routes)

4. Route 1 (Completed) Stop Repeater > Condition

5. Route 2 (Not Completed) > Sleep

If it gets to 5 retries without hitting completed, then the repeater just exits automatically and passes through with the last status. Then you can add any another condition.

Welcome to the Make community!

There are two methods if you want to do a polling wait in the same/single scenario.

Method 1 — difficulty level: Easy

The simplest solution would be to use a Sleep module to wait out 5 minutes (or the longest period that the external service takes).

You could even use more than one, if you have a Make subscription (free tier max 5 minutes per scenario run).

Method 2 — difficulty level: ???

This other method allows you to check multiple times at shorter intervals, because you “throw” an error to break from the repeater and end the scenario when successful/completed.

The secret is in the success check filter, the error handler, and the commit directive.

Hope this helps! If you are still having trouble, please provide more details.

@samliew

1 Like

Why not just use a Watch New Call Activity and when the call is ended, do what you need to do?

This is a webhook so it should fire instantly upon the call’s completion! This would be a separate scenario.

1 Like

Thats a good idea, but I wanted to combine two different events in the same webhook.

In make you can only have one trigger per scenario and i dont want to have multiple scenarios for the same workflow.

1 Like