episode.opened
When Signals sends episode.opened, its payload and how to handle it in Node.js, Python and Java.
An episode opens on the first reading that breaches a trigger. Sent only while your tenant has episodicAlerts on; see Events.
Payload
Every delivery is the envelope type, timestamp, sequence and data; the delivery's id is the webhook-id header. See Verify webhooks.
{
"type": "episode.opened",
"timestamp": "2026-10-25T08:00:02.000Z",
"sequence": 1049,
"data": {
"id": "e7a1b2c3-d4e5-4f60-8a9b-0c1d2e3f4a5b",
"patient": "6f1c2a8e-3b7d-4c55-9a0e-2d4b8f6e1a90",
"patientRefId": "resident-001",
"code": "8867-4",
"system": "http://loinc.org",
"display": "Heart rate",
"status": "OPEN",
"openedAt": "2026-10-25T08:00:00.000Z",
"closedAt": null,
"closeReason": null,
"firstObservationRefId": "reading-0001",
"lastObservationRefId": "reading-0001",
"lastAlertId": "0b9d7e52-1f3a-4e8c-b6a2-7c4d9e1f2a35"
}
}| Field | Meaning |
|---|---|
id | The episode. |
patient, patientRefId | The patient, by Signals id and by your own refId. |
code, system, display | The code the episode is about. |
status | OPEN or CLOSED. |
openedAt, closedAt, closeReason | When it opened and closed, and why. null while open. |
firstObservationRefId, lastObservationRefId | The first and latest reading in it, by your refId. |
lastAlertId | The latest alert in it. |
Handle the event
Verify the delivery first (Verify webhooks), then act on the verified event as in Handle an event.
export async function handle(webhookId, event) {
if (!(await firstTime(webhookId))) return;
const { data } = event;
switch (event.type) {
case 'episode.opened':
await openEpisode(data.id, data.patientRefId, data.code);
break;
default:
break;
}
}Related
Last updated on