Twilio Lead Speed-to-Contact SMS
When a new lead is created in Dataverse/CRM, the flow instantly texts the lead a personalized greeting via Twilio, assigns the lead to the next available rep, alerts that rep in Teams, and logs the touch. Inbound replies route to the assigned rep. Capitalizes on the first-five-minutes window that drives conversion.
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 capitalizes on the speed-to-lead window using Twilio SMS, Dataverse, and Microsoft Teams. When a new lead row is created in Dataverse, the flow instantly texts the lead a personalized greeting, picks the next available rep via round-robin (least-loaded first), logs the touch on the lead, rebalances the rep's load, and alerts the sales channel in Teams with full lead context. If no rep is available, it raises a no-rep alert so the lead still gets a fast manual follow-up.
Why it matters: Conversion drops sharply with response delay. An immediate, personal text plus instant rep assignment captures interest while it's hot — far faster than a human can react. Built API-first, ships Off; going live needs only connection auth + env var values.
Use Case
A sales team wants every new lead contacted within seconds by SMS and routed to a rep, so no lead goes cold waiting for someone to notice. Reps are kept balanced by a round-robin that always picks the least-loaded available rep.
Flow Architecture
When A New Lead Is Created
Dataverse SubscribeWebhookTrigger (Create, org scope)Fires on every new flowlibs_lead row.
Initialize configuration variables
Initialize VariableSets a guid() correlation id, the configurable company/brand name for the SMS greeting, and the status label written back (Contacted).
List Available Reps
Dataverse ListRecordsAvailable reps ordered by lowest assignedcount (round-robin), top 1.
Process Lead Assignment
Condition (If)Branch on whether an available rep was found. When found: compose the selected rep, send the personalized welcome SMS via Twilio, update the lead record (status, assigned rep, last-touch time, correlation id), increment the rep's assignedcount and stamp lastassignedutc, and notify the assigned rep in Teams. When none: post a no-rep alert to Teams for fast manual follow-up.
Send Welcome SMS
Twilio SendMessageInstant personalized SMS naming the assigned rep (within the round-robin True branch).
Notify / Alert in Teams
Teams PostMessageToConversationAlerts the sales channel with lead + assigned-rep context, or raises a no-rep alert if no rep is available.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TwilioFromNumber | String | +15551234567 | Verified Twilio sender (E.164). |
| flowlibs_TeamsGroupId | String | <your-team-id> | Target Teams team (AAD group id) for alerts. |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Target Teams channel id for alerts. |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Twilio | shared_twilio | SendMessage |
| Microsoft Dataverse | shared_commondataserviceforapps | SubscribeWebhookTrigger ListRecords UpdateRecord |
| Microsoft Teams | shared_teams | PostMessageToConversation |
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.
- Rep pool
- Populate flowlibs_salesrep rows; set flowlibs_availability to Available/Busy. The flow auto-picks the least-loaded available rep.
- Business hours
- Wrap the SMS step in a condition that queues greetings sent outside hours for the next opening.
- Territory routing
- Replace the $orderby assignedcount asc round-robin with a $filter on region/product to assign by territory.
- Greeting copy
- Edit varCompanyName or the Send_Welcome_SMS body template.
- Inbound replies
- Add a Twilio inbound-SMS webhook flow that matches the sender against the lead's assigned rep and forwards the reply (separate flow; not included in this Off demo).
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.01Pick least-loaded rep
Selects the top (least-loaded) available rep.
EXPR.02Rep-available test
True when at least one available rep exists.
EXPR.03Personalized greeting
Builds the personalized welcome SMS body.
EXPR.04Increment rep load
Increments the chosen rep's assigned count.
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.