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:
- Trigger — the AI recognizes a customer request matches a procedure (e.g., "I want a refund")
- Execute — the AI runs through the steps: sending messages, collecting input, calling APIs, branching on conditions
- Pause — if a step requires user input or agent approval, the procedure pauses and resumes when ready
- 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 comparisongt/lt/gte/lte— numeric comparisonexists/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:
| Action | What It Does | Parameters |
|---|---|---|
| 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:
- Message — "I can help you with a refund. Let me gather some information."
- Collect Input — Ask for order number (
order_id, text validation) - Collect Input — Ask for reason (
refund_reason, text validation) - API Call — GET
https://api.yoursite.com/orders/{{order_id}}, store inorder_data, approval: Auto - Condition — If
order_data.refundableequalstrue, go to step 6. Otherwise, step 8. - Internal Action — Create Ticket with subject "Refund: Order #{{order_id}}", priority HIGH, approval: Require
- Message — "Your refund request has been submitted (Ticket #{{ticketId}}). We'll process it within 2 business days."
- 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:
- Message — "I'd love to learn more about what you're looking for!"
- Collect Input — Ask for name (
name, text) - Collect Input — Ask for email (
email, email validation) - Collect Input — Ask for company size (
company_size, number) - Condition — If
company_sizegte50, go to step 6. Otherwise, step 8. - Internal Action — Create Lead with all fields, approval: Notify
- Message — "Thanks, {{name}}! Our sales team will reach out within 24 hours."
- Internal Action — Create Lead with all fields, approval: Auto
- Message — "Thanks, {{name}}! Check your inbox — we'll send you a link to get started."
Example: Order Status Lookup
A simple read-only procedure:
- Collect Input — Ask for order number (
order_id, text) - API Call — GET
https://api.yoursite.com/orders/{{order_id}}/status, store instatus, approval: Auto - 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.