10

I'm building an emergency response app for my company. I have a corporate email database, with everyone's mobile numbers, email addresses and hundreds of email groups defined. The goal is to build something that integrates with our maintained groups.

Proposed flow:

  1. Users sends an email to [goupname]@mydomain.com with subject '*text'.
  2. Mailbox Listener picks that up on the server, looks in the group for all members and retrieves their phone numbers.
  3. Server sends a Twilio SMS message to everyone in the group, using their phone number.
  4. Anyone in that group who replies vis SMS to that message, sends to the entire group.
  5. I want my listener out of the picture at this point. From here on, it's just a pure group text, phone to phone(s).

All of this is pretty easy for me, except the Twilio piece.

As you can see, the server/Twilio has a limited role. It's really just a gateway that allow us to use our vast list of groups for group SMS. Is this doable with Twilio? I see many examples of iterating through a list of numbers with a FOR loop, but those replies are going back to my SMS# I believe, and my Twilio number is still going to be involved in the replies. I want to start the group SMS, then have no further role.

Any thoughts/suggestions would be appreciated.

MIke McP
  • 111
  • 1
  • 3

2 Answers2

5

I'm a Twilio developer evangelist. Would love to help out here.

That all sounds fine to me. It is certainly the case that in order to send your first group SMS in your example that you'd need to iterate over the list of numbers and send an SMS to each of them from your Twilio number. That text would appear to come from your Twilio number to the end user. If they were to respond to the SMS, you could then have your Twilio number receive it and send a webhook to your server that then sends messages on to everyone else on the list.

It would have to work that way because SMS messaging is inherently one to one. So, in order to blast messages to the entire group, you would need to send a message to a central (Twilio) number.

I hope this helps. Drop me an email at philnash [at] twilio.com if you want to talk through this more.

[edit]

Twilio now supports native group messaging. It has some caveats, because group messaging requires MMS, this only works in countries where Twilio supports MMS, which is the USA and Canada. But it works now! Read the blog post to find out more.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • 1
    phil, is this answer still correct 3 years later? also, does twilio support imessage group texts? thanks. – Jonah Jan 26 '18 at 14:24
  • This is still correct, yes. There is no Apple API for iMessage, so texts sent to iPhones are just SMS messages. – philnash Jan 27 '18 at 02:34
  • Thanks for the update. One clarification: On iphone (and maybe Android too), you have the option to add numbers to a group text chain. Once a number is added, it receives all texts from any of the other numbers, and all the other numbers receive its texts. If I added a SMS twilio number to a group text as if it were a normal number, would the responses from that number go to everyone, just as if it were an added person? If not, why not? – Jonah Jan 27 '18 at 02:38
  • 1
    That would not work with Twilio because the model that is setup has a single `to` and single `from` fields. It also relies on MMS to collect the group numbers. This is a feature that has been requested before and we just don't support it right now I'm afraid. – philnash Jan 27 '18 at 02:41
  • Thanks again for the info! – Jonah Jan 27 '18 at 02:46
  • But when I send a single message to each group member separately, then such recipient cannot reply to all. When I send a group message from my phone, recipients can reply to all. So how can be reply-to-all allowed with Twilio? – Ωmega Dec 05 '18 at 21:53
  • Sadly, @Ωmega, therein lies the problem. Twilio does not currently support group messages, so you can't built a reply-to-all that works the same as your phone. – philnash Dec 09 '18 at 07:17
  • @philnash, how about now? – Levi V Feb 05 '20 at 05:06
  • @LeviV nope, sorry – philnash Feb 05 '20 at 05:07
  • @philnash what about this? - https://www.twilio.com/blog/group-texting-in-conversations – ANKIT Jan 19 '21 at 08:09
  • @ANKIT Yes! That was released this year and group SMS conversations now work! I will warn you that this will only work where Twilio supports MMS, which is in the USA and Canada. – philnash Jan 19 '21 at 08:41
0

If I'm not mistaken, we really don't need to wait for Twilio to implement this natively. We could parse the MMS payload ourselves, extract the group list and body, and put it back together for a response MMS.

We do need the specs on the MMS group text format... which I admit I haven't located yet.