Skip to main content

Overview

Automations are item-level triggers that execute immediately when a checklist item is answered. They enable real-time responses to inspection findings without waiting for submission completion. Key Characteristics:
  • Immediate execution: Triggers fire as soon as an answer matches conditions
  • Item-level scope: Each automation is attached to a specific checklist item
  • Single condition: Evaluates one condition per automation
  • Multiple actions: Can trigger multiple actions from a single condition
For multi-condition logic that evaluates across multiple items, see Checklist Workflows.

Action Types

Automations support five action types:
ActionDescriptionUse Case
FOLLOW_UP_QUESTIONShow additional questions based on answerDrill-down questions for “No” answers
FLAGCreate a flag/issue automaticallyMark safety violations for review
TASKAuto-create a taskImmediate corrective actions
NOTIFICATIONSend alerts (email, SMS, push, WhatsApp)Alert managers of critical findings
IMAGERequire photo captureDocument evidence for flagged items

Condition Operators

OperatorDescriptionExample
eqEqualsAnswer equals “No”
notNot equalsAnswer is not “Pass”
ltLess thanScore less than 70
lteLess than or equalScore at most 50
gtGreater thanTemperature above 100
gteGreater than or equalRating at least 4
btwBetween (inclusive)Value between 10 and 20
nbtwNot betweenValue outside 10-20 range
containsContains substringNotes contain “urgent”
not_containsDoes not containNotes don’t contain “N/A”
is_emptyIs null/emptyNo answer provided
is_not_emptyHas valueAnswer was provided

Create Automations

Create one or more automations for checklist items.
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/automations" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}" \
  -H "Content-Type: application/json" \
  -d '{
    "automations": [
      {
        "EntityId": "checklist-item-uuid",
        "ChecklistId": "template-uuid",
        "entityType": "checklistItem",
        "conditions": [
          {
            "logic": "eq",
            "value": "no"
          }
        ],
        "actions": [
          {
            "type": "FLAG",
            "data": {
              "flagCategoryId": "safety-violation-category-uuid"
            }
          },
          {
            "type": "NOTIFICATION",
            "data": {
              "email": {
                "enabled": true,
                "recipients": ["[email protected]"]
              },
              "push": {
                "enabled": true,
                "recipients": ["manager-user-uuid"]
              }
            }
          }
        ]
      }
    ]
  }'
Request Body:
FieldTypeRequiredDescription
automationsarrayYesArray of automation configurations
automations[].EntityIdstringYesChecklist item ID to attach automation to
automations[].ChecklistIdstringYesTemplate ID
automations[].entityTypestringYesType identifier (use checklistItem)
automations[].operatorstringNoLogic operator for multiple conditions (AND/OR)
automations[].conditionsarrayYesTrigger conditions
automations[].conditions[].logicstringYesCondition operator
automations[].conditions[].valueanyYesValue to compare against
automations[].actionsarrayYesActions to execute
automations[].actions[].typestringYesAction type
automations[].actions[].dataobjectNoAction-specific configuration
Response:
{
  "status": "success",
  "code": 200,
  "data": [
    {
      "id": "automation-uuid",
      "EntityId": "checklist-item-uuid",
      "ChecklistId": "template-uuid",
      "entityType": "checklistItem",
      "conditions": [...],
      "actions": [...],
      "createdAt": "2024-12-20T10:00:00Z"
    }
  ]
}

Action Configuration Examples

Flag Action

Automatically flag items for review.
{
  "type": "FLAG",
  "data": {
    "flagCategoryId": "category-uuid",
    "flagNote": "Auto-flagged: Non-compliant answer detected"
  }
}

Notification Action

Send multi-channel notifications.
{
  "type": "NOTIFICATION",
  "data": {
    "email": {
      "enabled": true,
      "recipients": ["[email protected]", "[email protected]"]
    },
    "sms": {
      "enabled": true,
      "recipients": ["+1234567890"]
    },
    "push": {
      "enabled": true,
      "recipients": ["user-uuid-1", "user-uuid-2"]
    },
    "whatsapp": {
      "enabled": false,
      "recipients": []
    }
  }
}

Task Action

Auto-create a corrective action task.
{
  "type": "TASK",
  "data": {
    "taskTemplateId": "task-template-uuid",
    "priority": "High",
    "assignToSubmitter": true
  }
}

Follow-up Question Action

Show additional questions based on answer.
{
  "type": "FOLLOW_UP_QUESTION",
  "data": {
    "questions": [
      {
        "id": "followup-item-uuid",
        "required": true
      }
    ]
  }
}

Image Capture Action

Require photo documentation.
{
  "type": "IMAGE",
  "data": {
    "required": true,
    "minCount": 1,
    "maxCount": 5
  }
}

Get Automations

Get Automations for a Checklist

