Workflow
Workflow protocol schemas
Trigger events for workflow automation
Source: packages/spec/src/automation/workflow.zod.ts
import { ConnectorActionRef, CustomScriptAction, EmailAlertAction, FieldUpdateAction, HttpCallAction, PushNotificationAction, TaskCreationAction, TimeTrigger, WorkflowAction, WorkflowRule, WorkflowTriggerType } from '@objectstack/spec/automation';
import type { ConnectorActionRef, CustomScriptAction, EmailAlertAction, FieldUpdateAction, HttpCallAction, PushNotificationAction, TaskCreationAction, TimeTrigger, WorkflowAction, WorkflowRule, WorkflowTriggerType } from '@objectstack/spec/automation';
// Validate data
const result = ConnectorActionRef.parse(data);
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| connectorId | string | ✅ | Target Connector ID (e.g. slack, twilio) |
| actionId | string | ✅ | Target Action ID (e.g. send_message) |
| input | Record<string, any> | ✅ | Input parameters matching the action schema |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| language | Enum<'javascript' | 'typescript' | 'python'> | ✅ | Script language |
| code | string | ✅ | Script code to execute |
| timeout | number | ✅ | Execution timeout in milliseconds |
| context | Record<string, any> | optional | Additional context variables |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| template | string | ✅ | Email template ID/DevName |
| recipients | string[] | ✅ | List of recipient emails or user IDs |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| field | string | ✅ | Field to update |
| value | any | ✅ | Value or Formula to set |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| url | string | ✅ | Target URL |
| method | Enum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'> | ✅ | HTTP Method |
| headers | Record<string, string> | optional | HTTP Headers |
| body | string | optional | Request body (JSON or text) |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| title | string | ✅ | Notification title |
| body | string | ✅ | Notification body text |
| recipients | string[] | ✅ | User IDs or device tokens |
| data | Record<string, any> | optional | Additional data payload |
| badge | number | optional | Badge count (iOS) |
| sound | string | optional | Notification sound |
| clickAction | string | optional | Action/URL when notification is clicked |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| taskObject | string | ✅ | Task object name (e.g., "task", "project_task") |
| subject | string | ✅ | Task subject/title |
| description | string | optional | Task description |
| assignedTo | string | optional | User ID or field reference for assignee |
| dueDate | string | optional | Due date (ISO string or formula) |
| priority | string | optional | Task priority |
| relatedTo | string | optional | Related record ID or field reference |
| additionalFields | Record<string, any> | optional | Additional custom fields |
| Property | Type | Required | Description |
|---|
| id | string | optional | Unique identifier |
| timeLength | integer | ✅ | Duration amount (e.g. 1, 30) |
| timeUnit | Enum<'minutes' | 'hours' | 'days'> | ✅ | Unit of time |
| offsetDirection | Enum<'before' | 'after'> | ✅ | Before or After the reference date |
| offsetFrom | Enum<'trigger_date' | 'date_field'> | ✅ | Basis for calculation |
| dateField | string | optional | Date field to calculate from (required if offsetFrom is date_field) |
| actions | Object | Object | Object | Object | Object | Object | Object[] | ✅ | Actions to execute at the scheduled time |
This schema accepts one of the following structures:
Type: field_update
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| field | string | ✅ | Field to update |
| value | any | ✅ | Value or Formula to set |
Type: email_alert
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| template | string | ✅ | Email template ID/DevName |
| recipients | string[] | ✅ | List of recipient emails or user IDs |
Type: http_call
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| url | string | ✅ | Target URL |
| method | Enum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'> | ✅ | HTTP Method |
| headers | Record<string, string> | optional | HTTP Headers |
| body | string | optional | Request body (JSON or text) |
Type: connector_action
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| connectorId | string | ✅ | Target Connector ID (e.g. slack, twilio) |
| actionId | string | ✅ | Target Action ID (e.g. send_message) |
| input | Record<string, any> | ✅ | Input parameters matching the action schema |
Type: task_creation
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| taskObject | string | ✅ | Task object name (e.g., "task", "project_task") |
| subject | string | ✅ | Task subject/title |
| description | string | optional | Task description |
| assignedTo | string | optional | User ID or field reference for assignee |
| dueDate | string | optional | Due date (ISO string or formula) |
| priority | string | optional | Task priority |
| relatedTo | string | optional | Related record ID or field reference |
| additionalFields | Record<string, any> | optional | Additional custom fields |
Type: push_notification
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| title | string | ✅ | Notification title |
| body | string | ✅ | Notification body text |
| recipients | string[] | ✅ | User IDs or device tokens |
| data | Record<string, any> | optional | Additional data payload |
| badge | number | optional | Badge count (iOS) |
| sound | string | optional | Notification sound |
| clickAction | string | optional | Action/URL when notification is clicked |
Type: custom_script
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Action name |
| type | string | ✅ | |
| language | Enum<'javascript' | 'typescript' | 'python'> | ✅ | Script language |
| code | string | ✅ | Script code to execute |
| timeout | number | ✅ | Execution timeout in milliseconds |
| context | Record<string, any> | optional | Additional context variables |
| Property | Type | Required | Description |
|---|
| name | string | ✅ | Unique workflow name (lowercase snake_case) |
| objectName | string | ✅ | Target Object |
| triggerType | Enum<'on_create' | 'on_update' | 'on_create_or_update' | 'on_delete' | 'schedule'> | ✅ | When to evaluate |
| criteria | string | optional | Formula condition. If TRUE, actions execute. |
| actions | Object | Object | Object | Object | Object | Object | Object[] | optional | Immediate actions |
| timeTriggers | Object[] | optional | Scheduled actions relative to trigger or date field |
| active | boolean | ✅ | Whether this workflow is active |
| executionOrder | integer | ✅ | Deterministic execution order when multiple workflows match (lower runs first) |
| reevaluateOnChange | boolean | ✅ | Re-evaluate rule if field updates change the record validity |
on_create
on_update
on_create_or_update
on_delete
schedule