Introducing the @new_contact Expression

The @new_contact expression was recently added to TextIt's expression language to support an exciting yet advanced new use case: creating additional contacts associated with a single phone and assigning each their own therapy adherence campaigns. You might think of it as adding "sub-contacts" to an existing contact. Essentially, it allows you to create and manage multiple contacts who communicate via a single phone, e.g. a family. Accordingly, you might apply this feature to a service that not only provides maternity health reminders to expecting mothers, but medical reminders pertaining to the health of their other children as well. 

Applying the @new_contact Concept

The aim of the following use case is to create separate profiles for each child, all containing the mother's phone number, so that she can receive campaign events addressed to each of her children.

Creating Sub-Contacts

First, you'll need to start the mother in a flow that collects relevant information about each child. This ensures that each flow run will result in the creation of a new child:



After your workflow has collected relevant information about the child, you'll use @new_contact to create an empty placeholder for that child's contact profile, and the Start Someone in a Flow action to start a flow that will update the new contact's field values: 


Updating Each New Contact's Profile

The next flow should contain a series of Update the Contact actions that will update the values collected by the previous flow (name, gender, age) to the placeholder for the child, @new_contact:




First, you'd create a contact field for the child that will contain the mother's phone number (you can create new contact fields within the Update Contact flow action). Then, you'll populate that field with the mother's phone number using the @step.contact.tel_e164 expression. @step.contact refers to the mother - the contact who sent the previous message: 




Then, you'd place the @extra expression in front of each of the values collected from the previous flow: 




Once each child's contact profile is created, you can assign them their own campaign

Sending Reminders Intended for the Child

To send reminders to the mother for her child, you'll need to create a campaign event to be sent to the child's contact profile that contains a flow that uses the Send a Message to Someone Else or Start Someone Else in a Flow actions to message the mother. The address you'll use is the contact field containing the mother's phone number, @contact.mother_phone

Download these Flows

If you've purchased credits, you can download the workflows referenced in this post and import them into your account for guidance. 

Your feedback is invaluable to us. You can share your questions, comments and suggestions with us at support@textit.in. If you haven't tried TextIt, you can do so for free here