Skip to main content

Workflows API

Endpoints

MethodEndpointDescription
GET/workflowsList workflows (optional ?module filter)
GET/workflows/:idGet workflow with actions
POST/workflowsCreate workflow
PUT/workflows/:idUpdate workflow
PATCH/workflows/:id/toggleEnable/disable workflow
DELETE/workflows/:idDelete workflow
GET/workflows/:id/runs?page=&limit=Run history
GET/workflows/runs/:runIdRun detail with steps

Workflow Object

{
"id": "uuid",
"name": "Auto-assign new leads",
"description": "Round-robin assignment for inbound leads",
"triggerModule": "leads",
"triggerType": "lead_created",
"triggerFilters": {
"logic": "AND",
"conditions": [
{ "field": "source", "operator": "equals", "value": "website" }
]
},
"isActive": true,
"version": 1,
"actions": [
{
"id": "uuid",
"actionType": "assign_owner",
"config": { "algorithm": "round_robin", "userIds": ["uuid1", "uuid2"] },
"sortOrder": 1
}
]
}

Trigger Events

Leads

lead_created, lead_updated, lead_stage_changed, lead_score_changed, lead_converted, lead_assigned

Contacts

contact_created, contact_updated, contact_assigned

Accounts

account_created, account_updated, account_assigned

Opportunities

opportunity_created, opportunity_updated, opportunity_stage_changed, opportunity_won, opportunity_lost, opportunity_assigned

Tasks

task_created, task_updated, task_overdue, task_completed

Projects

project_created, project_updated, project_status_changed, project_task_overdue, project_completed

Action Types

TypeDescription
assign_ownerAuto-assign record owner
create_taskCreate follow-up task
update_fieldUpdate entity field
add_tagAdd tag to record
send_notificationIn-app notification
send_emailSend email
send_whatsappSend WhatsApp via Twilio
send_smsSend SMS via Twilio
webhookCall external API
waitDelay before next action
branchIf/else conditional split
create_opportunityCreate opportunity from lead
create_projectCreate project from opportunity
add_to_email_listSubscribe contacts to email marketing list
remove_from_email_listRemove contacts from email marketing list

Condition Operators

equals, not_equals, contains, not_contains, starts_with, is_empty, is_not_empty, greater_than, less_than, greater_or_equal, less_or_equal, in, not_in, changed_to, changed_from, any_change

Variable Interpolation

Use {{trigger.fieldName}} in action configs to reference the trigger entity's fields. Both snake_case and camelCase are supported.

Action Config Reference

assign_owner

{
"algorithm": "round_robin",
"pool": ["userId1", "userId2", "userId3"],
"weights": [{"userId": "userId1", "weight": 2}]
}

Algorithms: round_robin, weighted, load_based, territory, skill_match, sticky

create_task

{
"title": "Follow up with {{trigger.firstName}}",
"description": "...",
"assignedTo": "owner",
"dueOffsetDays": 3,
"startOffsetDays": 0,
"estimatedMinutes": 30,
"tags": "follow-up, workflow"
}

assignedTo values: owner (default), trigger_user, specific (with specificUserId)

webhook

{
"url": "https://api.example.com/webhook",
"method": "POST",
"bodyType": "json",
"bodyJson": "{\"leadId\": \"{{trigger.id}}\"}",
"headers": [{"key": "Authorization", "value": "Bearer xxx", "enabled": true}],
"params": [{"key": "source", "value": "crm", "enabled": true}],
"verifySsl": true,
"timeoutSeconds": 30
}

send_email / send_whatsapp / send_sms

{
"to": "record_email",
"subject": "Welcome {{trigger.firstName}}",
"body": "<p>Hello {{trigger.firstName}},</p>",
"cc": "manager@example.com",
"bcc": ""
}

to values: record_email/record_phone, owner_email/owner_phone, or a literal address/number

branch

{
"condition": {
"match": "all",
"items": [
{"field": "score", "operator": "greater_than", "value": "80"}
]
}
}

Child actions use parentActionId + branch: "yes" or branch: "no".

add_to_email_list / remove_from_email_list

{
"listId": "uuid",
"listName": "Newsletter",
"contactSelector": "primary"
}

contactSelector values: primary, all, owner

Run History Endpoints

GET /workflows/:id/runs

Query params: page (default 1), limit (default 25)

Response:

{
"data": [{
"id": "uuid",
"workflowId": "uuid",
"triggerModule": "leads",
"triggerType": "lead_created",
"triggerEntityId": "uuid",
"status": "completed",
"error": null,
"startedAt": "ISO",
"finishedAt": "ISO"
}],
"total": 42,
"page": 1,
"limit": 25
}

GET /workflows/runs/:runId

Response includes steps array:

{
"id": "uuid",
"status": "completed",
"steps": [{
"id": "uuid",
"actionType": "assign_owner",
"status": "completed",
"result": {"assignedUserId": "uuid"},
"error": null,
"startedAt": "ISO",
"finishedAt": "ISO"
}]
}