curl -X GET "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/checklists/{checklistId}/automations" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}"
Response:
{
  "status": "success",
  "code": 200,
  "data": [
    {
      "id": "automation-uuid-1",
      "EntityId": "item-uuid-1",
      "ChecklistId": "template-uuid",
      "entityType": "checklistItem",
      "conditions": [
        {
          "id": "condition-uuid",
          "logic": "eq",
          "value": "no"
        }
      ],
      "actions": [
        {
          "id": "action-uuid",
          "type": "FLAG",
          "data": {...}
        }
      ]
    },
    {
      "id": "automation-uuid-2",
      "EntityId": "item-uuid-2",
      "ChecklistId": "template-uuid",
      "entityType": "checklistItem",
      "conditions": [...],
      "actions": [...]
    }
  ]
}

Update Automations

To update existing automations, include the id field in the automation object.
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/automations" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}" \
  -H "Content-Type: application/json" \
  -d '{
    "automations": [
      {
        "id": "existing-automation-uuid",
        "EntityId": "checklist-item-uuid",
        "ChecklistId": "template-uuid",
        "entityType": "checklistItem",
        "conditions": [
          {
            "logic": "eq",
            "value": "fail"
          }
        ],
        "actions": [
          {
            "type": "FLAG",
            "data": {
              "flagCategoryId": "updated-category-uuid"
            }
          }
        ]
      }
    ]
  }'

Delete Automations

curl -X DELETE "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/automations" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}" \
  -H "Content-Type: application/json" \
  -d '{
    "automationIds": ["automation-uuid-1", "automation-uuid-2"]
  }'
Response:
{
  "status": "success",
  "code": 200,
  "message": "2 automations deleted successfully"
}

Execute Automation (Internal)

When a checklist item is answered, automations are executed automatically. This endpoint is typically called internally but can be used for testing.
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/automations/checklist-items/{submissionId}/run" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}" \
  -H "Content-Type: application/json" \
  -d '{
    "checklistItem": {
      "id": "item-uuid",
      "answer": "no",
      "type": "yes_no"
    },
    "attachment": [],
    "checklistDefaultLocationId": "location-uuid"
  }'

Common Workflows

Auto-Flag Safety Violations

Conditional Follow-up Questions

When an inspector answers “No” to a compliance question, show follow-up questions to gather more details.
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/automations" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}" \
  -H "Content-Type: application/json" \
  -d '{
    "automations": [{
      "EntityId": "compliance-question-uuid",
      "ChecklistId": "template-uuid",
      "entityType": "checklistItem",
      "conditions": [{
        "logic": "eq",
        "value": "no"
      }],
      "actions": [{
        "type": "FOLLOW_UP_QUESTION",
        "data": {
          "questions": [
            {"id": "reason-question-uuid", "required": true},
            {"id": "corrective-action-question-uuid", "required": true}
          ]
        }
      }, {
        "type": "IMAGE",
        "data": {
          "required": true,
          "minCount": 1
        }
      }]
    }]
  }'

Temperature Alert System

Alert managers when temperature readings exceed thresholds.
curl -X POST "https://api.xenia.team/api/v1/mgt/workspaces/{workspaceId}/automations" \
  -H "x-client-key: YOUR_CLIENT_KEY" \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "workspace-id: {workspaceId}" \
  -H "Content-Type: application/json" \
  -d '{
    "automations": [{
      "EntityId": "temperature-item-uuid",
      "ChecklistId": "food-safety-template-uuid",
      "entityType": "checklistItem",
      "conditions": [{
        "logic": "gt",
        "value": 40
      }],
      "actions": [{
        "type": "FLAG",
        "data": {
          "flagCategoryId": "temperature-violation-uuid"
        }
      }, {
        "type": "NOTIFICATION",
        "data": {
          "sms": {
            "enabled": true,
            "recipients": ["+1234567890"]
          },
          "email": {
            "enabled": true,
            "recipients": ["[email protected]"]
          }
        }
      }, {
        "type": "TASK",
        "data": {
          "taskTemplateId": "temperature-corrective-action-uuid",
          "priority": "High"
        }
      }]
    }]
  }'

Best Practices

Combine actions strategically. For critical issues, use FLAG + NOTIFICATION + TASK together to ensure visibility and action.
Automations work best with single, clear conditions. For complex multi-condition logic, use Checklist Workflows instead.
Create a test submission to verify automations trigger correctly before publishing the template to production.
Define clear flag categories to help managers quickly identify and prioritize issues.
Be selective with notifications. Over-notification can lead to alert fatigue and important issues being missed.
Maintain documentation of what automations exist and why, especially for complex templates with many triggers.

Permissions

ActionRequired Permission
Create/Update automationsCAN_MANAGE_CHECKLIST
Get automations— (read-only)
Delete automationsCAN_MANAGE_CHECKLIST