3

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();   


        
2
  • Welcome to stack please edit your question and include your code and describe any issues you are having with your current solution. Commented Sep 16, 2020 at 7:20
  • Code has been updated to understand the issue in better way. Commented Sep 16, 2020 at 8:56

1 Answer 1

1

Solution

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 the conferenceDataVersion request parameter to 1 for all event modification requests.

Example:

"conferenceData" => [
        "createRequest" => [
          "conferenceSolutionKey" => [
            "type" => "hangoutsMeet"
          ],
          "requestId" => "123"
        ]
      ]

Reference

Create Events

Calendar API Event insert

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.