AI Support Email Triage & Draft Reply
When a support email arrives, Azure OpenAI classifies it (category, urgency, sentiment), generates a suggested reply draft, and posts both to a Teams triage channel with the draft ready to copy. Urgent or angry messages are escalated with an @mention. The model output is constrained to JSON for reliable parsing.
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 puts Azure OpenAI in front of a support mailbox. Each inbound email is sent to a chat-completions deployment with a system prompt that forces a strict JSON response: {category, urgency, sentiment, summary, draft_reply}. The flow parses that JSON, posts a triage card (classification + ready-to-copy draft reply) to a Teams channel, and escalates anything classified Urgent or Negative with a Teams @mention of the escalation user.
Why it matters: Triage is the slowest part of support. An LLM that classifies and pre-drafts in one call lets agents skip straight to reviewing and sending, while keeping a human in the loop for the actual reply. JSON-mode output makes parsing deterministic.
Status: Built as an unmanaged solution, flow shipped Off. Going live requires only authorizing the three connections and setting the seven environment-variable values.
Use Case
A small ops/support team monitoring a support address wants every message auto-categorized, urgency-scored, summarized, and pre-answered so they can clear routine tickets fast — and have angry/urgent ones flagged immediately (via @mention) rather than buried in the queue.
Flow Architecture
When_a_new_support_email_arrives
Outlook OnNewEmailV3 (polling, 3-min, splitOn value array)Fires per new email whose To/Cc matches the support address
Initialize_Urgent_Label
Initialize Variable (string)Configurable urgency label that triggers escalation (default Urgent)
Initialize_Negative_Sentiment_Label
Initialize Variable (string)Configurable sentiment label that triggers escalation (default Negative)
Compose_AI_System_Prompt
ComposeSystem instruction constraining the model to a strict JSON object
Compose_AI_User_Prompt
ComposeBuilds the user message from the email subject, sender, and body preview
Run_AI_Triage
Azure OpenAI ChatCompletions_Create_2024Feb15PreviewClassifies + summarizes + drafts; response_format=json_object, temperature 0.2, max_tokens 800
Compose_AI_Content
ComposeExtracts choices[0].message.content (the JSON text)
Parse_AI_Result
Parse JSONDecodes category, urgency, sentiment, summary, draft_reply
Post_Triage_Card_To_Teams
Teams PostMessageToConversationPosts subject/from + classification + summary + draft reply to the triage channel
Check_If_Escalation_Needed
Condition (If)True when urgency = Urgent OR sentiment = Negative
Environment Variables
| Schema name | Type | Default | Description |
|---|---|---|---|
| flowlibs_AOAIDeployment | String | gpt-4o | Azure OpenAI deployment id (chat model) |
| flowlibs_AOAIApiVersion | String | 2024-02-15-preview | Azure OpenAI REST API version |
| flowlibs_SharedMailboxAddress | String | shared@contoso.com | Support address used as the trigger To/Cc filter |
| flowlibs_SupportInboxFolder | String | Inbox | Mailbox folder polled for incoming support email (new) |
| flowlibs_TeamsGroupId | String | <your-team-id> | Team (group) id of the triage channel |
| flowlibs_TeamsTriageChannelId | String | <your-channel-id> | Triage channel id |
| flowlibs_EscalationUserUpn | String | manager@contoso.com | UPN/email of the user @mentioned on escalation (new) |
Connectors & Connections
| Connector | API name | Actions used |
|---|---|---|
| Office 365 Outlook | shared_office365 | OnNewEmailV3 |
| Azure OpenAI | shared_azureopenai | ChatCompletions_Create_2024Feb15Preview |
| Microsoft Teams | shared_teams | PostMessageToConversation AtMentionUser |
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.
- Auto-reply tier
- Add a category/confidence gate that sends the draft directly for ultra-routine categories (password reset, hours) and only posts to Teams for the rest.
- Grounding (RAG)
- Prepend a SharePoint/Dataverse/Azure AI Search lookup of KB articles and inject them into the system prompt for retrieval-augmented replies.
- PII redaction
- Run the body through Text Analytics PII detection before sending to the model if data-handling rules require it.
- Retune escalation
- Change the varUrgentLabel / varNegativeLabel Initialize Variable values (or the model's label vocabulary in the system prompt) without touching flow logic.
- Dedicated mailbox
- To monitor an actual shared mailbox, swap OnNewEmailV3 for SharedMailboxOnNewEmailV2 (accepts mailboxAddress).
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.01Extract model JSON text
Pulls the model's JSON content string from the chat-completions response.
EXPR.02Escalation gate (If expression)
True when the parsed urgency or sentiment matches an escalation label.
EXPR.03Azure OpenAI JSON mode
Forces the model to return a strict JSON object for deterministic parsing.
EXPR.04@mention in escalation message
Embed the AtMentionUser output directly into the Teams body/messageBody HTML.
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.