Sequence endpoints
Business rules are in Nurture sequences; schemas in lib/schema/sequences.ts.
Sequence endpoints use page_size, not pageSize.
Templates
GET /api/sequence-templates
page, page_size.
- Filters
-
search,type(onboarding,re_engagement,not_connected_outreach),is_active - Response
-
{ data, total, page, page_size }, each template including its fullstepsarray.
POST /api/sequence-templates
Validated by CreateSequenceTemplateSchema.
{
"name": "Onboarding — 5 touch",
"type": "onboarding",
"goal": "Book a demo",
"description": "…",
"call_campaign_default": false,
"email_campaign_default": true,
"sms_campaign_default": false,
"is_active": true,
"steps": [
{ "channel": "email", "delay_hours": 0, "name": "Intro", "email_tone": "warm", "is_ai_generated": true },
{ "channel": "wait", "delay_hours": 48, "delay_unit": "hours" },
{ "channel": "data_gate",
"delay_hours": 0,
"gate_bigquery_view": "outreach_app.contacts",
"gate_match_mode": "all",
"gate_conditions": [{ "field": "deal_id", "operator": "is_not_null", "value": null }],
"true_branch_step_index": 5,
"gate_retry_delay_hours": 24,
"gate_max_retries": 3 },
{ "channel": "crm_event",
"delay_hours": 0,
"extra_configs": {
"event_type": "Contact.Update",
"body": { "hubspot_contact_id": "{{hubspot_contact_id}}", "last_touch": "{{now}}" }
} }
]
}
Validation rules worth knowing:
-
gate_conditionsoperators areis_not_null,is_null,equals,not_equals,gt,lt,is_in,is_not_in.valuemay be null only for the null checks;is_in/is_not_intake a comma-separated list. -
A
crm_eventstep’sextra_configsmust satisfyCrmEventConfigSchema.event_typemust be one of the registry values, and the reserved keyevent_typeinsidebodyis rejected. -
delay_unitishoursorminutesand is only meaningful forwait.
Enrollments
GET /api/contact-sequences
page, page_size.
- Filters
-
search,status(pending,active,paused,completed,abandoned,exited)
Each row includes contact_name, contact_email, contact_company, template_name,
template_type, current_step_index, total_steps, next_step_at and the lifecycle timestamps.
POST /api/contact-sequences
Validated by EnrollContactSequenceSchema.
{
"contact_id": "uuid",
"template_id": "uuid",
"campaign_id": null,
"campaign_target_id": null,
"email_campaign_target_id": null
}
SequenceExecutionService.enrollContact enforces one active sequence per contact in application
code — a database unique constraint would wrongly block multiple completed or paused enrollments.
GET /api/contact-sequences/{id}
Full detail: the enrollment, its execution_id (the Inngest run id), the template with steps, and the
ContactSequenceStep timeline. Each log entry carries status, outcome, gate_retry_count,
executed_at, the artifact ids (call_id, email_id, follow_up_task_id, activity_id) and the raw
response payload.
POST /api/contact-sequences/{id}/start
Sets the enrollment active and sends sequence/execute, which claims the run by stamping
executionId.