Reecall
Automations

Triggers

A Trigger starts a Process each time a System event of its type occurs and its conditions pass. Each start creates a Run. Manage Triggers through the Data API at /automation/triggers.

Create a Trigger

Create the Process first, then link it to a System event type. This Trigger starts the Process when a conversation of one Assistant ends:

TerminalCreate a Trigger
curl https://data.reecall.io/automation/triggers \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer sk_YOUR_API_KEY' \ --data '{ "name": "Call report", "description": "Judge each completed call of the support Assistant", "eventType": "exchange.completed", "processId": "<your-process-id>", "conditions": { "operator": "AND", "conditions": [ { "source": "event.data.assistantId", "filter": "EQUALS", "value": "<your-assistant-id>" } ] } }'

The response is the stored Trigger, with its id and enabled: true. The Trigger applies to System events that occur after you save it.

Fields

FieldTypeRequiredDefaultDescription
namestringNoName shown in lists
descriptionstringNoWhat the Trigger does
eventTypestringYesThe System event type to listen to
processIdstring (UUID)YesThe Process to start. See Scope for the Processes a Trigger can reach.
conditionsobject or nullNonullConditions the System event must pass. null starts the Process on every System event of the type. See Conditions.
inputobject or nullNonullFixed values the Process reads under input. See Input.
retrystring or objectNo"none"Retry policy of the Runs this Trigger starts. See Retry policy.
enabledbooleanNotruefalse stops the Trigger from starting new Runs
projectIdstring (UUID) or nullDepends on the keyThe Project of a project Trigger, or null for an organization Trigger. Cannot change after creation.
organizationIdstring (UUID)Set from the keyCannot change after creation

Scope

A Trigger belongs to one Project or to the whole Organization. The scope sets which System events it receives and which Processes it can start.

ScopeprojectIdReceives the System events ofCan start
ProjectThe Project's IDIts ProjectA Process of its Project, or an organization-level Process
OrganizationnullEvery Project of the OrganizationAn organization-level Process

A project-scoped API key always creates project Triggers in its own Project. It can read the organization Triggers but not change them. An organization-scoped key creates a project Trigger when you set projectId, and an organization Trigger when you leave it out.

A Run belongs to the Project of the System event that started it, whatever the scope of its Trigger. A project-scoped key reads the Runs of an organization Trigger for its own Project only.

Conditions

Conditions use the syntax of a Rule step. Each condition reads a value from the System event with source, applies a filter, and compares the result with value when the filter needs one:

JSONConditions
{ "operator": "AND", "conditions": [ { "source": "event.data.assistantId", "filter": "EQUALS", "value": "8f9c2b1e-4d3a-4c7b-9e6f-1a2b3c4d5e6f" }, { "source": "event.data.duration", "filter": "GREATER_THAN", "value": 30 } ] }
  • operator is AND (default) or OR.
  • conditions holds 1 to 20 conditions.
  • source is a path in event: id, type, occurredAt, refId, organizationId, projectId, and the data fields of the System event type.
  • filter is one of the Rule step filters, such as EQUALS, CONTAINS, GREATER_THAN, EXISTS, or IN.

Check filter names

Reecall does not check filter names when you save a Trigger. A Trigger with a misspelled filter never starts its Process.

Input

input holds fixed values, such as a webhook URL or a language, that the Process reads under input. Reecall passes them as they are, without rendering templates. They override the values of the same name in the Process's defaultContext. See Processes.

Do not put secrets in input. Store them as secret Variables and read them with {{ variables.KEY }}.

Retry policy

Retries are off by default. When a Run fails for a reason that is safe to repeat, such as a 429 or 503 answer, the policy decides whether it runs again:

ValueEffect
"none"No retry
{ "immediate": 2 }Up to 2 retries, right after the failure. From 1 to 3.
{ "delays": ["5m", "1h"] }One retry per delay, after waiting that long. 1 to 3 delays, each in minutes (m) or hours (h), from 1m to 24h.

A retry runs the whole Process again

A retry starts again from the first step. Steps that succeeded before the failure run a second time, and SMS and email steps send their messages again. Turn retries on only for a Process whose steps can safely run twice.

See Retries for the failures that start a retry and the Idempotency-Key header of request steps.

Turn a Trigger off

Set enabled to false to stop new Runs and keep the Trigger:

TerminalTurn a Trigger off
curl --request PATCH https://data.reecall.io/automation/triggers/<trigger-id> \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer sk_YOUR_API_KEY' \ --data '{ "enabled": false }'

Runs already started continue. To stop one, cancel it.

Avoid loops

A Process that writes to the Reecall API can cause new System events. Check that it cannot start its own Trigger again, or add a condition that excludes the records it writes. A Run started by run.failed never announces another run.failed.

Errors

CodeStatusCause
INVALID_TRIGGER400eventType is missing
INVALID_EVENT_TYPE400eventType is not a System event type. The error lists the allowed types.
INVALID_TRIGGER_CONDITIONS400conditions has an unknown key, no condition, more than 20, or a condition without source or filter
INVALID_RETRY_POLICY400retry is not one of the forms above
PROCESS_OUT_OF_REACH400The Process belongs to another Organization or Project, or a Project Process is linked to an organization Trigger
NOT_FOUND404No Process with this ID in reach of the key
READ_ONLY_FIELD400The update changes organizationId or projectId
SCOPE_VIOLATION403A project-scoped key tries to change an organization Trigger
Last modified on