Docs Automation Rules

Automation Rules

Automation rules let you define workflows that automatically perform actions on tickets when certain conditions are met. For example, you can auto-assign high-priority tickets to a specific department, add tags based on keywords, or close inactive tickets after a period of time.

How Automation Rules Work

Each rule consists of three parts:

  1. Trigger — The event that starts rule evaluation (e.g., ticket created, status changed)
  2. Conditions — Criteria that must be met for the rule to fire (e.g., priority is urgent)
  3. Actions — What happens when the rule fires (e.g., assign to department, send notification)

Rules are evaluated in order of their position field. If a rule's stop_processing flag is true, no subsequent rules are evaluated for that trigger event.

List Automation Rules

GET /api/v1/automation-rules

Returns all automation rules for your tenant, ordered by position.

Query Parameters

Parameter Type Default Description
per_page integer 25 Results per page (max: 100)
cursor string Cursor for next page
is_active boolean Filter by active/inactive status
trigger string Filter by trigger type

Example Response

{
  "data": [
    {
      "id": "01912345-6789-7abc-def0-123456789abc",
      "name": "Route urgent tickets to escalation team",
      "description": "Automatically assigns urgent tickets to the Escalation department",
      "trigger": "ticket_created",
      "conditions": [
        {
          "field": "priority",
          "operator": "equals",
          "value": "urgent"
        }
      ],
      "actions": [
        {
          "type": "assign_department",
          "value": "01912345-1111-7abc-def0-123456789abc"
        },
        {
          "type": "add_tag",
          "value": "escalation"
        }
      ],
      "stop_processing": true,
      "is_active": true,
      "position": 1,
      "last_triggered_at": "2025-01-15T14:30:00Z",
      "execution_count": 247,
      "created_at": "2025-01-10T08:00:00Z",
      "updated_at": "2025-01-15T14:30:00Z"
    }
  ],
  "meta": {
    "per_page": 25,
    "has_more": false,
    "next_cursor": null
  }
}

Create an Automation Rule

POST /api/v1/automation-rules

Request Body

Field Type Required Description
name string Yes Rule name (max 255 chars)
description string No Human-readable description
trigger string Yes Trigger event (see table below)
conditions array Yes Array of condition objects (at least one)
actions array Yes Array of action objects (at least one)
stop_processing boolean No Stop evaluating subsequent rules. Default: false
is_active boolean No Enable the rule immediately. Default: true
position integer No Execution order. Default: appended last

Triggers

Trigger Description
ticket_created Fires when a new ticket is created
ticket_updated Fires when any ticket field is updated
ticket_status_changed Fires when a ticket's status transitions
time_based Fires on a schedule (e.g., tickets idle for X hours)

Condition Operators

Each condition object has a field, operator, and value:

Operator Description Example
equals Exact match {"field": "priority", "operator": "equals", "value": "high"}
not_equals Not equal to {"field": "status", "operator": "not_equals", "value": "closed"}
contains Substring match {"field": "subject", "operator": "contains", "value": "refund"}
not_contains Does not contain {"field": "subject", "operator": "not_contains", "value": "test"}
starts_with Begins with string {"field": "subject", "operator": "starts_with", "value": "RE:"}
ends_with Ends with string {"field": "customer.email", "operator": "ends_with", "value": "@vip.com"}
greater_than Numeric comparison {"field": "hours_since_created", "operator": "greater_than", "value": 24}
less_than Numeric comparison {"field": "hours_since_updated", "operator": "less_than", "value": 2}
in Value in array {"field": "channel", "operator": "in", "value": ["email", "api"]}
not_in Value not in array {"field": "priority", "operator": "not_in", "value": ["low"]}

Available Condition Fields

Field Type Description
status string Ticket status
priority string Ticket priority
channel string Ticket channel (email, api, chat, portal)
subject string Ticket subject text
description string Ticket description text
department_id uuid Assigned department
category_id uuid Assigned category
assigned_to uuid or null Assigned agent
customer.email string Customer's email address
tags array Ticket tags
hours_since_created number Hours since ticket creation (time-based triggers)
hours_since_updated number Hours since last update (time-based triggers)

Action Types

