Adding a Group Chat Component to your SMS Messaging Service

If you've used TextIt in the United States, chances are you've purchased a virtual number from Twilio and connected it to your account. Twilio's speed, efficiency and reliability make it the channel of choice for countless TextIt users. They even give nonprofits $500 in credit and a 25% discount. By all accounts, it's a perfect match: whereas Twilio's API can be used to add high performance SMS and voice capability to any application, TextIt provides an interface that gives you unprecedented control over the messages sent and received via Twilio's API. 

Recently, Twilio published an article about SMSUp, a group chat application built by Urban Refugees that allows refugees to create their own distribution lists, share critical information within their community and become empowered to self organize easily. Coincidentally, group chat is one of the many applications you can build with TextIt. Agricultural cooperatives across Africa use group chat workflows built with TextIt to coordinate prices and facilitate conversations about fish, maize, cassava, beans, fruits and other goods. If you log-in to your TextIt account and navigate to the flows tab, you'll see that it's even one of the sample workflows we provide at sign-up. 

Here's an example: 

Building a Group Chat Workflow

The first step in building a group chat workflow is to create a group for the chat. This creates the group to which each contact's message, sent by the Send a Message to Somebody Else action, will be delivered. Once sent, each contact's message will be delivered to the group. 

To protect privacy, you might consider allowing your contacts to provide an alias. This is also useful if your contact's names haven't yet been updated to your account. 

The steps above collect the contact's alias, update it to their contact profile, let both the contact and the rest of the group chat know that the group has a new member, and then adds the contact to the group. 

Once the contact has responded, they'll reach the "Wait for Command" RuleSet, which will evaluate each message sent by the contact for the word 'exit' - a command that will exit them from the group chat.

All other messages pass through the "other" category and are directed to the group chat using the Send an SMS to Somebody Else action, which contains the sender's name and response, represented by the and @step.value variables. The @step. prefix allows us to reference the active contact in a message to the contacts who comprise the group, while the variable @step.value refers to the last message sent by the active contact. Click here to learn more about contact variables

Placing a Remove from Groups action before the Send an SMS to Somebody Else prevents the active contact from receiving the message they just sent. After the message is sent, the contact is then placed back into the group using the Add to Groups action so that they may receive responses from their others in the group: 

Give it a Try

Open the group chat sample workflow present in your flows tab to play around with this concept. As always, if you have any questions about what is possible, or suggestions on how to make things easier, let us know!  

Don't have an account? Click here to sign-up for free - no credit card required.