Google calendar meet link not being created automatically via Google Calendar PHP API. Google Calendar API stopped creating a hangout meeting link automatically. The same code was working a few months back but not not not.
Code
$client = getClient();
$service = new Google_Service_Calendar($client);
$event = new Google_Service_Calendar_Event(array(
'summary' => $summary, //'Google Calendar summary',
'location' => $location, //'USA',
'description' => $description, //'Book Room',
'start' => array(
'dateTime' => $sessionStartTime,//'2018-08-16T14:30:00-00:00',
'timeZone' => 'America/Los_Angeles',
),
'end' => array(
'dateTime' => $sessionEndTime,//'2018-08-16T14:30:00-01:00',
'timeZone' => 'America/Los_Angeles',
),
'attendees' => array(
array('email' => $attendeesEmailNEW,'resource' => true),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'popup', 'minutes' => 10),
),
),
));
$calendarId = 'primary';
$event = $service->events->insert($calendarId, $event);
$createdID = $event->getId();
In order to create the conference data property in an Event you will have to send a request with the ConferenceDataVersion flag activated.
conferenceDataVersion : Version number of conference data supported by the API client. Version 0 assumes no conference data support and ignores conference data in the event's body. Version 1 enables support for copying of ConferenceData as well as for creating new conferences using the createRequest field of conferenceData. The default is 0. Acceptable values are 0 to 1, inclusive.
To pass this setting in PHP you can use the following instruction:
$service->events->insert($calendarId, $event, ['conferenceDataVersion' => 1]);
When setting this flag you will also have to create an Event property called conferenceData.createRequest
The conference-related information, such as details of a Google Meet conference. To create new conference details use the
createRequest
field. To persist your changes, remember to set theconferenceDataVersion
request parameter to1
for all event modification requests.
Example:
"conferenceData" => [
"createRequest" => [
"conferenceSolutionKey" => [
"type" => "hangoutsMeet"
],
"requestId" => "123"
]
]