I'm experiencing an issue where the `room_finished...
# ask-ai
c
I'm experiencing an issue where the
room_finished
webhook is not being triggered after a standard participant leaves the room, and I would like to clarify the exact conditions under which this webhook should fire.Our Setup: 1. When we create a LiveKit room, we configure the following participants:Standard participants (regular users joining via client SDK) 2. Ingress participant (identity: "ingress", WHIP input streaming video/audio from our avatar engine) 3. Agent (dispatched via
CreateAgentDispatchRequest
) The Problem: 1. When a standard user clicks "Leave Room" in the client application:The client calls
room.disconnect()
successfully 2. The
DisconnectButton
from
@livekit/components-react
triggers properly 3. The client sends
LeaveRequest
with
DisconnectReason.CLIENT_INITIATED
4. The standard participant leaves the room However, the room remains active and the
room_finished
webhook is never triggered, even though no standard participants remain in the room. Our webhook handler is set up correctly and receives other events (we've tested with manual room deletion). The webhook handler includes cleanup logic to delete ingresses, agents, and terminate EC2 instances - but this cleanup never executes because the webhook doesn't fire. 1. Does the
room_finished
webhook trigger only when ALL participant types (Standard + Ingress + Agent) leave?
◦ Or should it trigger when all standard participants leave, regardless of ingress/agent presence?
t
Thanks for reaching out, Phong. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to help explain how the
room_finished
webhook works! This webhook is triggered when a room ends, which happens after the last participant has left the room. This includes everyone—standard participants, ingress participants, and agents. The room won't end until all participants have disconnected. Also, the
departure_timeout
setting plays a role here. By default, it's set to 20 seconds, so the webhook will trigger about 20 seconds after the last participant leaves. This gives a little buffer time in case someone reconnects. If you notice your ingress or agent participants are still connected, the room will stay active, and the webhook won’t fire just yet. You might want to double-check that these participants have disconnected to make sure the
room_finished
webhook triggers as expected. Please feel free to reach out if you'd like some guidance on managing participant disconnections or adjusting the
departure_timeout
setting—I’m here to help! Sources: Server-Side SDKs & Authentication | livekit/livekit_composite | DeepWiki | config-sample.yaml | protobufs/livekit_analytics.proto | Webhook & Event System | livekit/livekit_composite | DeepWiki | Webhooks | LiveKit Docs