Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

598
Views
Nodemailer and ical-generator - to send calendar invite

I want to send calendar invite. I'm using Nodemailer and ical-generator to generate ical file. Everything working fine but email doesn't add invite to the calendar automatically instead I get an option to Add to calendar. But I want email to directly add event to the calendar.

This is how email looks like -

enter image description here

My code looks like this.

This code converts to ical file and it is being used with Nodemailer icalEvent to send it.

    const content = ical({
    domain: 'google.com',
    method: 'PUBLISH',
    prodId: '//Google Inc//Google Calendar 70.9054//EN',
    timezone: 'Australia/Brisbane',
    scale: 'GREGORIAN',
    events: [
      {
        start: moment(),
        status: 'CONFIRMED',
        end: moment().add(1, 'hour'),
        summary: 'Calendar invite test',
        transparency: 'OPAQUE',
        organizer: {
          name: 'Organiser name',
          email: 'ttt@gmail.com',
          mailto: 'ttt@gmail.com'
        },
        location: 'Zoom',
        attendees: [
          {
            email: 'my-email-address@gmail.com',
            name: 'Shashank Kumar',
            status: 'NEEDS-ACTION',
            rsvp: true,
            type: 'INDIVIDUAL',
            role: 'REQ-PARTICIPANT'
          },
          {
            email: 'mno@gmail.com',
            name: 'Mike Jack',
            status: 'NEEDS-ACTION',
            type: 'INDIVIDUAL',
            role: 'REQ-PARTICIPANT'
          },
          {
            email: 'xyz@gmail.com',
            name: 'Will Paul',
            status: 'NEEDS-ACTION',
            type: 'INDIVIDUAL',
            role: 'REQ-PARTICIPANT'
          }
        ]
      }
    ]
  }).toString();

and then I'm using Nodmailer to send icalEvent

message: {
  to: toEmail,
  headers: {
    'x-invite': {
      prepared: true,
      value: id
    }
  },
  icalEvent: {
    filename: 'invite.ics',
    method: 'PUBLISH',
    content: content
  }
},
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You only need use 'REQUEST' as method instead of 'PUBLISH', this will add automatically to your calendar and show confirmation buttons

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!