loud-byte-53435
10/09/2025, 10:23 AMroomId.
- Track and store participant join/left events.
- Maintain a complete call record for audit and analytics purposes.
### Our requirement:
Whenever a patient books an appointment, we insert a record into the `callLog `table containing the `appointmentId `and the scheduled appointment time. At this stage, the `roomId `is not yet available, as the LiveKit room has not been created
Once the scheduled appointment time arrives and either patient or doctor initiates the call , a LiveKit room is created, At that point, we need to update the existing `callLog `record with the corresponding `roomId `linked to the appointmentId.
*_*We’re considering two potential approaches:*_*
### Option 1:
- After the LiveKit room is auto-created when a call is initiated,
- Update the room metadata with the appointmentId.
- Use a RoomMetadataChanged event to detect this and call our backend API to update the `callLog `table with the `roomId `corresponding to the existing appointmentId.
Note: I have currently implemented the first two steps of Option 1 in our existing flow.### Option 2: - Instead of auto room creation, we manually create the LiveKit room in the backend when the appointment time arrives or when the first participant initiates the call. - While creating the room, we set the metadata with the
appointmentId.
- Use the `room_started `**webhook** from LiveKit to update our `callLog `table with both `appointmentId `and roomId.
### What we’re looking for:
- Is there a recommended or best-practice approach for this kind of mapping (*appointment ↔️ room*)?
- Are there any potential pitfalls with relying on metadata update events vs using the `room_started `**webhook**?
- Is there any better approach to keep appointment and room in sync?
*Any guidance or suggestions would be really helpful 🙏*
Thanks in Advancehigh-flower-44013
10/09/2025, 2:36 PMrapid-ocean-58394
10/29/2025, 10:11 AM