Add room-scoped webhook configuration - #1
Open
Darshak03 wants to merge 1 commit into
Open
Conversation
Rooms can currently only be observed through the globally configured webhook URLs. Egress already supports per-resource webhooks by carrying a `repeated WebhookConfig webhooks` on the request that created it and deriving notify options from it at emit time; this applies the same shape to rooms. - CreateRoomRequest.webhooks lets an API caller attach webhooks to a single room, and RoomConfiguration.webhooks does the same for a named room preset. - RoomInternal.webhooks persists the resolved list. It is the analogue of EgressInfo.Request: server-side state that travels with the resource. The public Room proto deliberately does not carry it, since entries hold signing keys and Room is returned by ListRooms. - webhook.GetRoomNotifyOptions mirrors egress.GetEgressNotifyOptions, turning a room's webhook list into a WithExtraWebhooks option. It lives in the webhook package rather than a new one because the event constants are already there and a `room` package would collide with the ubiquitous `room` variable at the call sites. Only room, participant and track events are delivered to room webhooks. Egress, ingress and agent events are excluded by an allowlist: those resources carry their own webhook config, so forwarding them here would both duplicate delivery and leak beyond the room's scope. No new delivery machinery is needed. DefaultNotifier.QueueNotify already fans out to the static URLs first and then to each extra webhook, resolving SigningKey through the KeyProvider and honouring per-webhook FilterParams.
Darshak03
force-pushed
the
room-webhooks
branch
from
September 7, 2026 19:20
ab50a46 to
dcc0838
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rooms can currently only be observed through the globally configured webhook URLs — there is no way to send one room's events to its own endpoint. This adds that, following the shape egress already uses for per-resource webhooks.
Branched off
a4f4b5c(the commitlivekit-servercurrently pins), so the diff is just this change.How egress does it today
repeated WebhookConfig webhookssits on the request proto (StartEgressRequest,RoomCompositeEgressRequest, …).EgressInfo.Request), so the config is available at every event, not just the one that created the resource.egress/notify_options.goderives[]webhook.NotifyOptionfrom that state.opts...intoQueueNotify.The room analogue
RoomCompositeEgressRequest.webhooksCreateRoomRequest.webhooks(field 16)RoomConfiguration.webhooks(field 13), for named presetsEgressInfo.RequestRoomInternal.webhooks(field 9)egress.GetEgressNotifyOptionswebhook.GetRoomNotifyOptionsRoomInternalis the right carrier: it is server-side state that already persists with the room, exactly likeEgressInfo.Request. The publicRoomproto deliberately does not get the field — entries hold signing keys andRoomis returned byListRooms.The helper lives in
webhookrather than a newroompackage: the event constants are already there, and a package namedroomcollides with the ubiquitousroomvariable at the call sites in the server.Event scope
Only room, participant and track events reach a room webhook —
room_started,room_finished,participant_joined,participant_left,participant_connection_aborted,track_published,track_unpublished.Egress, ingress and agent events are excluded by an allowlist. Those resources carry their own webhook config on the request that created them, so forwarding them to a room webhook would both duplicate delivery and leak beyond the room's scope.
No new delivery machinery
DefaultNotifier.QueueNotifyalready fans out to the static config URLs first and then to each extra webhook, resolvingSigningKeythrough theKeyProviderand honouring per-webhookFilterParams. This change only supplies the option.Codegen
Regenerated with the full twirp batch from
magefile.gosolivekit_room.twirp.gokeeps itstwirpFileDescriptor5slot. Files whose only diff was theprotocversion string were reverted, so the diff is limited to the three files that actually changed.Tests
webhook/room_notify_options_test.go— every room-level event produces the option and round-trips the webhook list throughNotifyParams; every egress/ingress/agent event producesnil; a room with no webhooks producesnil.The consuming server-side change is a separate PR.