Resetting a notification flag if a client edits event date - feathersjs

We have a system that sends event notifications to clients every 3days to the event, But when the client changes the date to a date more than 3 days notification flag is not reset so they do not receive notification for the new date.
There a function in feathers i can write to reset the notification flag if the date is edited by client?

Related

How to get Calendar Id from user's email using google apps script?

I am trying to create a Google calendar event for the user who submits leave request on google form. When this form response is recorded in google sheets, I get the user email id and want to create a calendar event for them. Script creates event when I use my email id, but it gives null when I try to do the same for other user.
Here is the sample code:
CalendarApp.getCalendarById(email)
.createAllDayEvent(
'OOO - Out Of Office',
startDate,
endDate,
{
description: message,
sendInvites: true,
});
I received this error: Cannot read property "createAllDayEvent" of null
I googled this error, and someone suggested that subscribing to user's calendar may solve this issue. I used the following snippet to counter that:
var calendar = CalendarApp.getCalendarById(email);
if(calendar == null){
//user may not have access, auto-subscribe them.
calendar = CalendarApp.subscribeToCalendar(email,{hidden:true,selected:false});
}
But it is showing a new error stating: The calendar or calendar event does not exist, it was deleted, or the user doesn't have access to it
Any idea how we can make it work. Thank you.
You can't do this on Form Response (at least not reliably).
To create an event in another user's calendar they must have changed their calendar settings to be available to the public and the Access Permissions must be set to 'Make changes to events'. More information about this can be read on this help page
If these settings aren't set by the user, you're out of luck creating events for them. In this case you have two options:
Create an OAuth2 Application which the user authenticates to allow the creation of Calendar events on their behalf (though this still can't be done on form submit)
Create an event on your calendar and send them an invitation using their email address. You can give them edit permissions to the event so that they have control of it as if it were in their calendar, though in this case they will have to accept the event invitation.

Google Script addEmailReminder time different for each user

I'm writing a script that will add a series of events in my Google Calendar, invite a list of people to each one, and send a reminder 5 minutes before the event using the 'addEmailReminder(minutesBefore)' method. I used two friends as a test, and although they were successfully added to the event, the notification timers were all different.
I set minutesBefore to 5, but while I (the host) got the 5 minute reminder, the other emails had notifications automatically set to 10 and 30 minutes within the event on their calendar instead of the 5 that my code calls for.
Is this since Google likes to be smart and learn from your choices and automatically defaults to certain values?
code:
var addThisClass = myCalendar.createEvent(eventName, testStartTime, endTime,{guests: emailList, sendInvites: false});
addThisClass.addEmailReminder(5);
As you can see in the documentation:
Reminders are private information, specific to an authenticated user; they are NOT shared across multiple users.
So when you are setting the reminder via the .addEmailReminder(5) method, you are overriding only your private array of reminders. That's why your friends won't get any email notification.

How to send E-MAIL to organizers in Google Calendar

I need send e-mail to the organizers of a event in Google Calendar, think in that situation of a video conference meeting : A person create a event and set a location for it, but one of the guests that are in another place set a location too, and we have rules for the locations that need to be sent by email to the organizer of the event and for that guest that included the new location if that's the case. The problem is, how can I know the user that edited that location?
I have another question too, how can i get the last event that has been created on a calendar?
how i can know the user that edited that location ?
You cant unless you set up push notifications doc
How can i get the last event that has been created on a calendar?
events.list has an order by parameter that lets you sort by the start time or by the updated.

Google apps script - Calendar Event - sendInvites by mail to myself

I created a script which create an event in my calendar automatically and send an invitation to specified addresses. That works well when I specify address different from the email linked to my calendar.
But in my case I have 2 calendars so I would like to :
- Create the event in the calendar A
- Send an invitation by email, which creates at the same time the event (but not validated) in calendar B.
- This way I can choose in the calendar B to decline or not the event
To do that I just have to send the invitation to my mail address (mymail#gmail.com). That almost works :
- The event is shown in calendar B and I can choose to decline it.
- BUT I don't receive any email for the invitation. It seems that send the invitation from a an address to the same address doesn't work.
Do you know why ? And is there a way to force the sent ?
var event = cal.createEvent(titre, DateDebut, DateFin, {description : description, guests : "mymail#gmail.com", sendInvites: true});
event.setGuestsCanModify(true);
If the email is being sent by the calendar, the other way to force an email would be using the class MailApp which allows you to send emails. This option allows you to make a custom email and invitation, and If I'm remembering correct allows you to send invites to non-google accounts.

Cron job to check date in a database and send a notification

I have a user who will input the date for the next event. It is saved in the format yyyy-mm-dd hh:mm:ss (eg: 2013-06-09 00:00:00) in a MySQL database. How can I write a cron job that sends a notification to the user 3 days in advance about an upcoming event?
You can achieve this in two steps:
You have to write a PHP script that checks in your database if there
is an event coming up three days from now and if so, which user in your
database created that event. If there's an event, the script sends a
reminder email to the user.
In cron you create a task that runs the above mentioned script once
a day.
Now that you know the steps, please try to figure out the implementation yourself.