Skip to main content

What are Case Automations?

Case Automations allow you to automatically execute actions when specific conditions are met based on case data changes. This enables powerful workflow automation that reduces manual work and ensures consistent processes.

How Automations Work

Automations are triggered by data changes within your case. When data is updated:
  1. The system evaluates each automation’s condition
  2. If the condition evaluates to true, the automation is executed
  3. The specified action is performed
This keeps your cases moving forward automatically without manual intervention.

Viewing Automations in the Case Interface

When automations run, they appear as events in the case timeline, providing full visibility into automated actions.

Timeline Events

Each automation execution creates an event in the timeline showing:
  • Automation name - The name you configured
  • Status - Whether it succeeded or failed
  • Timestamp - When the automation ran
  • Details - Click the event to view full execution details

Managing Automation Events

You can interact with automation events directly from the timeline: View Details
  • Click any automation event to see the complete execution details
  • View request/response data for HTTP actions
  • See error messages if the automation failed
Retry Automations
  • Click on any automation event (succeeded or failed)
  • Use the retry option to re-run the automation
  • Useful for recovering from temporary failures or re-sending webhooks
This visibility ensures you always know what actions have been taken automatically and can intervene when needed.

Defining Automations

Each automation in your Case Template is configured with:
{
  "automations": [
    {
      "key": "auto_escalate_overdue",
      "name": "Escalate when overdue",
      "watch": ["data.days_overdue"],
      "condition": {":cmp": "{data.days_overdue}", ":ge": 5},
      "action": {
        "type": "http",
        "options": {
          "method": "POST",
          "url": "https://api.example.com/escalate",
          "headers": {"Authorization": "Bearer YOUR_TOKEN"},
          "body": {
            "case_id": "{workflow.id}",
            "days_overdue": "{data.days_overdue}"
          }
        }
      }
    }
  ]
}

Automation Properties

Key (required)
  • Unique identifier for the automation
  • Format: lowercase letters, numbers, underscores
  • Max 120 characters
  • Example: auto_escalate, send_reminder, update_status
Name (required)
  • Display name for the automation
  • Shown in logs and audit trails
  • Example: “Auto-escalate overdue cases”
Watch (optional)
  • Array of data keys to monitor for changes
  • Format: data.* (e.g., data.amount, data.approval_status)
  • When specified, the condition is only evaluated if one of these keys changed
  • Improves performance by avoiding unnecessary condition evaluations
Condition (required)
  • JSON expression that evaluates to true or false
  • Uses Penbox expression syntax
  • Only evaluated when watched data changes (or on all changes if watch is not specified)
  • Supports JSON expression operators with comparison, logical, and existence checks
Action (required)
  • The action to perform when the condition is met
  • Currently supports HTTP requests (see Action Types below)

Action Types

HTTP Action

Performs an HTTP request to an external system or webhook.
{
  "type": "http",
  "options": {
    "method": "POST",
    "url": "https://api.example.com/webhook",
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer YOUR_TOKEN"
    },
    "body": {
      "case_id": "{workflow.id}",
      "status": "{workflow.status}",
      "customer_email": "{data.email}",
      "amount": "{data.amount}"
    }
  }
}
HTTP Properties:
  • method (required): GET, POST, PUT, PATCH, or DELETE
  • url (required): Full URL to send the request to
  • headers (optional): Object of HTTP headers
  • body (optional): Request body (only for POST, PUT, PATCH)
Supported Methods:
  • POST - Create or process data
  • PUT - Replace data
  • PATCH - Update data
  • GET - Retrieve data
  • DELETE - Remove data

Common Use Cases

Auto-escalate Overdue Cases

Automatically escalate cases that haven’t been updated in a certain timeframe:
{
  "key": "escalate_overdue",
  "name": "Escalate overdue cases",
  "watch": ["data.days_since_update"],
  "condition": {":cmp": "{data.days_since_update}", ":ge": 3},
  "action": {
    "type": "http",
    "options": {
      "method": "POST",
      "url": "https://api.example.com/escalate",
      "body": {
        "workflow_id": "{workflow.id}",
        "escalation_level": "urgent"
      }
    }
  }
}

Update External System

Sync case data to an external CRM or system whenever specific fields change:
{
  "key": "sync_crm",
  "name": "Sync case to CRM",
  "watch": ["data.customer_status", "data.contact_email"],
  "condition": {":defined": "{data.customer_status}"},
  "action": {
    "type": "http",
    "options": {
      "method": "PATCH",
      "url": "https://crm.example.com/contacts/{data.crm_id}",
      "body": {
        "status": "{data.customer_status}",
        "last_contact_email": "{data.contact_email}",
        "updated_at": "{_now}"
      }
    }
  }
}

Webhook for Custom Logic

Send case data to a webhook for custom processing:
{
  "key": "process_approval",
  "name": "Process when approved",
  "condition": {":cmp": "{data.approval_status}", ":eq": "approved"},
  "action": {
    "type": "http",
    "options": {
      "method": "POST",
      "url": "https://lambda.example.com/process",
      "body": {
        "workflow_id": "{workflow.id}",
        "data": "{data}"
      }
    }
  }
}

Advanced Topics

Available Variables

In your automation conditions and action bodies, you can access:
  • {workflow.id} - Case ID
  • {workflow.status} - Current case status
  • {workflow.parent_status} - Parent status (draft, pending, in_progress, closed)
  • {data.*} - Any case data fields
  • {_now} - Current timestamp

Error Handling

If an automation action fails:
  1. The error is logged with the automation details
  2. The case continues to process normally
  3. No data is lost or rolled back
  4. Future automations continue to be evaluated
It’s recommended to:
  • Use valid URLs and ensure webhook endpoints are stable
  • Implement retry logic on your webhook endpoint if needed
  • Monitor webhook performance and error rates

Best Practices

Always specify which data fields trigger your automation. This prevents unnecessary condition evaluations.Good: Use the watch property to monitor specific fieldsBad: Omitting watch when not needed
Complex nested conditions can be harder to understand and debug. Break down complex logic into multiple automations if needed.
Before deploying to production, verify your conditions work with realistic test cases.
The name should clearly describe what the automation does.Good: Send approval reminder, Sync to CRMBad: Auto 1, Webhook
If using HTTP actions, document what endpoint is called, what headers are required, what the request format is, and what happens on success or failure.
Log automation executions so you can detect failures early, track how often automations run, and optimize or remove unused automations.
Be careful not to create automations that trigger other automations in a loop. Design your workflow to avoid this.