Skip to main content

Routing & automation

Routing rules, workflow triggers, and global automations (event triggers) — the v2 manager configuration surface for "when X, route/do Y". Available as mgr.routing, mgr.triggers, and mgr.automations (with mgr.Routing / mgr.Triggers / mgr.Automations in Go and the same snake_case names in Rust).

Routing rules

mgr.routing / mgr.Routing / mgr.routing/api/v2/routings.

for await (const r of mgr.routing.list()) console.log(r.id);
const created = await mgr.routing.create({ /* RestCreateRoutingBody */ });
await mgr.routing.update(created.item.id, { /* RestUpdateRoutingBody */ });
await mgr.routing.delete(created.item.id);

Triggers

mgr.triggers / mgr.Triggers / mgr.triggers/api/v2/triggers. CRUD plus clone and test.

const created = await mgr.triggers.create({ /* RestCreateTriggerBody */ });
const copy = await mgr.triggers.clone(created.item.id);
const result = await mgr.triggers.test({ /* TestTriggersRequest */ }); // testMode defaults to true

Global automations

mgr.automations / mgr.Automations / mgr.automations — event triggers at /api/v2/events/triggers.

for await (const a of mgr.automations.list()) console.log(a.id);
const created = await mgr.automations.create({ /* RestCreateGlobalAutomationBody */ });
await mgr.automations.delete(created.item.id);

Trigger metadata, conditions & bulk actions

Triggers also expose the expression/operator catalogs, per-trigger conditions and uses, bulk actions, and (for event triggers / automations) clone, dispatch, and bulk update/delete. Queues expose their attached triggers.

const expressions = await mgr.triggers.expressions();
const operators = await mgr.triggers.operators();
const conditions = await mgr.triggers.conditions(triggerId);
await mgr.triggers.setConditions(triggerId, { /* TriggerConditionsRequest */ });
const uses = await mgr.triggers.uses(triggerId);
await mgr.triggers.bulkAction("enable", [id1, id2]);

const cloned = await mgr.automations.clone(eventTriggerId);
await mgr.automations.dispatch(eventTriggerId, { simulateCall: true });
await mgr.automations.bulkDelete([id1, id2]);

const queueTriggers = await mgr.queues.listTriggers(queueId);

Reference