Personalized messages
Send each customer an SMS built from their own record, with different wording for each segment, from an automation.
In this guide you build an automation that reads your customers from a data store, picks a message for each one based on their segment, and sends it by SMS with their name and details filled in. You can run it by hand or on a schedule.
The finished workflow:
Trigger (Schedule, or run by hand)
→ Data Store (GET customers who have not opted out)
→ Loop
body → Set Fields (customer = the current record)
→ Router on state.customer.tier
gold → Messaging (SMS: gold offer)
fallback → Messaging (SMS: standard offer)Before you start, you need:
- A data store of customers with at least
name,phone(international format),tierandoptedOutfields. - An SMS provider account (Twilio, Africa's Talking or Infobip) with its credential saved under Credentials.
- An automation project. Go to Projects, select New project and set Channel to Automation.
Choose when it runs
Open the Trigger node and go to Trigger Settings. Select Schedule to send on a timetable, for example Every Week on Monday at 09:00, or select External with External Mode set to Manual to send only when you press Run. See Automation triggers.
Load the customers
Add a Data Store node after the trigger:
- Set Action to GET and choose your customers store under Data Store.
- Under Which records, add a rule that leaves out records whose
optedOutfield istrue, so people who asked to stop are never messaged. - Set Output variable to
customers.
Loop over them
Add a Loop node. Set Items expression to the list of records the Data Store node returned; it must evaluate to an array. Press Run once and check the run in the Activity tab to see where the records are in the result.
If your SMS provider limits how fast you can send, choose Even pacing in the Loop and set Maximum per second.
Name the current customer
On the Loop's body handle, add a Set Fields node with one field: Field name customer, Value expression input.item. Every node after it can now read the current record as {{state.customer.name}}, {{state.customer.phone}} and so on.
Split by segment
Add a Router after Set Fields. Add a path where state.customer.tier is gold, and turn on the Fallback path for everyone else. Add more paths for more segments; the first matching path wins.
Write each message
On each Router path, add a Messaging node. Choose your provider under Medium and its credential under Credentials to connect with, set Resource to SMS, Operation to Send, From to your sender ID and To to {{state.customer.phone}}. Then write the Message for that segment:
Hi {{state.customer.name}}, as a Gold member you get 20% off all orders this week.Hi {{state.customer.name}}, this week's offer: free delivery on orders over KES 2,000.If your messages tell people how to opt out, make sure each opt-out is recorded by setting optedOut to true on their record, for example with a Data Store node set to PUT in the flow that receives the request.
Test, then publish
Temporarily change the Data Store rule to match only your own record, press Run, and check the SMS. Restore the rule and publish. Scheduled runs use the published version.
Check that it worked
- Each customer gets one SMS with their own name, and the wording matches their tier.
- Customers with
optedOutset totrueget nothing. - The run in the Activity tab shows one pass through the loop body per customer. See Runs and logs.
Troubleshooting
Sending on WhatsApp instead
To send the same personalised message on WhatsApp, replace the Messaging nodes with an Integration node using WhatsApp Business Cloud. Unless the customer has messaged you in the last 24 hours, WhatsApp only accepts approved templates, so use Send Template Message and pass the name as a template variable. The Form to WhatsApp message guide shows the settings.
Next steps
Collecting data
Collect validated answers from customers in a chatbot with the Form node, save them to a data store, and choose the right tool for USSD and the web.
Handling errors
Add input checks, retries and failure paths to a USSD order-tracking flow, so callers always get a useful screen when something goes wrong.