Add conferenceData entryPoints parsing and full event logging
- Check conferenceData.entryPoints for video meet link - Keep hangoutLink as fallback for backwards compatibility - Log full event response to debug missing meet link - This will show us what Google actually returns
This commit is contained in:
@@ -246,8 +246,31 @@ serve(async (req: Request): Promise<Response> => {
|
||||
|
||||
const eventDataResult = await calendarResponse.json();
|
||||
console.log("Event created:", eventDataResult.id);
|
||||
console.log("Full event response:", JSON.stringify(eventDataResult, null, 2));
|
||||
|
||||
// Update the slot with the meet link
|
||||
// Check if conference data was created
|
||||
if (eventDataResult.conferenceData && eventDataResult.conferenceData.entryPoints) {
|
||||
const meetLink = eventDataResult.conferenceData.entryPoints.find((ep: any) => ep.entryPointType === "video")?.uri;
|
||||
|
||||
if (meetLink) {
|
||||
await supabase
|
||||
.from("consulting_slots")
|
||||
.update({ meet_link: meetLink })
|
||||
.eq("id", body.slot_id);
|
||||
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: true,
|
||||
meet_link: meetLink,
|
||||
event_id: eventDataResult.id,
|
||||
html_link: eventDataResult.htmlLink,
|
||||
}),
|
||||
{ headers: { ...corsHeaders, "Content-Type": "application/json" } }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback to hangoutLink for backwards compatibility
|
||||
if (eventDataResult.hangoutLink) {
|
||||
await supabase
|
||||
.from("consulting_slots")
|
||||
|
||||
Reference in New Issue
Block a user