I have an application that can correctly generate events in Google calendar, and now I want to be able to modify any event by generating a Google meet link for it. Ideally I would like to generate Google meet links without any calendar events, but as far as I researched the only way for now is to create it as part of a Google calendar event.
I have followed the steps in https://developers.google.com/calendar/create-events?hl=en_US#java and I came up with the following function:
(defn add-meet-link-to-calendar-event
"Adds a meet link to a calendar event."
[google-ctx calendarId input-event]
(if input-event
(let [calendar-service (build-calendar-service google-ctx)
events (doto (.events ^Calendar calendar-service)
assert)
conf-req-data (doto (CreateConferenceRequest.)
(.setRequestId (generate-random-string))
(.setConferenceSolutionKey (.setType (ConferenceSolutionKey.)
"hangoutsMeet")))
conference-data (doto (ConferenceData.)
(.setCreateRequest conf-req-data)
)
event (doto input-event
(.setConferenceData conference-data)
(.set "conferenceDataVersion" 1)
(.set "sendNotifications" true)
)
eventId (get event "id")
adding-link (.patch events calendarId eventId event)]
(prn "Before executing at add-meet-link-to-calendar-event" calendarId eventId event events)
(.execute adding-link))))
As part of the input event for this function, I'm passing the following output from another function that retrieves the event object from Google calendar:
{"attendees" [{"email" "jjj@company.com",
"responseStatus" "needsAction"}
{"email" "main@company.com",
"organizer" true,
"responseStatus" "accepted",
"self" true}],
"created" #object[com.google.api.client.util.DateTime 0x686d6e12 "2020-10-26T15:27:49.000Z"],
"creator" {"email" "main@company.com",
"self" true},
"end" {"dateTime" #object[com.google.api.client.util.DateTime 0x5a909950 "2020-10-24T22:30:00.000+02:00"]},
"etag" "\"3207454201190000\"",
"htmlLink" "https://www.google.com/calendar/event?eid=M25wb2RtbnNsNWN2N3E3MGVsc2RvYTQwc2ogbmFpaGFAdWJpa2FyZSAAAA",
"iCalUID" "3npodmnsl5cv7q70elsdoaAAAA@google.com",
"id" "3npodmnsl5cv7q70elsdoaAAAA",
"kind" "calendar#event",
"organizer" {"email" "main@company.com", "self" true},
"reminders" {"useDefault" true},
"sequence" 0,
"start" {"dateTime" #object[com.google.api.client.util.DateTime 0x7bcdfc0e "2020-10-24T22:00:00.000+02:00"]},
"status" "confirmed",
"summary" "Another meet test",
"updated" #object[com.google.api.client.util.DateTime 0xd4057 "2020-10-26T15:45:00.595Z"]}
I have tested that values like summary
can be updated so the patch
call seems to work. But even adding the conferenceDataVersion
and the conferenceData
does not seem to make a change in the event.
If I manually change the event in Google calendar I can see that the conference details are added to the event by the way.