0
votes

I would like to create events with Google Calendar API Library for Javascript and send email notifications to the attendees, but I don't know where I can set the sendNotifications optional query param to true.

I've tried this way below, the event is being created but the notification is not working:

var request = gapi.client.calendar.events.insert({
    'calendarId': 'primary',
    'resource': eventArray,
    'sendNotifications': true
});

request.execute(function(event) {
    console.log('Event link => ' + event.htmlLink);
});

Where can I set this param to true?

1
Check this SO question if it can help you :)KENdi
Thank you, @KENdi! Your link helped me to change my search over Google API Documentation and I found a solution. I changed it to a REST request. This way I could set the "sendNotification" query parameter correctly! :)Mariana

1 Answers

0
votes

My question was very specific but I found a solution changing to a REST request then I could set the query parameter sendNotifications to true (this way below).

If someone has the same problem I had, here's an option that worked for me:

var restRequest = gapi.client.request({
    'method': 'POST',
    'path': '/calendar/v3/calendars/primary/events',
    'params': {'sendNotifications': 'true'},
    'body': eventArray
});

restRequest.execute(function(event) {
    console.log('Event link: ' + event.htmlLink);
});

Now, when I add the event programmatically, all the attendees receive the invite by email. :)

Useful links: