AI Training10 min read

How to Build AI-Powered Automated Workflows for Customer Support

Create multi-step AI procedures that execute autonomously during conversations — collect customer information, call external APIs, create tickets, branch on conditions, and require agent approval for sensitive actions like refunds.

SupportHQ Team·

AI Procedures let you define multi-step workflows that your AI agent executes autonomously during conversations. Instead of just answering questions, your agent can collect information, look up orders, process refunds, create tickets, and more — all without human intervention (unless you want approval gates).

How Procedures Work

A procedure is a sequence of steps that the AI follows when a customer's request matches the procedure's trigger description. Here's the lifecycle:

  1. Trigger — the AI recognizes a customer request matches a procedure (e.g., "I want a refund")
  2. Execute — the AI runs through the steps: sending messages, collecting input, calling APIs, branching on conditions
  3. Pause — if a step requires user input or agent approval, the procedure pauses and resumes when ready
  4. Complete — the procedure finishes, and the conversation continues normally

Creating a Procedure

Navigate to Settings → AI Procedures and click Add Procedure. You'll fill in these fields:

Display Name

A human-readable name for the procedure (e.g., "Refund Request Handler"). This appears in the dashboard and agent approval panel.

Name (Slug)

Auto-generated from the display name. Lowercase with hyphens only (e.g., refund-request-handler). Must be unique within your account. This is the internal identifier the AI uses.

Trigger Description

This is the most important field. It tells the AI when to run this procedure. Write it as a clear instruction, for example:

  • "When a customer asks for a refund or mentions returning a product"
  • "When a customer wants to check their order status"
  • "When a visitor asks about enterprise pricing and wants to talk to sales"

Description

An optional internal note for your team describing what this procedure does and any context. Visitors don't see this.

The Step Types

After creating a procedure, you'll build it using the visual editor. Drag step types from the left sidebar onto the canvas, then configure each one. Here are all seven step types:

1. Message

Sends a text message to the customer. Use {{variable_name}} to insert collected data.

  • Field: Message content (supports variable interpolation)

Example: "Thanks, {{customer_name}}! Let me look up order #{{order_id}} for you."

2. Collect Input

Pauses the procedure and asks the customer a question. Their answer is saved in a variable for later steps.

  • Variable Name — where to store the answer (e.g., customer_email)
  • Prompt — the question to ask (e.g., "What's your email address?")
  • Validation — optional input format:
    • Text — any non-empty text (default)
    • Email — must be a valid email address
    • Phone — must be a valid phone number
    • Number — must be a valid number

If the visitor's input fails validation, the prompt repeats until they provide a valid answer.

3. Condition

Branches the workflow based on a variable's value. Think of it as an if/else gate.

  • Variable — the variable to check (supports dot notation, e.g., order_data.eligible)
  • Operator — how to compare:
    • equals / contains — string comparison
    • gt / lt / gte / lte — numeric comparison
    • exists / not_exists — check if variable has a value
  • Value — the expected value to compare against
  • Then step — which step to jump to if true
  • Else step — which step to jump to if false

Example: If order_data.eligible equals true, go to step 5 (process refund). Otherwise, go to step 7 (explain policy).

4. API Call

