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
but I want send invite like
suggest some help if anyone knows better approach.
[update] using google-calendar api the output is showing like
If we need to send calendar invites just create a calendar object from the above-mentioned function and then send its return object to the below sendemail function. sendemail, };
Add people to your event On your computer, open Google Calendar. On the right, under "Guests," start typing the name of the person and choose someone from your contacts. You can also type an email address to invite people who aren't in your contacts list.
You can simply send the link to the Google calendar for example from where the user can simply click & join the event. The "Content-Type": "text/calendar" is making the mail sender / client belive that there is an actual file attached or associated with the email. The attach the . ics file.
I would use the Google Calendar API: https://developers.google.com/google-apps/calendar/create-events, you can do this using a library such as https://www.npmjs.com/package/google-calendar. It also has the benefit that you won't have to send emails from your server.
In this way you can add attendees and the invite will be the same as if you sent the request directly from the calendar instead of Google interpreting your email as a calendar event.
The event you create appears on all the primary Google Calendars of the attendees you included with the same event ID. If you set sendNotifications to true on your insert request, the attendees will also receive an email notification for your event. See the events with multiple attendees guide for more information.
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 you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With