Create Google Meet Event via Calendar API - Status Code Pending

55 Views Asked by At

The way that I'm attempting to create the Google Meet is by adding information to the event data when posting a given event to a Google Calendar via the Calendar Sync.

Here's the gist of how I'm doing that, using the Google PHP SDK:

`$rawEventData = [
    'iCalUID'        => $appointmentData['UID'],
    'summary'        => $appointmentData['name'],
    'location'       => $appointmentData['location'],
    'description'    => $appointmentData['description'],
    'start' => array(
        'dateTime' => date(DATE_RFC3339, $appointmentData['startDate']),
        'timeZone' => $timezone,
    ),
    'end' => array(
        'dateTime' => date(DATE_RFC3339, $appointmentData['endDate']),
        'timeZone' => $timezone,
    ),
    'sequence'       => $appointmentData['updateSequence'],
    'attendees'      => $attendeeSet,
    'guestsCanInviteOthers'    => false,
];


$optParams = [];


if($createGoogleMeeting) {  // here's where I add extra bits to request that a Google Meet get created for the Event
    $optParams['conferenceDataVersion'] = 1;
    $rawEventData['conferenceData'] = [
        'createRequest' => [
            'requestId' => 'A' . $appointmentData['ID'],
            'conferenceSolutionKey' => [
                'type' => 'hangoutsMeet' // the others are deprecated!
            ]
        ]
    ];
}`


$eventData = new Google_Service_Calendar_Event($rawEventData);
$GoogleAPIBatch->add($GCalendarService->events->import($post_calendar_id, $eventData, $optParams), $appointmentData['ID']);

And that's it. statusCode of pending, and it never changes. Per the documentation a pending request should eventually turn into an actual Google Meet, BUT the event as successfully posted to my calendar never has a Google Meet set for it, no matter how much time goes by. This is of course in sharp contrast to clicking the big blue "Add Google Meet video conferencing" button found in the Google Calendar event editor UI, which creates a google meet within a second or two.

Update:

This time around though, heartened that I wasn't wasting time trying to make something work with an API that wasn't even generally available, I dug deeper into the scopes that my OAuth consent screen had set, and ensured that ./auth/meetings.space.created was indeed intact.

It was, like so:

(from https://console.cloud.google.com/apis/credentials/consent/edit?project=coachaccountable-calendar-2)

But then I realized that that still wasn't being presented to the user on the OAuth consent screen.

So I added this to the process that cooked up the URL to the OAuth screen on the Google side of things: $GoogleAPIClient->addScope("https://www.googleapis.com/auth/meetings.space.created");

And indeed, with that in place that was now advertised to the user as what part of the access they were granting.

This could be confirmed as (newly!) granted in the Manage your Google Account >> Security >> Third Party Apps With Access area

With that I was hopeful that things were good to go, YET with a fully re-granted OAuth for the account connection, a newly created event to be posted, I still get, when adding in post data to request that a Google Meet be created, the same response concerning that request:

statusCode pending

And it's not just the immediate response upon posting the event. Subsequently fetching event data from the calendar with a call like so...

$eventListing = $GCalendarService->events->listEvents($google_calendar_id], $options);

...returns the exact data within that conferenceData field of the event. (Viewing the event as posted within the Google Calendar itself confirms the lack of any Google Meeting having been set.)

So the request is most definitely getting there, noted as being (ostensibly!) legitimately made, and with what I believe to be the required scopes all in place (namely /auth/meetings.space.created in addition to the usual ./auth/calendar).

After I realized not asking the user for the right scope things, I thought for sure this was a mea culpa. But now, to get the same result (and to have previously gotten no indication of a failed meeting request on account of previously lacking the /auth/meetings.space.created scope), I am not sure where to go.

I do think the balance of probability is that this is a mistake I'm making on my end, but the lack of feedback around whatever failure here beyond statusCode="pending" leaves me very much at a loss!

Fixed the oAuth Stuff. But that also didnt change anything.

0

There are 0 best solutions below