Hello everyone,
Trying to manage events on user´s calendar by sending an email with .ics file. The problem I faced was creating a file to cancel the event. to do that the parameters from .ics file “Method” must be “cancel” and “status” must be “cancelled” (as far as i understood). Got it by creating a code node (javascript):
// Read the binary iCalendar file and convert it to text
let binaryDataBufferItem = await this.helpers.getBinaryDataBuffer(0, "data");
let icalData = binaryDataBufferItem.toString('utf8');
// Find and replace the "METHOD" property
let updatedIcalData = icalData.replace(/METHOD:PUBLISH/g, 'METHOD:CANCEL');
// Convert the modified iCalendar data back to binary format
let updatedBinaryData = Buffer.from(updatedIcalData, 'utf8');
const binaryData = await this.helpers.prepareBinaryData(updatedBinaryData, "event.ics", 'text/calendar');
let returnData=[{
json: {},
binary: {
["data"]: binaryData,
},
pairedItem: {
item: 0,
},
}];
return returnData
Now the problem is that google calendar creates another UID for the event when the user accepts. So the event won´t get canceled since the UID is the key.
Anyone with another solution?
Thanks in advance!