Contents
The Manual
Integrations
Self hosting
Other
Contexts
Contexts help you connect related events. This is great for jobs, workflows, and multi-step tasks.
How it works:
- First event: set
contextIdandcontextStart: true. - Follow-up events: use the same
contextId.
await ops.events.log({
name: "daily billing sync started",
avatar: "🧾",
contextId: "billing_sync_2026_02_28",
contextStart: true,
});
await ops.events.log({
name: "processed invoices",
contextId: "billing_sync_2026_02_28",
content: "198 invoices processed",
});
await ops.events.log({
name: "daily billing sync finished",
contextId: "billing_sync_2026_02_28",
type: "rows",
content: [
{ label: "Succeeded", content: 194 },
{ label: "Failed", content: 4 },
],
});
Tip: make contextId easy to predict, like job_1234 or signup_user_55.
Choose a stable contextId
contextId is the chain key. Every follow-up event with the same id joins the same context thread.
Good patterns:
billing_sync_<date>signup_<userId>deployment_<releaseId>
Avoid random values for each log call, otherwise events will not chain together.
Another realistic context flow
await ops.events.log({
name: "import started",
avatar: "🤖",
contextId: "import_9834",
contextStart: true
});
await ops.events.log({
name: "validated records",
contextId: "import_9834",
content: "2,101 records validated"
});
await ops.events.log({
name: "import finished",
contextId: "import_9834",
type: "rows",
content: [
{ label: "Inserted", content: 2073 },
{ label: "Rejected", content: 28 }
]
});