Twilio WhatsApp Order and Shipping Updates
Sends rich order and shipping updates over WhatsApp via Twilio when order milestones change in Dataverse, using approved message templates, and routes inbound WhatsApp replies into a Dataverse support case with an email fallback. Reaches customers on the messaging app they use most, with full delivery tracking.
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 solution delivers rich order and shipping updates over WhatsApp using Twilio's WhatsApp channel, and routes inbound customer replies into a Dataverse support case. It is built as two cloud flows + three Dataverse tables in one solution.
Why it matters: In many markets WhatsApp is the primary messaging app. Reaching customers there - with two-way replies and an email fallback - beats SMS or email alone for engagement, while Twilio handles the channel plumbing. Every notification is logged for delivery tracking, and a shared correlation id ties the outbound journey and inbound replies together.
Built and shipped Off (demo). Going live requires only authorizing the three connections, setting the environment-variable values, seeding the order table, and pointing the Twilio WhatsApp sender's inbound webhook at Flow B's URL.
Use Case
A business with international or WhatsApp-first customers wants order/shipping notifications and two-way support over WhatsApp, driven from order milestone changes in Dataverse. When a milestone changes (Confirmed -> Packed -> Shipped -> Out for Delivery -> Delivered), the customer gets a WhatsApp message (or an email if they have not opted in). When the customer replies, a support case is opened or updated and the support team is emailed.
Flow Architecture
Flow A: When Order Milestone Changes
Dataverse SubscribeWebhookTrigger (Update, Org scope, filter flowlibs_ordermilestone)Outbound notifier; fires only when the milestone column changes
Initialize + Get Order
Initialize Variable + Dataverse GetItemCorrelation id (guid), tracking URL base; reads the full order (phone, email, opt-in, milestone, tracking #)
Compose milestone message
ComposePicks the approved template for the milestone, substitutes the order #, appends the tracking link for shipping milestones
Check WhatsApp OptIn
IfOpted-in and has a number -> WhatsApp; else -> email
Send WhatsApp Update (opted in)
Twilio SendMessage (whatsapp: prefix) + Dataverse Create/UpdateSends the update over WhatsApp, logs the notification, stamps the order row
Send Email Fallback (not opted in)
Outlook SendEmailV2 + Dataverse Create/UpdateSame update by email, logs the notification, stamps the order row
Flow B: When a WhatsApp Reply Arrives
Request (Twilio inbound webhook, form-encoded)Inbound reply-to-case handler
Find / thread case
Dataverse ListRecords + IfOpen case for this number -> append (UpdateRecord); else -> create a new WA-xxxxxxxx case (CreateRecord)
Notify Support Email
Outlook SendEmailV2Emails the support mailbox with the reply
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TwilioWhatsAppNumber | String | whatsapp:+14155238886 | Twilio WhatsApp-enabled sender (whatsapp:+E164) |
| flowlibs_WhatsAppTemplateMap | String | {"Confirmed":"Order {{order}} confirmed.","Shipped":"Order {{order}} has shipped."} | Approved WhatsApp template text per milestone (JSON map; {{order}} placeholder) |
| flowlibs_WhatsAppOrderTable | String | flowlibs_whatsapporder | Order table logical name (drives the trigger) |
| flowlibs_WhatsAppCaseTable | String | flowlibs_whatsappsupportcases | Support-case entity set name (ListRecords) |
| flowlibs_SupportNotifyEmail | String | support@your-tenant.onmicrosoft.com | Mailbox notified on inbound replies |
| flowlibs_TrackingUrlBase | String | https://track.example.com/ | Carrier tracking URL prefix |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Twilio | shared_twilio | SendMessage |
| Microsoft Dataverse | shared_commondataserviceforapps | SubscribeWebhookTrigger GetItem ListRecords CreateRecord UpdateRecord |
| 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.
- Milestone templates
- Edit flowlibs_WhatsAppTemplateMap (JSON: milestone -> message). Use {{order}} as the order-number placeholder. Add languages by maintaining one approved template per language.
- SMS fallback
- To fall back to SMS instead of email for non-WhatsApp customers, point the else-branch at Twilio SendMessage with the SMS sender env var.
- Media messages
- Attach a shipping label or map by adding the media URL parameter to the Twilio send.
- Notify channel
- Swap the inbound Notify Support Email for a Teams post if the team lives in Teams.
- Milestone column
- The trigger filters on flowlibs_ordermilestone; change the filteringattributes to fire on a different column.
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.01WhatsApp recipient
Prefixes the customer phone for the WhatsApp channel
EXPR.02Template for milestone
Looks up the approved template; {{order}} replaced by the order number
EXPR.03Opt-in test
Opted-in (and non-empty phone) routes to WhatsApp
EXPR.04Case threading filter
Finds an open case for this number
EXPR.05TwiML auto-reply
Instant WhatsApp acknowledgment
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.