Skip to main content

Overview

Triggers enable event-driven automation in KaireonAI. When a customer event occurs — a transaction, a profile update, a behavioral signal — a trigger can automatically enroll the customer in a journey, fire a real-time recommendation, call an external webhook, or update customer attributes.

How Triggers Work

Event Source → Trigger Rule → Condition Evaluation → Action Execution
  1. An event arrives from a connected data source (streaming connector, API call, or schema update)
  2. The trigger rule matches events by type and optional filters
  3. Conditions are evaluated to determine if the trigger should fire
  4. The configured action is executed

Runtime Behavior

When an event is received, the engine performs the following sequence:
  1. Event matching — All active trigger rules with a matching eventType are retrieved, ordered by priority (descending).
  2. Condition evaluation — For each matching trigger, the condition object is evaluated against the event payload. Conditions support nested all (AND) and any (OR) groups with field-level operators (eq, neq, gt, gte, lt, lte, in, exists).
  3. Cooldown check — If the trigger has a cooldownMs value greater than zero, the engine checks whether the same trigger has already fired for this customer within the cooldown window. If it has, the trigger is skipped.
  4. Action dispatch — If all conditions pass and the cooldown has not been exceeded, the configured action is dispatched (journey enrollment, recommend call, webhook POST, or attribute update).
  5. Audit logging — Every trigger firing is recorded in the audit log with the trigger ID, customer ID, event type, and action taken.
Multiple triggers can match the same event. They are evaluated in priority order, and each fires independently as long as its own conditions and cooldown are satisfied.

Event Types

Triggers listen for events from your connected data sources:
Event TypeDescription
outcome.recordedAn outcome (impression, click, conversion) was recorded via the Respond API
customer.createdA new customer record was inserted into a schema table
customer.updatedAn existing customer record was modified
segment.enteredA customer entered a segment (met the segment criteria)
segment.exitedA customer exited a segment (no longer meets criteria)
journey.completedA customer completed a journey
offer.expiredAn offer reached its end date
budget.exhaustedAn offer’s budget allocation was fully consumed

Action Types

Action TypeDescription
enroll_journeyEnroll the customer in a specified journey
fire_recommendExecute a Decision Flow and deliver the result immediately
webhookSend an HTTP POST to an external URL with event data
update_attributeUpdate one or more customer attributes in a schema table

enroll_journey

{
  "actionType": "enroll_journey",
  "config": {
    "journeyId": "jrn_loan_nurture",
    "deduplication": "skip_if_active"
  }
}
The deduplication option prevents enrolling a customer who is already active in the same journey. Options: skip_if_active (default), restart, allow_multiple.

fire_recommend

{
  "actionType": "fire_recommend",
  "config": {
    "decisionFlowId": "df_realtime_offers",
    "channelId": "ch_push",
    "limit": 1,
    "deliverImmediately": true
  }
}

webhook

{
  "actionType": "webhook",
  "config": {
    "url": "https://api.yourcompany.com/events/handle",
    "method": "POST",
    "headers": {
      "Authorization": "Bearer {{secret.webhook_token}}"
    },
    "bodyTemplate": {
      "customerId": "{{event.customerId}}",
      "eventType": "{{event.type}}",
      "triggerId": "{{trigger.id}}"
    }
  }
}

update_attribute

{
  "actionType": "update_attribute",
  "config": {
    "schemaId": "schema_customer_profile",
    "updates": [
      { "field": "last_event_date", "value": "{{event.timestamp}}" },
      { "field": "event_count", "expression": "event_count + 1" }
    ]
  }
}

Cooldown Mechanics

Each trigger has a configurable cooldown period (cooldownMs, in milliseconds) to prevent rapid re-firing for the same customer. How cooldown works:
  1. When a trigger fires for a customer, the engine records the firing timestamp.
  2. On the next matching event for the same customer, the engine checks if now - lastFiredAt < cooldownMs.
  3. If the cooldown has not elapsed, the trigger is silently skipped for that customer. The event is not queued for later — it is dropped.
  4. The cooldown is per-customer, per-trigger. Customer A’s cooldown does not affect Customer B.
Cooldown ValueBehavior
0No cooldown; fires on every matching event
60000 (1 min)At most once per minute per customer
3600000 (1 hr)At most once per hour per customer
86400000 (24 hr)At most once per day per customer
Without a cooldown, high-frequency events (e.g., page views, transaction streams) can cause a trigger to fire hundreds of times per customer. Always set an appropriate cooldown.

Priority

When multiple triggers match the same event, they are executed in priority order:
PriorityValue RangeDescription
Critical90-100Compliance and regulatory triggers
High70-89Revenue-critical automations
Medium40-69Standard engagement triggers
Low1-39Background/informational triggers

Worked Example

A retail bank wants to trigger a real-time recommendation whenever a customer completes a purchase over $500:
1

Event arrives

