Example: send an SMS or email reminder depending on preference
This builds on Example: send a reminder email the day before a course starts. Now each enrolment also has a PreferredContact field set to Email or Sms, and a StudentMobile field. Students who prefer SMS should get a text. Everyone else should still get the email.
Before you start
Complete the first example, or have a similar process, dataset and email template ready. You also need Twilio set up for SMS.
Steps
-
Add the new fields to the dataset
Open the Courses Starting Tomorrow dataset and add
PreferredContactandStudentMobileto Select, each with the same name in As. Save and publish. -
Create the rule type
Under Rule Types, create a rule type called SmsReminder. This is the label that links the rule to the step that acts on it.
-
Create the rule
Create a Rule called Prefers SMS. Set Rule Type to SmsReminder and Match to All. Add one condition set with Match All, containing one condition:
- Dataset: Courses Starting Tomorrow
- Field:
PreferredContact - Operator:
equal - Value 1:
Sms
Save and publish.
-
Create the SMS template
Create a Message Template called Course Reminder SMS. Set Channel to Sms, Recipient to
$$StudentMobile$$, and Body Text to:Hi $$StudentFirstName$$, a reminder that $$CourseName$$ starts on $$CourseStartDate:dddd d MMMM 'at' HH:mm$$. -
Update the process
Open Course Reminders. Add Prefers SMS to Rules. Replace the Send Email step with two steps:
- A Rule Match Outcome step: Rule Match set to SmsReminder, Actions set to Course Reminder SMS.
- A No Rule Match Outcome step: Actions set to Course Reminder.
Leave the schedule as it is. Save and publish.
-
Test both routes
On the Test tab, click Run test. Records with
PreferredContactset toSmsshould show an SmsReminder badge. Everyone else should show No Rule Match. Click each badge to preview the message or email.If your data doesn't include both kinds of student yet, use the Suggested Tests tab to check the logic with made-up values.
What happens next
From the next run, SMS-preferring students get a text and everyone else gets the email. A rule only changes what happens once a step acts on it; here, the two outcome steps do that.