ObjectStackObjectStack

Workflow

Workflow protocol schemas

Trigger events for workflow automation

Source: packages/spec/src/automation/workflow.zod.ts

TypeScript Usage

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);

ConnectorActionRef

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
connectorIdstringTarget Connector ID (e.g. slack, twilio)
actionIdstringTarget Action ID (e.g. send_message)
inputRecord<string, any>Input parameters matching the action schema

CustomScriptAction

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
languageEnum<'javascript' | 'typescript' | 'python'>Script language
codestringScript code to execute
timeoutnumberExecution timeout in milliseconds
contextRecord<string, any>optionalAdditional context variables

EmailAlertAction

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
templatestringEmail template ID/DevName
recipientsstring[]List of recipient emails or user IDs

FieldUpdateAction

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
fieldstringField to update
valueanyValue or Formula to set

HttpCallAction

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
urlstringTarget URL
methodEnum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'>HTTP Method
headersRecord<string, string>optionalHTTP Headers
bodystringoptionalRequest body (JSON or text)

PushNotificationAction

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
titlestringNotification title
bodystringNotification body text
recipientsstring[]User IDs or device tokens
dataRecord<string, any>optionalAdditional data payload
badgenumberoptionalBadge count (iOS)
soundstringoptionalNotification sound
clickActionstringoptionalAction/URL when notification is clicked

TaskCreationAction

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
taskObjectstringTask object name (e.g., "task", "project_task")
subjectstringTask subject/title
descriptionstringoptionalTask description
assignedTostringoptionalUser ID or field reference for assignee
dueDatestringoptionalDue date (ISO string or formula)
prioritystringoptionalTask priority
relatedTostringoptionalRelated record ID or field reference
additionalFieldsRecord<string, any>optionalAdditional custom fields

TimeTrigger

Properties

PropertyTypeRequiredDescription
idstringoptionalUnique identifier
timeLengthintegerDuration amount (e.g. 1, 30)
timeUnitEnum<'minutes' | 'hours' | 'days'>Unit of time
offsetDirectionEnum<'before' | 'after'>Before or After the reference date
offsetFromEnum<'trigger_date' | 'date_field'>Basis for calculation
dateFieldstringoptionalDate field to calculate from (required if offsetFrom is date_field)
actionsObject | Object | Object | Object | Object | Object | Object[]Actions to execute at the scheduled time

WorkflowAction

Union Options

This schema accepts one of the following structures:

Option 1

Type: field_update

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
fieldstringField to update
valueanyValue or Formula to set

Option 2

Type: email_alert

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
templatestringEmail template ID/DevName
recipientsstring[]List of recipient emails or user IDs

Option 3

Type: http_call

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
urlstringTarget URL
methodEnum<'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'>HTTP Method
headersRecord<string, string>optionalHTTP Headers
bodystringoptionalRequest body (JSON or text)

Option 4

Type: connector_action

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
connectorIdstringTarget Connector ID (e.g. slack, twilio)
actionIdstringTarget Action ID (e.g. send_message)
inputRecord<string, any>Input parameters matching the action schema

Option 5

Type: task_creation

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
taskObjectstringTask object name (e.g., "task", "project_task")
subjectstringTask subject/title
descriptionstringoptionalTask description
assignedTostringoptionalUser ID or field reference for assignee
dueDatestringoptionalDue date (ISO string or formula)
prioritystringoptionalTask priority
relatedTostringoptionalRelated record ID or field reference
additionalFieldsRecord<string, any>optionalAdditional custom fields

Option 6

Type: push_notification

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
titlestringNotification title
bodystringNotification body text
recipientsstring[]User IDs or device tokens
dataRecord<string, any>optionalAdditional data payload
badgenumberoptionalBadge count (iOS)
soundstringoptionalNotification sound
clickActionstringoptionalAction/URL when notification is clicked

Option 7

Type: custom_script

Properties

PropertyTypeRequiredDescription
namestringAction name
typestring
languageEnum<'javascript' | 'typescript' | 'python'>Script language
codestringScript code to execute
timeoutnumberExecution timeout in milliseconds
contextRecord<string, any>optionalAdditional context variables


WorkflowRule

Properties

PropertyTypeRequiredDescription
namestringUnique workflow name (lowercase snake_case)
objectNamestringTarget Object
triggerTypeEnum<'on_create' | 'on_update' | 'on_create_or_update' | 'on_delete' | 'schedule'>When to evaluate
criteriastringoptionalFormula condition. If TRUE, actions execute.
actionsObject | Object | Object | Object | Object | Object | Object[]optionalImmediate actions
timeTriggersObject[]optionalScheduled actions relative to trigger or date field
activebooleanWhether this workflow is active
executionOrderintegerDeterministic execution order when multiple workflows match (lower runs first)
reevaluateOnChangebooleanRe-evaluate rule if field updates change the record validity

WorkflowTriggerType

Allowed Values

  • on_create
  • on_update
  • on_create_or_update
  • on_delete
  • schedule

On this page