agentlyleads docs
Workflows API

The Workflow object

A workflow watches one record type and runs its actions when a trigger fires and every condition matches. It is the same object you build under Automations in the app.

FieldTypeNotes
idstringRead-only
namestringUp to 80 characters
entitystringLEAD, CONTACT, DEAL, EMAIL (inbound mail) or TASK. Fixed after creation
triggerstringSee the table below. Fixed after creation
activebooleanPaused workflows never run
conditionsarrayFilters on the record. All must match
triggerConfigobject or nullSettings for STALLED and TIME_IN_STAGE
actionsarrayWhat to do, in order
runCountintegerHow many records the workflow has run on
createdAt, updatedAtstring (ISO 8601)Read-only

Triggers

TriggerRecord typesFires when
CREATEDAllA record is created, or for EMAIL an inbound message arrives. The only trigger for EMAIL and TASK
STATUS_CHANGEDLEADThe lead's status changes
STAGE_CHANGEDDEALThe deal moves to another stage
REPLY_RECEIVEDCONTACTThe contact replies
STALLEDDEALAn open deal has had no activity for triggerConfig.idleDays days (default 10)
TIME_IN_STAGEDEALA deal has sat in triggerConfig.stage (any open stage if omitted) for triggerConfig.days days (default 7)

Conditions

Each condition is { "field", "op", "value" }. value is always a string and comparisons ignore case.

opMatches when
eqThe field equals value
neqThe field does not equal value
containsThe field contains value
olderThanDaysThe date in the field is more than value days ago

Actions

typeFieldsNotes
CREATE_TASKtitle, dueInDays, priority (LOW/MEDIUM/HIGH), assignToOwnerLinked to the record
ADD_TAGtag (a name) or tagIdA new name creates the tag. Stored by name. Not for tasks
ASSIGN_ROUND_ROBINnoneSkipped when the record already has an owner. Not for tasks
SET_FIELDfield: "status", valueLeads: NEW, WORKING, QUALIFIED, UNQUALIFIED, CONVERTED. Contacts: NEW, ACTIVE, CUSTOMER, DORMANT. Inbound email: OPEN, CLOSED. Deals and tasks have no status
SEND_EMAILtemplateSubject, templateBody, mode (DRAFT default, or SEND)DRAFT puts the email in the approval queue. Suppressed addresses are never emailed
NOTIFYtarget, title, bodytarget is "owner", a user ID, or an email address
ENROLL_IN_SEQUENCEsequenceIdThe sequence must be active

Templates can use {{name}}, {{email}}, {{company}}, {{title}} and {{when}}.

Example object

{
  "id": "cmq5wflo0alk34567890",
  "name": "Chase stuck proposals",
  "entity": "DEAL",
  "trigger": "TIME_IN_STAGE",
  "active": true,
  "conditions": [{ "field": "value", "op": "neq", "value": "0" }],
  "triggerConfig": { "stage": "PROPOSAL", "days": 14 },
  "actions": [
    { "type": "NOTIFY", "target": "owner", "title": "{{title}} has been in Proposal for two weeks" },
    { "type": "CREATE_TASK", "title": "Follow up on proposal", "dueInDays": 1, "assignToOwner": true }
  ],
  "runCount": 12,
  "createdAt": "2026-09-01T15:04:00.000Z",
  "updatedAt": "2026-09-20T09:12:00.000Z"
}

On this page