Node js send meeting/calendar invite for gmail

Viewed 7193

I am trying to send calendar invite using node js.

I have tried nodemailer library and is sending mail with calendar invite

Like in reference to this question

but this is sending invite like check add to calendar link

but I want send invite like enter image description here

suggest some help if anyone knows better approach.

[update] using google-calendar api the output is showing like enter image description here

3 Answers

sendNotifications is deprecated, use sendUpdates. Notice it isn't boolean but string.

calendar.events.insert({
    auth: auth,
    calendarId: 'primary',
    resource: event,
    sendUpdates: 'all',
  }, function(err, event) {
    if (err) {
      console.log('There was an error contacting the Calendar service: ' + err);
      return;
    }
    console.log('Event created: %s', event.htmlLink);
  });

From typescript signatures:

     * @param {boolean=} params.sendNotifications Deprecated. Please use sendUpdates instead.  Whether to send notifications about the creation of the new event. Note that some emails might still be sent even if you set the value to false. The default is false.
     * @param {string=} params.sendUpdates Whether to send notifications about the creation of the new event. Note that some emails might still be sent. The default is false.

If someone is still looking for an answer :

Try updating your events.insert payload with sendNotifications key as shown

var calendar = google.calendar("v3");

  calendar.events.insert({
  auth: auth,
  calendarId: "primary",
  resource: event,
  sendNotifications:true
}, function(err, event) {
  if (err) {
    console.log("There was an error contacting the Calendar service: " + err);
    return;
  }
  console.log("Event created: %s", event);
});

This will send an email to all the attendees sent as part of event meta data as directed in google docs

Related