Send SMS for Calendar multi-day events - google-apps-script

We have a team calendar which contains multi-day events. We would like to send a daily SMS reminder at UTC +2 /9 a.m. (using Twilio or Google for Apps).
Unfortunately, the multi-day events start at 00:00:00.
Any idea how to approach this?
Is there an easy solution?

If you're planning on implementing this on the AppScript side, unfortunately, the solution would be anything but easy. Since Google discontinued SMS Services for reminders, it looks like Twilio is your only viable option of the two in order to send those messages. You would need to read Calendar for the events and using Time-driven triggers, send out a SMS to each member for those events. However, the logic of how to propagate these texts to the right people(according to attendees of the meeting) needs to be figured out as the contacts for Sending out these texts will be stored in Twilio.
However, using the combination of Calendar API in order to receive the required information and using Twilio Appointment Reminder in order to send out the needed reminders might be a better option to look into.

Related

Apps Script get User's Work Week Settings

I'm working on a script to automatically schedule certain tasks for some users at my company. When the tasks get scheduled will be based on the user's workweek and workday, which can be customized in Google Calendar. Most of us have a M-F work week, but we have flexible schedules so for some of us, their work day may be 7-3, others 8-4, or 9-5. Some may work 4 days a week, 10 hours a day so they work Mon-Thur, 7-5, 8-6, or 9-7. That's not counting second shift, third shift, etc. I don't want the tasks to be scheduled outside of their workdays.
How can I access these settings from Apps Script?
Unfortunately, it is currently not possible to get Working Hours information through Calendar API.
Although you can query whether there are conflicting events for a given calendar/time-frame using Freebusy.query(), this method will not return a “busy” response when querying for a time-frame out of working hours.
Additionally, there is currently a new Google API in alpha called Calendar User Availability API but it currently only exposes Working Location queries not Working Hours.
More information about Calendar User Availability API on this blog post
Alternatively, you can file a new Feature Request with Google using this template

Finding Gmail Snooze dates in API

Is it possible to access the date of a Gmail snooze through the API? I came accross a hack in stackoverflow that allows users to search for which emails are snoozed via a secret label search “label:snoozed”, but lables dont normally have an associated date, especially one that will return to the inbox in the future.
Im trying to create a web routine that syncs a todo list with emails and want to the due date to automatically update with when the snoozed email will re-appear.
Is this possible with any API or developer resources google offers?
No, you can’t retrieve the date of a Gmail snooze using the API.
There is a Feature Request already reported for this behavior on Issue tracker:
https://issuetracker.google.com/issues/109952618
At the moment you can only list them and retrieve the messages that has this label ‘snoozed’ active on them:
GET https://www.googleapis.com/gmail/v1/users/me/messages?q=label%3Asnoozed

Notification email scheduling using node js and mysql

I have a notification system for my website. I need a email notification system for website users.
I have email notification setting page from where user can schedule their email on daily bases or monthly basic or immediate basis or on particular date.
What is the best approach i need to use for this kind of functionality?
PS: i don't want to use socket.io
Thanks
I'd say the following:
In case the email should be sent everytime the event occurs, then you
don't need any crontab. Just send the email when the event occur.
Run a crontab once an hour. This crontab will fetch all events from
the last hour, and send an email with all these events to the users
requesting a hourly email
Do the same once a day and once a week for users with daily and
weekly emails preferences
.

Remove Resource (e.g. conference room) from an Event using Google Calendar API

I'm looking to write an app that will use Google Calendar API's to remove a resource (e.g. a conference room) from an event, if it's discovered that the room does not end up being needed. Obviously the call to the API will be with administrative permissions, but we won't have access to individual user accounts to remove the resource from the event / invite.
Does anyone know of any way to use Google Calendar API's to update / alter the resources that are assigned to a meeting?
Thanks!
Rooms are added to events as attendees and a copy is created on their calendar. You will just need to find the right event and delete it from the room's calendar (using Calendar API). Administrative permissions should give you all the access you need.
You can also remove a Room from an event as the Room if you have the Room's authentication credentials. You use the Rooms credentials and the https://www.googleapis.com/calendar/v3/calendars/{calendarId}/events/{eventId} endpoint on the Room's primary calendar. This will not delete the event from the organizer's calendar.
Note: Regardless of the sendNotifications flag, Google will send a notification to the organizer when room delete/removes itself from an event (i.e. each time the endpoint is called). There is no workaround. If the organizer has all notifications turned off then they will not see these emails but it's still sent.
I think removing resources from an event can be done by using Google Apps Calendar Resource API. This API allows admin of the domain to add resources that users in the domain will be able to schedule on their calendars.
To delete a calendar resource, send a DELETE request to a resource ID's feed URL.
DELETE https://apps-apis.google.com/a/feeds/calendar/resource/2.0/{domain name}/{resourceId}

“Pushing” Gmail to GAS — using Gmail forwarding to trigger GAS script

Summary
Is it possible to use the Gmail forwarding feature to send (i.e., “push”) via HTTP (GET/POST) to my GAS script URL? (And perhaps include its contents as a parameter?)
Goal/Background
My goal is to immediately process my incoming Gmail instead of, say, using the GAS trigger feature to query and “pull” my Gmail on a periodic basis.
The former method is relatively immediate. Whereas, the latter method creates an expected delay equal to the mean interval time between (automatically triggered) queries to my inbox.
Possible Solutions
1. Gmail Data API
This documentation states Gmail lacks a data API.
2. Atom/RSS Feeds
Atom/RSS feeds still require an aggregator to pull the data from the server and, thus, do not accomplish my goal of a push-only solution to my GAS URL to, then, in turn, trigger my script via doGet() or doPost().
3. IMAP/POP
These solutions are designed for desktop/offline processing of emails and, therefore, do not meet my goals. I need a solution that lives on the web and automates my web-based email checking tasks.
4. High-frequency GAS Trigger
A, say, 60-second trigger interval in GAS does not work because there is a cost to such high-frequency triggers in GAS due to quota limitations. i.e., I don't want to use up that much quota space on this one task because I need it for other stuff.
5. 3rd Party Listeners
I would prefer something free if possible. Someone has suggested Zapier® — which does have a free version. Do these work? Are there others?
Conclusion
Are there any creative ideas out there? Perhaps to point me in a creative direction?
I would even settle for just a way to be immediately notified (programmatically) that I received a new email.
Not possible from Google Apps Script:
Google Apps Script currently available events:
https://developers.google.com/apps-script/understanding_events
Does Gmail have a Data API?
FAQ: https://developers.google.com/gdata/faq#GmailAtomFeed
Looks like IMAP is the only option, not sure if IMAP supports callback.
A trigger can kick off a script every 60 seconds. As you stated before, this puts your average notification at 30 seconds (let's not get started on possible flaws in statistical assumptions).
Another possibility for a more immediate action is to use a service like Zapier.com as a listener. It can listen for new emails in your gmail inbox, apply filters, and initiate a GET/POST to the URL for your Apps Script (make sure it is the newest version published).
I hope this helps. Curious why you need immediate handling of the messages ...