Action Type Value Description
change_status string Transition ticket to a new status
change_priority string Set ticket priority (low, medium, high, urgent)
assign_agent uuid Assign ticket to a specific agent
assign_department uuid Move ticket to a department
add_tag string Add a tag to the ticket
remove_tag string Remove a tag from the ticket
close_ticket null Close the ticket
send_notification object Send a notification (see below)

The send_notification action accepts an object value:

{
  "type": "send_notification",
  "value": {
    "channel": "email",
    "recipient": "assigned_agent",
    "template": "rule_triggered",
    "message": "Urgent ticket requires immediate attention"
  }
}

Example Request

{
  "name": "Auto-close stale waiting tickets",
  "description": "Close tickets that have been waiting on customer for 7+ days",
  "trigger": "time_based",
  "conditions": [
    {
      "field": "status",
      "operator": "equals",
      "value": "waiting_on_customer"
    },
    {
      "field": "hours_since_updated",
      "operator": "greater_than",
      "value": 168
    }
  ],
  "actions": [
    {
      "type": "add_tag",
      "value": "auto-closed"
    },
    {
      "type": "close_ticket",
      "value": null
    }
  ],
  "stop_processing": false,
  "is_active": true
}

Example Response (201 Created)

{
  "data": {
    "id": "01912345-eeee-7abc-def0-123456789abc",
    "name": "Auto-close stale waiting tickets",
    "description": "Close tickets that have been waiting on customer for 7+ days",
    "trigger": "time_based",
    "conditions": [
      {
        "field": "status",
        "operator": "equals",
        "value": "waiting_on_customer"
      },
      {
        "field": "hours_since_updated",
        "operator": "greater_than",
        "value": 168
      }
    ],
    "actions": [
      {
        "type": "add_tag",
        "value": "auto-closed"
      },
      {
        "type": "close_ticket",
        "value": null
      }
    ],
    "stop_processing": false,
    "is_active": true,
    "position": 5,
    "last_triggered_at": null,
    "execution_count": 0,
    "created_at": "2025-01-16T09:00:00Z",
    "updated_at": "2025-01-16T09:00:00Z"
  }
}

Update an Automation Rule

PATCH /api/v1/automation-rules/{rule_id}

Update any fields on an existing rule. Only include the fields you want to change.

Example: Update Conditions

{
  "conditions": [
    {
      "field": "priority",
      "operator": "in",
      "value": ["high", "urgent"]
    }
  ]
}

Delete an Automation Rule

DELETE /api/v1/automation-rules/{rule_id}

Permanently deletes a rule. Returns 204 No Content.

Toggle a Rule

PATCH /api/v1/automation-rules/{rule_id}/toggle

Quickly enable or disable a rule without modifying its configuration.

Example Response

{
  "data": {
    "id": "01912345-eeee-7abc-def0-123456789abc",
    "name": "Auto-close stale waiting tickets",
    "is_active": false,
    "updated_at": "2025-01-16T10:00:00Z"
  }
}

Execution Logging

Every time a rule fires, Tiqora logs the execution. You can view execution history in the dashboard under Settings > Automation Rules > Execution Log. Each log entry includes:

  • The rule that fired
  • The ticket it was applied to
  • The trigger event
  • Which conditions matched
  • Which actions were executed
  • Timestamp of execution

This helps you debug rules and understand how automations affect your ticket flow.

Rule Evaluation Order

Rules are evaluated in ascending position order. When multiple rules share the same trigger:

  1. Rules are evaluated from lowest to highest position
  2. All matching conditions must be true for a rule to fire (AND logic)
  3. If a rule fires and stop_processing is true, remaining rules are skipped
  4. If stop_processing is false, evaluation continues to the next rule

Hint: Use stop_processing: true on high-priority rules to prevent later rules from overriding their actions. For example, a rule that routes urgent security tickets should stop processing so a general routing rule does not reassign them.

Best Practices

  1. Name rules descriptively — Use names that clearly state what the rule does, like "Route billing tickets to Finance" rather than "Rule 3".

  2. Use stop_processing strategically — Enable it on rules that handle critical routing to prevent conflicts with lower-priority rules.

  3. Test with is_active: false — Create rules in a disabled state, review their configuration, then toggle them on when ready.

  4. Keep conditions specific — Broad conditions (e.g., matching all tickets) can cause unexpected bulk actions. Start narrow and expand.

  5. Monitor execution counts — A rule with zero executions may have overly restrictive conditions. A rule with unexpectedly high counts may be too broad.