Twilio - Send message to multiple recipients

I am trying to send Twilio text messages to multiple recipients but am having issues getting it to work properly. I’ve searched documentation but haven’t found many examples of Twilio in docs. I would like to create a table that would allow people to create a send messages to a group of people depending on the people referenced from another table. When I tried doing a formula map, it did not work. I read that Twilio has to run separate GET requests so perhaps formula map isn’t compatible.

I have sent group messages but adding a Twilio button to each row that a person is on, but easily adding customs messages and making it intuitive for the users who would send the messages has me a little stumped. Does anyone have experience with this? I made a dummy doc to kind of show what I am trying to do.

Group Twilio Messages


1 Like

I’ve edited your doc so that it does what you want. It’s possible but ugly.

Essentially, I added a column that brings in the students you wanted to send a text to:
All it does is look up the people that have the group tag that you want. The formula used here enables you to use multiple different tags per person if you want.

Then your (purple) send sms button just goes through the list of people that will get a text and presses the “send SMS” button for each of them.
thisRow.[Who will get text?].FormulaMap(RunActions(CurrentValue.[Send SMS]))
But, before it can do that it needs to indicate that this is the message to send, which it does by changing the “Send This Message” column to a 1. That means that it needs to change all the columns back to 0 afterward.

Set “Send This Message” Column to 1
ModifyRows(thisRow, thisRow.[Send This Message], 1)
Set all “Send This Message” Columns back to 0
ModifyRows(thisTable, thisTable.[Send This Message], 0)

So combining this with the previous message that actually presses the buttons in the People Table, it looks like this mess:

    ModifyRows(thisRow, thisRow.[Send This Message], 1),
    thisRow.[Who will get text?].FormulaMap(
        RunActions(CurrentValue.[Send SMS])), 
    ModifyRows(thisTable, thisTable.[Send This Message], 0)

This means that your (blue) Send SMS button in the People table needs to look up which message to send from the Messages table. It does so with Messages.Filter([Send This Message]=1).[Message + Signature]) because it’s trying to find the Message + Signature associated with the row that has Send This Message selected.

Finally, to show you that it’s doing what you expect, I’ve told it to open up a web page that will display the text it’s intending to send. That’s why it takes you to

OpenWindow(Concatenate("", Format("Simulate send message to {1} {2}",thisRow.Student, Messages.Filter([Send This Message]=1).[Message + Signature]).EncodeForUrl()))

However, this is not the right way to do this

Instead, you should use a FormulaMap of the users and run a single Twilio action (as I’ve simulated with a button in The Right Way Twilio Page with the Send Message to button) You could put my button into your table, it should work.

The thing to keep in mind is that you can run a formula like People.Filter(something=true).FormulaMap(TwilioAction(CurrentValue.Number, CurrentValue.Name) ) I know that’s not the exact signature of the Twilio Action but it should get you on your way.


Thanks so much @Connor_McCormick. I implemented your revised version and it worked. I originally had it fail saying I violated a blacklist rule when testing with a friend that was in the room with me, but I tried with another number and I was able to send multiple texts via the button. So I think that was probably just a Twilio setup.

1 Like

@Tim_Sherrod can you share how you merged @Connor_McCormick’s solution with the correct Twilio formula? My formula is combining the the phone numbers together (red line through them). I’ve structured my doc like @Connor_McCormick suggested in “The Right Way Twilio” page.

Josh could you share your doc?

Just messaged you a link for it.

Oh, josh the problem is probably just the fact that you used who.unstrippedPhone rather than CurrentValue.unstrippedPhone. Try:

who.FormulaMap(Twilio::SendSMS([User's private Twilio account], YOUR_KEY, CurrentValue.unstrippedPhone,"Test"))

Here’s the difference between the two:

If you use who it will try to use the whole list again giving all the numbers as many times as there are numbers in the list (2 numbers twice and 3 numbers thrice for 3, etc.). If you use CurrentValue it will only give you the current row one at a time of the who selector.

1 Like

Yes I’m so sorry! Removed. If you’d like to remove me from the doc feel free.

Great glad it was useful.

1 Like