Send SmS Workflow on a list does not stop

Hi, thanks for reading!
I have a workflow on a list to send SMS via Twilio plugin.

How it works:

  1. The system gets Prospects from the db into a list of Prospects (100), only if they are Contacted: “No”
  2. The button Send SMS triggers the workflow on the List, while changing the status of Prospect to Contacted:“Yes” after the message is sent.
  3. Messages are being sent via twilio-send-text API workflow

Sending message to prospects works, however, I noticed that it never stops importing contacts into the list (old ones just repopulated with new ones) and thus the workflow never stops and keeps sending the message.

How do I make the workflow stop after first 100 contacts…? If I wish to run it again I would refresh the page, get new 100 contacts in the list and trigger via button again.

thanks,

You need to use recursive scheduled workflows. Add a type ‘number’ to your back-end workflow and have it increment on each scheduled call. Keep re-scheduling the endpoint and have a conditional statement once you exceed that incremental number by the total number of messages allowed.

Short answer: You need to prevent a loop somehow/somewhere in your conditional statements :slight_smile:

You can find the answer by searching for recursive workflows on the forum.

Thanks buddy, I will look into that!

1 Like

Some example images, I’m really busy atm so I can’t really dive into the solution for you but this should get you going.

1 Like

Coming back to this, I figured it out and I hope it helps someone else.

I have set 2 Key Parameters: Prospect and Iteration. I limit the number of iterations to 300. After every run the workflow marks Iteration + 1, and so when the workflow reaches 300 Iterations (runs) it stops the loop.

![screenshot-bubble.io-2020.11.10-11_36_49|513x500(upload://cT5JCScXJ02wf6CZLwIyMgeDjZ8.png)

This topic was automatically closed after 70 days. New replies are no longer allowed.