MiroTalk LK webhooks
The app can notify other systems (CRM, billing, chat bots, automation tools...) when a meeting starts or ends, when a recording is finished and when a live stream ends. Set the receiving URLs in .env:
# .env
WEBHOOK_URLS=https://example.com/hooks/mirotalk # comma-separated
WEBHOOK_SECRET=<random string, ≥ 16 chars in production> # e.g. openssl rand -hex 32
# WEBHOOK_EVENTS=room.started,room.ended,recording.finished,stream.finished # default: all
LiveKit is the source of truth: it posts its room_started, room_finished and egress_ended events to the app (POST /api/webhooks/livekit, signed with the LiveKit API key), which turns them into the events below and forwards them to every URL. So meetings that close on their own (everyone left, empty_timeout) and recordings that stop with the meeting are reported too. The bundled setups already point LiveKit at the app (livekit.yaml, docker-compose.turn.yml, docker-compose.dev.yml and npm run livekit:dev); if you change PORT, change the URL in livekit.yaml too. With LiveKit Cloud, add https://<your app>/api/webhooks/livekit as a webhook in the project settings.
Each event is a JSON POST:
// room.started
{ "id": "EV_…", "event": "room.started", "timestamp": "2026-01-01T10:00:00.000Z",
"room": { "name": "team-sync", "sid": "RM_…", "startedAt": "2026-01-01T10:00:00.000Z" } }
// room.ended (duration in seconds)
{ "id": "EV_…", "event": "room.ended", "timestamp": "2026-01-01T10:45:00.000Z",
"room": { "name": "team-sync", "sid": "RM_…", "startedAt": "2026-01-01T10:00:00.000Z",
"endedAt": "2026-01-01T10:45:00.000Z", "duration": 2700 } }
// recording.finished (method: server = LiveKit Egress, client = recorded in the host's browser and uploaded;
// status: complete, failed, aborted or limit_reached, or partial for an upload cut short;
// location is the local path or S3 URL – s3://bucket/key for client uploads)
{ "id": "EV_…", "event": "recording.finished", "timestamp": "2026-01-01T10:30:00.000Z",
"room": { "name": "team-sync", "sid": "RM_…" },
"recording": { "id": "EG_…", "method": "server", "status": "complete", "error": null,
"startedAt": "2026-01-01T10:05:00.000Z", "endedAt": "2026-01-01T10:30:00.000Z", "duration": 1500,
"files": [{ "filename": "/out/team-sync-2026-01-01T100500.mp4",
"location": "/out/team-sync-2026-01-01T100500.mp4", "size": 73400320, "duration": 1500 }] } }
// stream.finished (a live stream ended; status: complete when a host ended it or the meeting ended, failed when the
// platform refused or dropped it; the stream URL and key are never included, and URLs in `error` show as <url>)
{ "id": "EV_…", "event": "stream.finished", "timestamp": "2026-01-01T10:40:00.000Z",
"room": { "name": "team-sync", "sid": "RM_…" },
"stream": { "id": "EG_…", "status": "complete", "error": null,
"startedAt": "2026-01-01T10:10:00.000Z", "endedAt": "2026-01-01T10:40:00.000Z", "duration": 1800 } }
- Headers:
X-MiroTalk-Event(event name),X-MiroTalk-Delivery(the eventid),X-MiroTalk-Timestamp(Unix seconds) and, withWEBHOOK_SECRET,X-MiroTalk-Signature: sha256=<hex HMAC-SHA256 of "<timestamp>.<raw body>">. - Verify the signature on the raw body and reject old timestamps (e.g. older than 5 minutes):
JavaScript
const expected = 'sha256=' + crypto.createHmac('sha256', secret).update(`${timestamp}.${rawBody}`).digest('hex'); const valid = crypto.timingSafeEqual(Buffer.from(signature), Buffer.from(expected)); // check lengths first - Answer with any
2xx. Network errors, timeouts (10 s),408,429and5xxare retried after 1 s, 5 s and 30 s; other answers aren't. Delivery is best effort (nothing is queued across restarts), and the same event can arrive twice, so dedupe byid.