Using Webhook can I able to detect either room is ...
# ask-ai
b
Using Webhook can I able to detect either room is active or not so I can mark session as active or complete for telephny?
t
Thanks for reaching out, Dhruvil. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You can reliably use LiveKit webhooks to detect whether a room is active or not, making them suitable for marking a session as active or complete in telephony scenarios. • room_started: Triggered when a room begins—use this to mark the session as active. • room_finished: Triggered when a room ends—use this to mark the session as complete. Each event includes precise timing data so you can accurately track session status and transitions. For more granular details, you may also use participant_joined and participant_left events for participant-level tracking. All events are reliably sequenced and retried by the webhook system, ensuring accurate room/session state in your backend or billing logic. Sources: Webhooks | LiveKit Docs | pkg/telemetry/telemetryservice.go
b
Can I get room id as well? @alert-easter-19258
t
Hey there! Great question. Yep, whenever room_started or room_finished webhook events happen, they'll always include the room ID. You can easily grab it from the
room.sid
field in the webhook payload – super straightforward! Let me show you a quick example of what a
room_started
event looks like:
Copy code
{
  "event": "room_started",
  "room": {
    "sid": "RM_TkVjUvAqgzKz",
    "name": "mytestroom",
    ...
  }
}
See that
sid
? That's your unique room identifier. And the best part is, this works the same way for
room_started
,
room_finished
, and other participant-related webhook events. Hope this helps clarify things! Sources: Webhooks | LiveKit Docs | protobufs/livekit_analytics.proto | src/test/kotlin/io/livekit/server/WebhookReceiverTest.kt