Google Calendar API v3 service account not sending notification when creating an event

I'm trying to use a google service account to create a calendar event (in its own calendar) and invite some attendees.

When I create the event using a service account and JWT authentication, the event is created successfully but the invitees do not receive email notifications - see below code. The email notification is sent if I use a client account but I would rather not resort to this.

Am I doing something wrong?

var google = require('googleapis');
var SCOPES = ['https://www.googleapis.com/auth/calendar'];

var key = require("./API-Project-key.json");
var jwtClient = new google.auth.JWT(key.client_email, null, key.private_key, SCOPES, null);

jwtClient.authorize(function(err) {
    if (err) {
        console.log(err);
        return;
    }
    createEvent(jwtClient);

});

/**
 * @param {google.auth.OAuth2} auth An authorized OAuth2 client.
 */
function createEvent (auth) {
    var calendar = google.calendar('v3');


    var event = {
        'summary': 'Test Event',
        'location': 'London, UK',
        'description': 'This is a sample event',
        'start': {
            'dateTime': '2016-03-15T20:00:00',
            'timeZone': 'Europe/London',
        },
        'end': {
            'dateTime': '2016-03-15T21:00:00',
            'timeZone': 'Europe/London',
        },
        'attendees': [
            {'email': 'myemail@mydomain.com'}
        ]
    };

    calendar.events.insert({
        auth: auth,
        calendarId: 'primary',
        sendNotifications: true,
        resource: event
    }, function (err, event) {
        if (err) {
            return console.log(err, event);
        }
        return console.log(event);
    });
}

Answers


"sendNotifications" is now depreciated. You need to change it to "sendUpdates" and pass in the parameter "all" as shown here:

calendar.events.insert({
    auth: auth,
    calendarId: 'primary',
    sendUpdates:'all',
    resource: event
}, function (err, event) {
    if (err) {
        return console.log(err, event);
    }
    return console.log(event);
});

From the Google documentation:

Acceptable values are:

"all": Notifications are sent to all guests.
"externalOnly": Notifications are sent to non-Google Calendar guests only.
"none": No notifications are sent. This value should only be used for migration use cases (note that in most migration cases the import method should be used).

Need Your Help

Detecting wscript.exe Path

windows

Where is wscript.exe located in Windows? Is is possible to locate the path by the help of Windows Registry?

Does this mySQL "spatial" query work in SQL Server 2008 as well?

sql sql-server-2008 stored-procedures geography

Before I embark on a a pretty decent overhaul of my web app to use a spatial query, I'd like to know if this MySQL query works in SQL Server 2008: