0

I am working on a spring boot api which schedules events for me but and its working fine but along with events I want to add a meet link too and I am not able to do that.I am using a service account from cloud console and shared my personal account with this service account.How can I implement google meet?

Here's my code:

Event event = new Event()
                    .setSummary("Google I/O 2015")
                    .setLocation("800 Howard St., San Francisco, CA 94103")
                    .setDescription("A chance to hear more about Google's developer products.");
            ConferenceSolutionKey conferenceSKey = new ConferenceSolutionKey();
            conferenceSKey.setType("hangoutsMeet");
            CreateConferenceRequest createConferenceReq = new CreateConferenceRequest();
            createConferenceReq.setRequestId("adojajaod"); // ID generated by you

            createConferenceReq.setConferenceSolutionKey(conferenceSKey);
            ConferenceData conferenceData = new ConferenceData();
            conferenceData.setCreateRequest(createConferenceReq);

            System.out.println(conferenceData);
            event.setConferenceData(conferenceData);


            DateTime startDateTime = new DateTime("2021-08-14T09:00:00-07:00");
            EventDateTime start = new EventDateTime()
                    .setDateTime(startDateTime)
                    .setTimeZone("America/Los_Angeles");
            event.setStart(start);

            DateTime endDateTime = new DateTime("2021-08-15T17:00:00-07:00");
            EventDateTime end = new EventDateTime()
                    .setDateTime(endDateTime)
                    .setTimeZone("America/Los_Angeles");
            event.setEnd(end);

            String[] recurrence = new String[]{"RRULE:FREQ=DAILY;COUNT=2"};
            event.setRecurrence(Arrays.asList(recurrence));

            EventReminder[] reminderOverrides = new EventReminder[]{
                    new EventReminder().setMethod("email").setMinutes(24 * 60),
                    new EventReminder().setMethod("popup").setMinutes(10),
            };
            Event.Reminders reminders = new Event.Reminders()
                    .setUseDefault(false)
                    .setOverrides(Arrays.asList(reminderOverrides));
            event.setReminders(reminders);

            
            event = client.events().insert("himanshuranjan30@gmail.com", event).setConferenceDataVersion(1).execute();
            System.out.printf("Event created: %s\n", event.getHtmlLink());

Here I am trying to setup a meet link using conference but its not working and giving a error like:

{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Invalid conference type value.",
    "reason" : "invalid"
  } ],
  "message" : "Invalid conference type value."
}

Any help will be appreciated.

rudeTool
  • 526
  • 1
  • 11
  • 25
  • I cannot reproduce this behavior. I can create the event successfully, using your exact same code (just changing the calendarId). Have you tried creating the event directly in the UI? Is it created successfully with the meeting attached? – Iamblichus Jul 29 '21 at 08:26
  • what calendarId you are using? does it create the meet link? – rudeTool Jul 29 '21 at 08:58
  • and yes I am able to attach the meeting link through the UI but not through code.Are you using a service account? @Iamblichus – rudeTool Jul 29 '21 at 09:00
  • `what calendarId you are using`: "primary". `does it create the meet link?`: Yes. `Are you using a service account?`: No, are you? – Iamblichus Jul 29 '21 at 09:28
  • Yes I am creating a service account – rudeTool Jul 29 '21 at 15:11
  • Are you using the service account to [impersonate a regular account](https://developers.google.com/identity/protocols/oauth2/service-account#delegatingauthority)? I doubt the service accounts by themselves can add conferences. – Iamblichus Jul 30 '21 at 07:19

1 Answers1

0

conferenceSKey.setType("hangoutsMeet");

Looks like the calendar where you try to insert the event does not accept the "hangoutsMeet" conference call type.

To verify use get of Calendar API to view your target Calendar metadata. https://developers.google.com/calendar/api/v3/reference/calendars

You can see the allowed types under,

"conferenceProperties": {
    "allowedConferenceSolutionTypes": [
      string
    ]
  }
Ismail
  • 1,188
  • 13
  • 31
  • Got this: ```{ "kind": "calendar#calendar", "etag": "\"UGZ9E6e2y1kc_Q25kEgvdR6mX_I\"", "id": "himanshuranjan30@gmail.com", "summary": "himanshuranjan30@gmail.com", "timeZone": "Asia/Kolkata", "conferenceProperties": { "allowedConferenceSolutionTypes": [ "hangoutsMeet" ] } } ``` – rudeTool Jul 28 '21 at 06:35