Skip to main content

Sequence Triggers API

Create and manage sequence triggers that fire when a lead completes a specific series of events within a time window. Use sequence triggers to detect multi-step buying signals like "visited pricing page, then downloaded whitepaper, then requested a demo."

GET /sequences

List all sequence triggers for the active Organizational Unit.

Request

No query parameters required.

Response

200 OK

{
"sequences": [
{
"id": "seq-123",
"name": "Buying Intent Sequence",
"event_types": ["pricing_page_view", "whitepaper_download", "demo_request"],
"window_seconds": 604800,
"window_unit": "7 days",
"ordered": true,
"webhook_url": "https://hooks.example.com/leadvibe",
"emails": ["sales@example.com"],
"active": true,
"created_at": "2025-01-15T10:00:00Z"
}
]
}

Example

curl -X GET "https://api.leadvibe.com/sequences" \
-H "Authorization: Bearer <token>"

Common Errors

StatusMeaningSolution
401UnauthorizedCheck authentication token
500Server ErrorContact support if persists

POST /sequences

Create a new sequence trigger.

Request

ParameterTypeRequiredDescription
namestringYesSequence trigger name
event_typesarrayYesOrdered list of event types that must occur
window_secondsintegerYesTime window in seconds within which all events must occur
window_unitstringNoHuman-readable unit label for display (e.g., "7 days", "24 hours")
orderedbooleanNoWhether events must occur in the specified order (default: false)
webhook_urlstringNoURL to receive the webhook payload when the sequence completes
emailsarrayNoEmail addresses to notify when the sequence completes
email_subjectstringNoCustom subject line for email notifications
email_preheaderstringNoPreheader text for email notifications
email_messagestringNoCustom message body included before lead metadata in the email

Request Body

{
"name": "Buying Intent Sequence",
"event_types": ["pricing_page_view", "whitepaper_download", "demo_request"],
"window_seconds": 604800,
"window_unit": "7 days",
"ordered": true,
"webhook_url": "https://hooks.example.com/leadvibe",
"emails": ["sales@example.com"]
}

Response

201 Created

{
"id": "seq-456",
"name": "Buying Intent Sequence",
"event_types": ["pricing_page_view", "whitepaper_download", "demo_request"],
"window_seconds": 604800,
"ordered": true,
"active": true,
"created_at": "2025-01-15T10:30:00Z"
}

Example

curl -X POST "https://api.leadvibe.com/sequences" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Buying Intent Sequence",
"event_types": ["pricing_page_view", "whitepaper_download", "demo_request"],
"window_seconds": 604800,
"window_unit": "7 days",
"ordered": true,
"webhook_url": "https://hooks.example.com/leadvibe"
}'

Common Errors

StatusMeaningSolution
400Bad RequestMissing required fields or invalid values
401UnauthorizedCheck authentication token

Webhook Payload

When a sequence trigger fires, the webhook receiver gets a JSON payload with the matching events, the event sequence, and metadata about the trigger that fired.

{
"trigger": {
"id": "seq-456",
"name": "Buying Intent Sequence",
"type": "sequence"
},
"lead_id": "ld_123",
"sequence": ["pricing_page_view", "whitepaper_download", "demo_request"],
"events": [
{
"id": "evt-001",
"event_type": "pricing_page_view",
"created_at": "2025-01-10T09:00:00Z"
},
{
"id": "evt-002",
"event_type": "whitepaper_download",
"created_at": "2025-01-12T14:30:00Z"
},
{
"id": "evt-003",
"event_type": "demo_request",
"created_at": "2025-01-14T11:00:00Z"
}
]
}

Payload Fields

FieldTypeDescription
triggerobjectMetadata about the trigger that fired
trigger.idstringUnique trigger identifier
trigger.namestringTrigger name
trigger.typestringAlways "sequence" for sequence triggers
lead_idstringThe lead who completed the sequence
sequencearrayThe ordered list of event types being watched
eventsarrayThe engagement events that satisfied the sequence

Understanding Sequence Logic

Ordered vs. Unordered

  • Ordered (ordered: true): Events must occur in the exact order specified. If a lead downloads a whitepaper before visiting the pricing page, the sequence is not matched.
  • Unordered (ordered: false): All events must occur within the time window, but in any order.

Time Windows

The window_seconds field defines how long the system looks back for matching events:

WindowSecondsTypical Use
1 hour3600Real-time session behavior
24 hours86400Same-day engagement
7 days604800Weekly buying signals
30 days2592000Monthly research patterns

Notes

  • Sequence triggers are OU-scoped like all lead data
  • A sequence fires once per lead per completed sequence
  • All events in the sequence must occur within the window_seconds time frame
  • Provide webhook_url for system-to-system integrations or emails for human notifications (or both)