Twilio Inbound SMS to Support Ticket
When a customer texts the support number, a Twilio inbound webhook into an HTTP-triggered flow creates a Dataverse case (or Freshdesk/ServiceNow ticket), sends an auto-acknowledgement with a reference, and posts to a Teams support channel. Subsequent texts from the same number append to the open case. Turns SMS into a tracked support channel.
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 turns Twilio SMS into a tracked support channel. When a customer texts the support number, Twilio posts the inbound message to an HTTP-triggered cloud flow. The flow looks up an open Dataverse case for that phone number: if one exists it appends the new text to the case (updating the last message, incrementing the message count, and adding a line to a running conversation log); if not, it creates a new case. It then sends the customer an SMS acknowledgement with their case reference and posts the message to a Microsoft Teams support channel so an agent can pick it up.
Why it matters: Many customers prefer texting. Capturing inbound SMS as structured, threaded cases gives the support team a trackable queue instead of a phone full of loose texts, and gives the customer an immediate acknowledgement with a reference.
Built by FlowLibs as reference flow CF-511. Ships Off (demo). Going live requires only authorizing the three connections, configuring the environment variables, and pointing the Twilio number's inbound webhook at the flow's HTTP trigger URL.
Use Case
A support team wants customers to be able to text a number for help, with each conversation captured as a case, automatically acknowledged, and made visible to the team in Teams. Repeat texts from the same number thread into the same open case rather than creating duplicates.
Flow Architecture
When a HTTP request is received
Request (Http)Receives the Twilio inbound-SMS webhook (form-encoded From, Body, MessageSid).
Initialize configuration variables
Initialize VariableLoads support number, Teams group/channel ids, case table name, acknowledgement text, and a case-reference holder from environment variables and configurable values.
Find Open Case
Dataverse ListRecordsLooks up an OPEN case for this phone number (flowlibs_phonenumber eq '<from>' and flowlibs_status eq 'Open', top 1).
Condition Existing Case
Condition (If)If an open case exists, set the existing reference and append the message (UpdateRecord: increments count, refreshes timestamp, extends the conversation log). Otherwise compose an SMS-<timestamp> reference and create a new Open case seeded with the first message (CreateRecord).
Send Acknowledgement
Twilio SendMessageTexts the customer back an acknowledgement including their case reference.
Post To Teams
Teams PostMessageToConversationPosts the inbound message + case reference to the support Teams channel.
Respond To Twilio
Response (Http)Returns empty TwiML (HTTP 200) to Twilio; the acknowledgement was already sent via the Twilio API.
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_TwilioFromNumber | String | +15551234567 | Twilio support/sender number (E.164). Customers text it; acknowledgements are sent from it. (reused) |
| flowlibs_TeamsGroupId | String | <your-team-id> | Microsoft Teams group (Team) id of the support channel. (reused) |
| flowlibs_TeamsChannelId | String | <your-channel-id> | Microsoft Teams channel id of the support channel. (reused) |
| flowlibs_SmsCaseTableName | String | flowlibs_smssupportcases | Entity set name of the SMS support case table (documentation/portability). (new this build) |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Twilio | shared_twilio | SendMessage |
| Microsoft Dataverse | shared_commondataserviceforapps | ListRecords CreateRecord 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.
- Agent reply-out
- Add a companion flow that sends agent case replies back to the customer as SMS via Twilio SendMessage.
- Auto-close
- Add a scheduled flow that sets flowlibs_status to Closed after N days of inactivity so future texts open a fresh case.
- Media / MMS
- Handle Twilio NumMedia/MediaUrl0 form fields by archiving attachments to SharePoint and linking them on the case.
- Keyword routing
- Inspect the first message body and route to a different Teams group/channel based on a keyword.
- Ticketing system swap
- Replace the Dataverse case actions with Freshdesk/ServiceNow connector actions to mirror cases into an external ITSM tool.
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.01Inbound from (phone)
Reads the sender phone number from the Twilio webhook form data.
EXPR.02Inbound body
Reads the inbound SMS body.
EXPR.03Existing-case gate
True when an open case already exists for the number.
EXPR.04Open-case OData filter
Threads cases by phone number + open status.
EXPR.05Increment message count
Bumps the running message count on append.
EXPR.06Append to conversation log
Appends a timestamped line to the conversation log.
EXPR.07New case reference
Generates a new case reference.
EXPR.08Acknowledgement text
Builds the acknowledgement SMS including the case reference.
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.