Triggers
Stewardship triggers automate task creation based on contact filters and execution schedules. When a trigger fires, it identifies matching contacts (applying cooldown and monthly limits), generates AI message variants using a linked prompt template, and creates stewardship tasks for the assigned user.
All endpoints require authentication via the X-API-Key header. See Authentication.
How triggers work
- Filter: The trigger's
conditionsdefine which contacts match (same AND/OR filter logic as boards). - Schedule: The trigger fires on its
executionSchedule(hourly, daily, weekly, or monthly) at the specifiedexecutionTimeand timezone. - Limits: Contacts are excluded if they had a task created within
cooldownDaysor already havemaxTasksPerContactMonthtasks this month. At mostmaxTasksPerRuntasks are created per execution. - AI generation: For each matching contact, the system generates message variants using the linked prompt template (base template merged with any custom overrides).
- Task creation: A stewardship task is created for each contact, assigned to
assignedUserId.
Triggers are scheduled via GCP Cloud Tasks. Status changes and scheduling field updates automatically cancel and reschedule the Cloud Task.
Create a trigger
POST /triggers
Maximum 100 triggers per organization. If status is active, a GCP Cloud Task is scheduled immediately.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
name | string | Yes | |
description | string | Yes | |
category | string | Yes | retention, stewardship, engagement, or custom. |
color | string | Yes | Hex color code. |
status | string | Yes | active or draft. |
priority | string | Yes | Priority level. |
assignedUserId | string | Yes | User ID to assign generated tasks to. |
executionSchedule | string | Yes | hourly, daily, weekly, or monthly. |
executionTime | string | Yes | Time of day in HH:MM format. |
executionTimezone | string | No | IANA timezone (e.g. America/New_York). |
executionDay | number | Conditional | Required for weekly (1–7, Monday=1) or monthly (1–31). Null otherwise. |
maxTasksPerRun | number | Yes | Min 1. Maximum contacts to process per execution. |
cooldownDays | number | Yes | Min 0. Days to wait before re-targeting a contact. |
maxTasksPerContactMonth | number | Yes | Min 1. Monthly cap per contact. |
conditions | object | Yes | Contact filter object (AND/OR criteria). |
promptSettings | object | Yes | { promptTemplateId, customOverrides }. |
createdBy | string | Yes | User ID. |
Example request
Response
Errors
| Status | Message | Cause |
|---|---|---|
| 400 | Validation error | Missing required fields or invalid values. |
| 400 | Max triggers reached | Organization already has 100 triggers. |
List triggers
GET /triggers
Returns triggers sorted by createdAt descending. Each trigger includes the merged prompt template (base template fields merged with promptSettings.customOverrides).
Query parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
status | string | — | Filter: active, paused, draft, error. |
category | string | — | Filter by category. |
priority | string | — | Filter by priority. |
executionSchedule | string | — | Filter: hourly, daily, weekly, monthly. |
Example request
Response
Get a trigger
GET /triggers/:id
Returns the trigger with its merged prompt template.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Trigger ID. |
Example request
Errors
| Status | Message | Cause |
|---|---|---|
| 404 | Not found | Trigger does not exist. |
Update a trigger
PUT /triggers/:id
All fields are optional. If status changes to/from active, or scheduling fields change while active, the GCP Cloud Task is cancelled and rescheduled accordingly.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Trigger ID. |
Request body
All fields from create are accepted as optional. status additionally allows paused and error.
Example request
Response
Returns the updated trigger with merged prompt template.
Errors
| Status | Message | Cause |
|---|---|---|
| 404 | Not found | Trigger does not exist. |
Delete a trigger
DELETE /triggers/:id
Cancels any scheduled GCP Cloud Task.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Trigger ID. |
Example request
Response
Errors
| Status | Message | Cause |
|---|---|---|
| 404 | Not found | Trigger does not exist. |
Response envelope
All endpoints use the standard envelope:
Error responses:
data is null for a general failure, such as a database error or an upstream timeout. When the request is rejected because of a specific field, data carries the field(s) at fault instead:
Each issue carries a path (the dotted path into the request body) and a message. A label is added when the path is not self-describing, which today means custom fields only, for example "path": "fields.68b0a1f39c2e4d0012ab77e5", "label": "Class Year". issues is an array, but treat it as holding at most one entry: validation stops at the first failure.