The Respond API records an outcome.recorded event for customer cust_78 with outcomeType: "conversion" and metadata.amount: 750.
2

Trigger matches

The engine finds the “High-Value Purchase” trigger with eventType: "outcome.recorded" and priority: 75.
3

Condition evaluates

The trigger’s condition is checked: { "all": [{ "field": "metadata.amount", "operator": "gt", "value": 500 }] }. The event’s amount (750) is greater than 500, so the condition passes.
4

Cooldown check

The trigger has cooldownMs: 86400000 (24 hours). The last firing for cust_78 was 3 days ago, so the cooldown has elapsed.
5

Action dispatches

The fire_recommend action executes Decision Flow df_cross_sell with channelId: "ch_push" and maxOffers: 1. The customer receives a personalized push notification with a cross-sell offer.

Field Reference

FieldTypeRequiredDefaultDescription
namestringYesTrigger name (min 1 character)
descriptionstringNo""Human-readable description
eventTypestringYesEvent type to listen for (see Event Types table)
conditionobjectNo{}Nested condition groups with all/any logic and field-level operators
actionTypeenumYesOne of: enroll_journey, fire_recommend, webhook, update_attribute
actionConfigobjectNo{}Action-specific configuration (see Action Types section)
prioritynumberNo50Execution priority (0-100, higher = first)
cooldownMsnumberNo0Minimum milliseconds between firings for the same customer
statusenumAutoactiveTrigger status: active, paused, disabled

Condition Operators

OperatorDescriptionExample
eqEquals{ "field": "eventType", "operator": "eq", "value": "conversion" }
neqNot equals{ "field": "channel", "operator": "neq", "value": "sms" }
gtGreater than{ "field": "amount", "operator": "gt", "value": 500 }
gteGreater than or equal{ "field": "score", "operator": "gte", "value": 0.8 }
ltLess than{ "field": "age", "operator": "lt", "value": 30 }
lteLess than or equal{ "field": "count", "operator": "lte", "value": 5 }
inValue in list{ "field": "tier", "operator": "in", "value": ["gold", "platinum"] }
existsField exists{ "field": "email", "operator": "exists" }

Creating a Trigger

1

Navigate to Triggers

Go to Studio > Triggers in the sidebar.
2

Click Create Trigger

Click the + New Trigger button.
3

Name and describe

Enter a name and description for the trigger.
4

Select event type

Choose the event type that will activate this trigger.
5

Define conditions (optional)

Add filter conditions to narrow when the trigger fires (e.g., metadata.amount > 500).
6

Select action type

Choose the action: enroll in journey, fire recommendation, call webhook, or update attribute.
7

Configure action

Fill in the action-specific configuration (journey ID, Decision Flow, webhook URL, etc.).
8

Set cooldown and priority

Configure the cooldown period and execution priority.
9

Save and enable

Save the trigger. Toggle it to enabled when ready.

API Reference

Create a Trigger

POST /api/v1/triggers
Content-Type: application/json
Request body:
{
  "name": "High-Value Purchase Cross-Sell",
  "description": "Fire real-time recommendation after a purchase over $500",
  "eventType": "outcome.recorded",
  "condition": {
    "all": [
      { "field": "metadata.amount", "operator": "gt", "value": 500 },
      { "field": "outcomeType", "operator": "eq", "value": "conversion" }
    ]
  },
  "actionType": "fire_recommend",
  "actionConfig": {
    "decisionFlowId": "df_cross_sell",
    "channelId": "ch_push",
    "limit": 1,
    "deliverImmediately": true
  },
  "cooldownMs": 86400000,
  "priority": 75
}
Response (201 Created):
{
  "id": "trg_high_value_purchase",
  "name": "High-Value Purchase Cross-Sell",
  "eventType": "outcome.recorded",
  "actionType": "fire_recommend",
  "cooldownMs": 86400000,
  "priority": 75,
  "status": "active",
  "createdAt": "2026-03-10T14:30:00Z",
  "updatedAt": "2026-03-10T14:30:00Z"
}

List Triggers

GET /api/v1/triggers?status=active&eventType=outcome.recorded&limit=50&offset=0
Query parameters:
ParameterTypeDefaultDescription
statusstringallFilter by trigger status
eventTypestringallFilter by event type
limitnumber50Page size (max 200)
offsetnumber0Pagination offset

Update a Trigger

PUT /api/v1/triggers/:id

Delete a Trigger

DELETE /api/v1/triggers/:id

Enable/Disable a Trigger

Use the update endpoint to change a trigger’s status:
PUT /api/v1/triggers/:id
Content-Type: application/json

{ "status": "paused" }
Allowed status transitions: active to paused or disabled, paused to active or disabled, disabled to active.

Next Steps

Journeys

Build multi-step workflows that triggers can enroll customers into.

Runs

Execute Decision Flows in batch for campaign delivery.