Wondering if this is possible:
 To create an action that would fetch Google calendar events happening in the next 7 days…
 In the fetch capture the Google Calendar event details and paste them into a Draft intended to be sent as an email message via Gmail
 Populate the Draft with the calendar event title, attendee names and attendee email addresses
 Would populate the Draft with the title, emails and names in the correct spots to take advantage of the Gmail action to send an email (subject + recipients)
I realize this could be done on Zapier – but is problematic… thought Drafts might be able to do this? slightly better for my needs…
Many thanks in advance for any responses.
my first question would be do you synchronize this Google Calendar with you iPhone / iPad / Mac?
If you do, this is definitely possible
@FlohGro yes, my Google calendar events show in my Apple Calendar + Fantastical.
did you ever create scripts with drafts?
the APIs are documented very good - you basically need two things:
Calendar object to retrieve the data from your calendar
Draft object to create the drafts with the events.
to filter your events (for the next seven days) you need to create the end date dynamically using Date and then access the underlying informations of each event with the Event object
If you need further assistence in scripting this - I’m happy to help!
there are a few open questions:
re  do you want to send those e-mails directly or later (manually or with an other action)?
re  can you give an example how this e-mail should be formatted exactly?
re  seems to be the answer to my question to  → so basically you want to send a reminder for upcoming events to all attendees right?
I would then suggest to use the GmailMessage object:
@FlohGro thanks for these resources…
I find scripting overwhelming…
My aim was to send these out via an action, manually… not every meeting requires an email…
Thanks for the reply…
I put something together for you:
You need to insert the name of the calendar you want to use it with in the Template Tag action step.
Please try it and let me know what you think.
Since you didn’t give me an example how the drafts should look like I just made a very basic draft.
The only thing that was not possible is to retrieve the e-mail addresses. Maybe I missed something @agiletortoise ? but I think it’s not possible to get the e-mail address of an attendee in an event right?
You can call a Shortcuts shortcut from the action to build the data to populate the draft. Event atendee e-mail addresses are available In Shortcuts.
good idea thanks!
would be great to have them in Drafts, too (if they are available… maybe its an API restriction or just not implemented yet.) This would streamline the process a lot.
@FlohGro this works great – thank you…
I will fiddle to try and tweak the Draft output…
Super help - thanks so much!
Thanks @sylumer will play around to execute from Shortcuts…
Great, let me know when you need further assistance
Have you tried this Shortcuts route with a synced Google Calendar? I’d be kind of surprised if it worked in that case – but I don’t have a Google Calendar setup for syncing at the moment. Event attendees don’t store an email address. There is a pathway in the APIs to get the related contact in Contacts, but it seems unlikely technically that a synced calendar event from a non-iCloud source would have that sort of link established.
I’d also be curious what it’s doing with Contacts with multiple emails assigned, etc.
I’ve used it once in the past I think to answer a query someone had. It was probably using one of my test calendars or my work calendar, so it may well not have been from my Google calendar.
I’ll maybe see if I can try it out later and see if it just returns blanks or an actual address.
Entirely possible there some other magic going on that makes it work, but is not exposed in the public event APIs, too.
I created a new event in my Google test calendar (via the stock Calendar app on my iPhone) and invited a fictitious attendee.
I then checked the details via the website to confirm it was indeed my Google calendar anot an iCloud one.
I created a quick shortcut to just check if it could pick up the attendee’s email address, and it looks like it can.
I didn’t try a contact with multiple email addresses, this example was someone not even in my contacts - showing it is the address held against the event.
Looking at Scriptable’s documentation, I can see the same constraint there as in the Drafts scripting documentation.
Maybe there simply is some secret sauce in the way Shortcuts gets the data.
vCal files can include attendee info, and I know I have saved out events from Shortcuts for and read the vCal it generates back in to parse for data that wasn’t natively available. I think that might even have been to get some attendee info back in the Workflow days. It was definitely quite some time ago. I don’t know if they have changed their underlying approach, but I’ve a feeling whatever it is being done, it’s been done for a while.
The script @FlohGro wrote IS pulling email addresses - sometimes.
I can’t detect a pattern.
Some have accepted the meeting. Others haven’t. And in other cases of both those instances emails are lot flowing through.
My initial thought: wondering if emails not flowing through are based on if I created the meeting or was invited to the meeting. If the later, perhaps I don’t have permission for the email addresses? Will require more digging on my end.
thats interesting I just tested it by inviting a gmail address I use but didn’t get an e-mail address from it.
If you somehow find a pattern I would be interested
but as @sylumer suggested you could e.g. run a shortcut that looks up all e-mail addresses of persons in contacts and returns them to Drafts. I guess this is a lot more fiddling around but without a clear pattern when you get the e-mail address its maybe the only choice you have to get it working reliably.
Actually my suggestion was not to do this, but to build a shortcut to do the building of the draft content - I.e. not lookup any users in contacts.
Shortcuts can access all the same calendar event data, and includes the explicit option to grab attendee (really invitee) e-mail addresses.
I prefer to stay in Drafts and not jump out to another app (more efficient), but sometimes other apps can provide something different or an easier way of doing things. If the email address is a need to have, and if Shortcuts is providing some additional functionality around this, then maybe this is such a case where switching out makes sense.
oh sorry - misread that.
this is really a good alternative since you can filter the events in the upcoming days very easily in the
Find Events Action.
this shortcut creates a Draft for each event with more than 1 attendee in the next 7 days and fills it with some details (including e-mail addresses).
Thinking about it - you could skip drafts entirely in that case and just use Shortcuts to create the content for the e-mails and e.g. create a prompt that asks you if you want to send an e-mail for this event or not…
Thanks for this shortcut @FlohGro
When I run it from desktop – no Drafts are created at the completion of running.
When I run it from my iPhone it works perfectly well…