Twilio Order Status SMS Notifications
When an order's status changes in Dataverse (confirmed, shipped, out for delivery, delivered), the flow texts the customer a concise update with a tracking link via Twilio, respecting their opt-in and preferred timing. Logs each notification. Keeps customers informed on the channel they actually check.
Provided as-is, without warranty of any kind. Review and test each pattern in a non-production environment before deploying it to live automations. See our Terms.
Overview
This flow keeps customers informed about their orders over Twilio SMS. When an order's status changes in Dataverse (Confirmed, Shipped, Out for Delivery, Delivered), it texts the customer a concise update with a tracking link — respecting their SMS opt-in — falls back to Outlook email when the customer hasn't opted in or has no mobile on file, and writes an audit row for every notification.
Why it matters: Customers check SMS far more than email for time-sensitive updates. Proactive, opt-in status texts reduce "where's my order?" inquiries and improve the post-purchase experience.
Build status: Built and verified (Flow Checker 0 errors / 0 warnings). Ships Off — going live requires only authorizing the three connections and setting the environment variable values.
Use Case
A retail / operations team wants automatic, opt-in SMS order updates at each fulfillment milestone, each carrying a tracking link, with an email fallback and a delivery log for auditing.
Flow Architecture
When Order Status Changes
Dataverse SubscribeWebhookTrigger (Modify, filtered to flowlibs_orderstatus)Fires only when an order's status column changes.
Initialize configuration variables
Initialize VariableSets a guid() correlation id and loads the configurable milestone-status list, the JSON status→message template map, and the fallback tracking-URL base.
Get Order Details
Dataverse GetItemReads phone, email, opt-in, and tracking link by row id.
Compose tracking link & message
ComposeBuilds the tracking link (order's stored link, or base URL + order number) and the customer message from the template + link.
Check Notify Status
ConditionOnly notify for milestone statuses; otherwise log a skipped audit row (Dataverse CreateRecord).
Check SMS Opt-In
Condition (nested)If the customer opted in and has a mobile, send the SMS via Twilio SendMessage and log an SMS audit row; otherwise send an Outlook email fallback (SendEmailV2) and log an Email audit row.
Log Notification
Dataverse CreateRecordWrites an audit row (channel = SMS / Email / None) for every outcome.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TwilioFromNumber | String | +15551234567 | Verified Twilio sender (reused across FlowLibs). |
| flowlibs_OrderTableName | String | flowlibs_smsorder | Logical name of the order table the trigger watches. |
| flowlibs_OrderNotifyStatuses | String | Confirmed,Shipped,Out for Delivery,Delivered | Statuses that warrant a customer notification. |
| flowlibs_StatusMessageMap | String | JSON map | Status → message template (uses {order} placeholder). |
| flowlibs_TrackingUrlBase | String | https://your-org.com/track/ | Base used to build a tracking link when none is on file. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Twilio | shared_twilio | SendMessage |
| Microsoft Dataverse | shared_commondataserviceforapps | SubscribeWebhookTrigger GetItem CreateRecord |
| Office 365 Outlook | shared_office365 | SendEmailV2 |
Note — All connections are referenced as solution connection references; the flow is portable between environments as long as a connection is mapped at import time.
Customization Guide
Almost every realistic variant of this flow can be implemented by changing environment variable values. A few cases require small edits inside the flow definition — those are called out explicitly below.
- Quiet hours / preferred timing
- Gate Send_Order_SMS behind a time-window check (e.g. only send between 8am–8pm in the customer's time zone), queuing otherwise.
- Send via Twilio's WhatsApp channel for richer updates by changing the from/to to whatsapp: addresses.
- Delivery webhook
- Add a second flow that receives Twilio status callbacks and patches the matching log row's Result.
- Localized
- Translate the composed message to the customer's language before sending.
- Status set
- Edit flowlibs_OrderNotifyStatuses and flowlibs_StatusMessageMap to add or reword milestones without touching flow logic.
Key Expressions
The flow is intentionally light on Power Fx / WDL gymnastics — the heaviest expressions are the branch-name concatenation and the approval outcome check. They are listed below in the order they appear in the flow.
EXPR.01Milestone gate
Only notify for configured milestone statuses.
EXPR.02Opt-in gate
Send SMS only when opted in and a mobile is on file.
EXPR.03Message build
Builds the customer message from the template + tracking link.
EXPR.04Tracking link
Uses the stored link, else builds one from the base URL.
EXPR.05Trigger row id
Row id of the changed order for the GetItem read.
Customize & download
Generate a ready-to-import copy of this solution with your environment-variable values baked in — available on Base, Pro, or Team.
Upgrade to customize
Comments
Sign in to join the conversation.
Sign inNo comments yet. Be the first to share your experience with this flow.