Interventions
React while the person is still in the session: when an event (with event and person property conditions) or an existing action matches, an intervention...
React while the person is still in the session: when an event (with event and person property conditions) or an existing action matches, an intervention fires within seconds to the browser or app that person is using and, if you want, to your webhooks. Caps keep one person from seeing the same intervention too often.
Typical uses: offer help after a checkout error, open a chat after three failed searches, show a discount to a pro-plan visitor who lingers on pricing, tell a CRM when an account hits a usage limit.
Define one (Customers, Interventions)
Field | Default | Meaning |
|---|---|---|
Trigger | - | An event with an optional URL and event or person property conditions (the |
Payload |
| JSON object (at most 8 KB) handed to your callback and the webhook. Event data is never copied in |
Deliver to SDK / webhook | SDK on | Subscribed browsers and apps, webhooks subscribed to |
Fires per person per window | 1 per day |
|
Cooldown | 0 | Minimum gap between two fires for one person |
Deliverable for | 300 s | A fire waits this long for an SDK that connects (or reconnects) after it |
API: GET|POST /v1/projects/{id}/interventions, GET|PUT|DELETE .../interventions/{iid}, recent fires at GET .../interventions/fires?intervention_id=&distinct_id= and a QA fire for one person (skips trigger and caps) at POST .../interventions/{iid}/test {"distinct_id": "..."}.
Receive them in the app
const off = lucida.onIntervention((i) => {
if (i.name === "Rescue checkout") openChat(i.payload);
});Browser and React Native SDKs. The first listener opens GET /v1/interventions/stream?distinct_id= on the gateway (server-sent events, any key kind, after analytics consent). Each fire is delivered once; on reconnect the SDK resumes after the last fire it saw (Last-Event-ID, or ?cursor=). identify and reset reconnect for the new person. Where the platform cannot read a streaming response (React Native) it polls GET /v1/interventions?distinct_id=&cursor= every 15 seconds, which answers {data, next_cursor}; native apps can use the same route.
The fire: {seq, id, intervention_id, name, event, payload, fired_at}. id is stable for a fire (dedupe on it); event is the triggering event ($intervention_test for a test fire).
Webhooks
Subscribe a webhook endpoint (Project settings, Webhooks) to intervention.fired. It receives the usual signed envelope with data: fire_id, intervention_id, intervention, distinct_id, event_uuid, event, payload, fired_at. Delivery is at least once with retries; dedupe on fire_id.
How it works
lc-worker matches every written event against the project's enabled interventions (cached for 30 s). Events older than 10 minutes (imports, backlogs) fire nothing.
For each hit it reads the person's earlier fires of that intervention, applies the cap and cooldown and inserts the fire into
intervention_fires. The fire id comes from the intervention and the event uuid, so a redelivered batch never fires twice. Events are partitioned by distinct id, so one person's fires are decided in order.Each gateway polls new fires once a second (
LC_INTERVENTION_POLL_INTERVAL) and pushes them to the connected SDKs of that person.lc-jobs queues webhook fires on the webhook outbox before every delivery pass (15 s) and deletes fires older than 35 days.
Deleting an intervention expires its undelivered fires at once.