jayanthanantharapu
jayanthanantharapu

Reputation: 23

Event invitations and notifications aren't sending to the guests in google calendar via service accounts mode

Created a service account in developer console and added service account email id in google calendar with admin rights.

The problem here is event invitations and reminders aren't auto triggering via service accounts but using the client id and secret key can able to sent the emails of invitations and reminders.

Using oauth2.0 prompts the user to log in and allow access, but here, required to access own google calendar so, using service accounts creating the events but invitations and reminders aren't sending.

Ref: Google Event Insert V3 using oauth2.0 and service accounts

Is there any workaround or solved the issue, please help us. Thanks in Advance.

Below is the event creation object.

$event = new Google_Service_Calendar_Event(
            array(
                'summary' => $title,
                'start' => array(
                    'dateTime' => $data['start_date_time'],
                ),
                'end' => array(
                    'dateTime' => $data['end_date_time'],
                ),
                'attendees' => array(
                    array(
                        'email' => $data['student_email'],
                        'displayName' => $data['student_name'],
                        'responseStatus' => "needsAction"
                    ),
                    array(
                        'email' => $data['mentor_email'],
                        'displayName' => $data['mentor_name'],
                        'responseStatus' => "needsAction"
                    ),
                ),
                'guestsCanInviteOthers' => false,
                'guestsCanSeeOtherGuests' => false,
                'sendUpdates' => "all",
            )
$service = new Google_Service_Calendar($this->client);
$event = $service->events->insert($this->calendar_id, $event);

Upvotes: 0

Views: 658

Answers (1)

jayanthanantharapu
jayanthanantharapu

Reputation: 23

Ref: Google Event Insert V3 using oauth2.0 and service accounts

There are request body and request parameters for a request. The sendUpdates is a request parameter used in request body so, the notifications and invitations are not sending.

Use below code: Remove attribute sendUpdates from event request body if any.

$service = new Google_Service_Calendar($this->client); $event = $service->events->insert($this->calendar_id, $event, array('sendUpdates' => 'all'));

The request body is the same as above.

Thanks.

Upvotes: 1

Related Questions