I'm using npm module named as ics to create ics file and attach it in the mail.
Refrence: https://www.npmjs.com/package/ics
When first time email will be sent at that time ics file will be generated with below code snippet:
const event: any = {
start: [2022, 9, 2, 15, 0],
duration: { hours: 0, minutes: 30 },
title: `Appointment updated for service with cutter`,
description: `Description`, // phone number
location: `address`, // store address
status: 'CONFIRMED',
organizer: { name: 'Admin', email: 'admin@mailinator.com' },
attendees: [
{ name: `jay`, email: `jay1@mailinator.com`, partstat: 'ACCEPTED', rsvp: true, role: 'REQ-PARTICIPANT' }
],
uid: "efrtEW234deetijg45"
}
const { error, value } = await ics.createEvent(event);
The above code works fine for the first time and ics file is attached to an email. But when I update the appointment time at that also I need to attach ics file in the email with updated details. And updated details would be below:
- Time, Title, Description, duration.
I'm not changing uid parameter of event object at the time of update. It'll be same
Issue is not related to generating ics file or sending an email.
Question: When the email for the update event gets triggered at that time ics file will be attached to the email and when the user clicks on "add to calendar" button from the email then new event gets created in the calendar but ideally, the previous event should be replaced by a newer one.
Thank you in advance for the help.