Calls an external API and stores the response in a variable. This is how your AI connects to your backend systems.

  • URL — the endpoint to call (supports variables: https://api.example.com/orders/{{order_id}})
  • Method — GET, POST, PUT, PATCH, or DELETE
  • Body Template — JSON body for POST/PUT requests (supports variables)
  • Response Variable — where to store the API response
  • Approval Level — see "Approval Levels" below

Alternatively, you can reference a pre-configured AI Action by its ID instead of specifying a URL directly.

5. Internal Action

Performs a built-in system action. These are the available actions:

ActionWhat It DoesParameters
Create Ticket Opens a support ticket with the details collected during the procedure subject, description, email, name, priority (LOW, MEDIUM, HIGH, URGENT)
Create Lead Captures the visitor as a lead in your Leads dashboard email, name, phone, company, message
Send Email Sends an email notification to, subject, body
Resolve Session Marks the current chat session as resolved (none)
Tag Session Adds a tag to the current chat session for categorization tag

All parameters support {{variable}} interpolation.

6. Set Variable

Assigns a value to a variable. Useful for composing messages, setting defaults, or transforming data between steps.

  • Variable Name — the variable to set
  • Value — the value to assign (supports interpolation)

Example: Set summary to "Refund for order #{{order_id}}, reason: {{refund_reason}}"

7. Escalate

Immediately transfers the conversation to a human agent. The procedure ends and the customer sees your escalation message.

  • Reason — the message shown to the customer (e.g., "This request requires manual review. An agent will assist you shortly.")

Approval Levels

API Call and Internal Action steps support three approval levels to control how much autonomy the AI has:

  • Auto — the step executes immediately with no human oversight. Best for low-risk read-only operations like looking up an order.
  • Notify — the step executes immediately, but an agent is notified in real-time. Good for actions you want visibility into without slowing things down.
  • Require Approval — the procedure pauses and waits for an agent to approve or reject before executing. Essential for sensitive actions like processing refunds, modifying accounts, or sending emails.

When a step requires approval, agents see it in their Approvals panel with the action description, procedure name, and all collected variables. They can approve to continue or reject with a reason (which escalates the conversation to a human agent).

Publishing and Testing

Procedures have three statuses:

  • Draft — editing mode. The AI cannot see or trigger draft procedures.
  • Active — published and available. The AI will trigger this procedure when a customer's request matches.
  • Archived — soft-deleted. No longer visible to the AI or in the active list.

Before publishing, use the Simulate button to test your procedure. Simulation runs through all steps with mock API responses and pre-defined inputs — no real API calls are made and no real tickets are created. It's a safe way to verify your flow before going live.

When you publish, the system validates that every step is correctly configured (required fields filled, condition branches point to valid steps, etc.). If validation fails, you'll see a specific error message pointing to the problem step.

Example: Refund Request Handler

Here's a complete procedure that handles refund requests end-to-end:

  1. Message — "I can help you with a refund. Let me gather some information."
  2. Collect Input — Ask for order number (order_id, text validation)
  3. Collect Input — Ask for reason (refund_reason, text validation)
  4. API Call — GET https://api.yoursite.com/orders/{{order_id}}, store in order_data, approval: Auto
  5. Condition — If order_data.refundable equals true, go to step 6. Otherwise, step 8.
  6. Internal Action — Create Ticket with subject "Refund: Order #{{order_id}}", priority HIGH, approval: Require
  7. Message — "Your refund request has been submitted (Ticket #{{ticketId}}). We'll process it within 2 business days."
  8. Escalate — "This order isn't eligible for a refund under our policy. Let me connect you with an agent who can review your case."

Example: Lead Qualification

A procedure that qualifies and captures leads from chat:

  1. Message — "I'd love to learn more about what you're looking for!"
  2. Collect Input — Ask for name (name, text)
  3. Collect Input — Ask for email (email, email validation)
  4. Collect Input — Ask for company size (company_size, number)
  5. Condition — If company_size gte 50, go to step 6. Otherwise, step 8.
  6. Internal Action — Create Lead with all fields, approval: Notify
  7. Message — "Thanks, {{name}}! Our sales team will reach out within 24 hours."
  8. Internal Action — Create Lead with all fields, approval: Auto
  9. Message — "Thanks, {{name}}! Check your inbox — we'll send you a link to get started."

Example: Order Status Lookup

A simple read-only procedure:

  1. Collect Input — Ask for order number (order_id, text)
  2. API Call — GET https://api.yoursite.com/orders/{{order_id}}/status, store in status, approval: Auto
  3. Message — "Your order #{{order_id}} is currently: {{status.state}}. Estimated delivery: {{status.eta}}."

Tips

  • Write clear trigger descriptions — the AI matches customer requests to procedures based on this text. Be specific: "When a customer asks for a refund" is better than "Refund stuff".
  • Use Require Approval for anything destructive — refunds, account changes, email sends. Auto is fine for read-only lookups.
  • Always simulate first — test the full flow before publishing. Check that conditions branch correctly and variables pass through.
  • Keep procedures focused — one procedure per task. A 20-step mega-procedure is harder to debug than three smaller ones.
  • Use Set Variable for complex messages — compose a summary variable first, then use it in a Message step. Cleaner than a message with 10 variables inline.
  • Version your procedures — each publish increments the version number. If something breaks, you can review what changed.

Permissions

Creating, editing, publishing, and archiving procedures requires an Admin or Owner role. All agents can view procedures and handle approval requests.

Tags:ai workflow automationautomated customer support workflowschatbot proceduresai agent approval workflowno-code support automationai ticket creation workflow