Using the Google APIs Client Library for PHP, I am trying to create a new calendar event and attach a hangoutsMeet conference. When I attempt to do so, I receive an error stating Invalid conference type value.
Using the same code, I am able to create a new event and attach an eventHangout conference.
I understand why I am receiving the error: according to the API, my calendar only supports the eventHangout conference type.
<<<< edit #1 on April 3 2020
Clarification following Andres Duarte's answer: this only appears as a limitation when I attempt to create an event via the API. When I manually create an event using the Google Calendar interface, I am able to add a Google Meet. In fact, that's the only conferencing option that's displayed in the dropdown.
>>>>
My question is, how can I update my calendar settings (with or without the API) such that I can use the API to create events with attached hangoutsMeet conferences?
Here is some sample code to demonstrate what I've tried:
<<<< edit #2 on April 3 2020
Clarification following hooman182's answer: I have updated my code sample to demonstrate that I am setting requestId correctly, using a string.
>>>>
try {
// fetch the calendar
$calendar = 'myCalendar';
$calendarObject = $service->calendars->get($calendar);
echo "<pre>";
echo "\nORIGINAL *******************************************************\n\n";
var_dump($calendarObject->getConferenceProperties()->getAllowedConferenceSolutionTypes());
// set the allowed conferences solutions type
$calendarObject->getConferenceProperties()->setAllowedConferenceSolutionTypes(
array(
"hangoutsMeet",
"eventHangout",
"eventNamedHangout",
)
);
echo "\nUPDATED *******************************************************\n\n";
var_dump($calendarObject->getConferenceProperties()->getAllowedConferenceSolutionTypes());
// save the changes to the calendar
$calendarObject = $service->calendars->patch($calendar, $calendarObject);;
echo "\nSAVED *********************************************************\n\n";
var_dump($calendarObject->getConferenceProperties()->getAllowedConferenceSolutionTypes());
// add a createRequest to my event
$event->setConferenceData(new Google_Service_Calendar_ConferenceData(array(
'createRequest' => array(
'requestId' => md5(time()),
'conferenceSolutionKey' => array(
'type' => 'hangoutsMeet',
)
)
)));
// save the event
$event = $service->events->insert($calendar, $event, array(
'conferenceDataVersion' => 1
));
} catch (Google_Service_Exception $e) {
echo "\nERRORS ********************************************************\n\n";
var_dump($e->getErrors());
die;
}
And here is the output of the above:
ORIGINAL *******************************************************
array(1) {
[0]=>
string(12) "eventHangout"
}
UPDATED *******************************************************
array(3) {
[0]=>
string(12) "hangoutsMeet"
[1]=>
string(12) "eventHangout"
[2]=>
string(17) "eventNamedHangout"
}
SAVED *********************************************************
array(1) {
[0]=>
string(12) "eventHangout"
}
ERRORS ********************************************************
array(1) {
[0]=>
array(3) {
["domain"]=>
string(6) "global"
["reason"]=>
string(7) "invalid"
["message"]=>
string(30) "Invalid conference type value."
}
}
Additional details:
- I am using a service account with domain wide delegation enabled