Google Calendar Java API stopped sending invitation to attendees - google-api

I have a gserviceaccount for my application that sends invitations to some Google Calendar events, so I use Java API for that (class com.google.api.services.calendar.Calendar, to be precise). It worked like a charm for more than year, but now I'm having some troubles with that as it just stopped working. I still can create new events via API and invite participants, later I can see they are saved properly (when getting this event from API, I can see the participants' emails), but the participants do not receive any emails or other kinds of invitation (they are not aware of the event at all)
I have already tried to delete and invite atteendees and events programatically, but nothing happened. When I create an event using normal Calendar app and then invite to this event (using app, not API), I get the invitation properly.
import com.google.api.services.calendar.model.Event;
import com.google.api.services.calendar.model.EventAttendee;
Event event = service.events().get(CALENDAR_ID, columnDay.getGoogleCalendarEvent().getGoogleEventId()).execute();
event.getAttendees().add(new EventAttendee().setEmail("foo#example.com"));
service.events().update(CALENDAR_ID, event.getId(), event).setSendNotifications(Boolean.TRUE).execute();
I expect the attendee to be saved and an email to be sent, but only a attendee is saved and I can't see any sort of invitation (email or anything). I don't get any errors.

Related

Organizer does not receive email notification when attendee declines the event

We use a service account to authenticate google calendar and programmatically create calendars and appointment events. However, when a customer declines an event, there's no notification whatsoever of the decline and we cannot find any email regarding the decline in the admin or organizer's email inbox. is it because the service account is a dummy user? How can we get the organizer to be tied to an actual email account so people can get notification of the response status of the attendee?
We tried
create the calendar and event programmatically, attendee declines, no notification (despite setSendNotification("all") in the API call)
create the calendar and event programmatically, move the organizer to a different calendar (new organizer), attendee declines, no notification for the new organizer (despite setSendNotification("all") in the API call)
update code
googleAPIHelper.executeWithThrottling(service.events().update(calendarId, remoteEvent.getId(), remoteEvent).setSendUpdates("all"), Event.class);
insert code
googleAPIHelper.executeWithThrottling(service.events().insert(calendarId, eventToInsert).setSendUpdates("all"), Event.class);
move organizer code
googleAPIHelper.executeWithThrottling(service.events().move(calendarId, remoteEvent.getId(), destinationCalendarId), Event.class);
As it turned out, for each calendar the organizer owns (found in "Other Calendars"), we have to toggle the "Other notifications" settings to receive an email (i.e. Event responses). The default is set to "None."
E.g.
See also: https://www.youtube.com/watch?v=wgbpsm82AaY

Schedule a google calendar invite for a specific time via calendar api

I am able to create google calendar events via its API. However, the email invite is sent immediately, the moment I create the event via API.
I want the event invite to be send few minutes before the event start time. So that users can respond to it as yes or no for their immediate availability.

How do I receive only the messages that are direct messages to my bot user?

I have successfully setup my slack bot app, have enabled events etc. I want to receive any direct messages that the members of my slack team send to my bot. For this, I have only enabled Bot Events and No Team Events like below
However, I do not get any event on my webhook on this setting.
If I enable message.im event under Team Events, then I start getting events. But then, I get every message that the user (who has installed the app) sends to any other user in the team.
How do I get only the messages that are sent to my bot user?
Update 1
Based on this SO question I created a private channel with the bot user. Even then, the messages in the private channel do not arrive in my webhook with the above event subscriptions.
Update 2
After reinstalling the app, it seems to be working fine. I have only used it for few minutes after the reinstall so far. I will keep posting here how it goes. It would still be interesting to know what went wrong where.
It is normal behavior that your script receives all messages (for every channel your bot is a member of), not only the messages sent directly to your bot. At this time you can not filter further in the event configuration. So you need to filter out any unwanted message in your script handling the event.
See also this answer.

Calendar Event sendNotifications inconsistency when attendee is a secondary calendar

I am creating and updating events using a service account and there appears to be an inconsistency between how notifications are handled depending on whether the attendee email is a primary or secondary calendar.
In the following example all calendars are set to receive invite and event change notifications by email.
Joe Smith has a primary calendar j.smith#gmail.com
Sam Stove has a secondary calendar xxx#group.calendar.google.com
Event inserted with Joe and Sam as attendee's (sendNotifications => false).
Joe does not receive a notification (as intended), Sam does. To reiterate Joe and Sam have identical notification settings on their calendars. With sendNotifications => true both receive a notification (as expected).
I am using the PHP API client 2.1 but I tried with 1.x as well and the outcome is the same. Since sendNotifications is a simple GET parameter I tend to think this is an API issue rather than a client issue.
As mentioned in Notifications,
To send email notifications to attendees for events that were inserted or updated via the API, set the sendNotifications parameter in the insert/update request to true.
And, do also note that:
For attendees with non-Google email addresses, these notification emails are the only way they can find out about the event: it won't be added to their calendars automatically.
This additional references might also help:
Registering your domain
Verifying domains for push notifications

Google Calendar API: Embed Event invitation in Newsletter

I have been working with Google Calendar API for quite a while now.
Wrote python scripts to create events, edit events and invite guests.
But later I figured that it does not let me invite more than 500 guests to a particular event.
So I thought of adding the Event Invitation via our own mail system. For eg:
As shown in the image above, Calendar event details are added above the newsletter. My question is, how to embed this in our own newsletter?
You could take a look into sending an ics file together with the newsletter. The iCalendar format is defined by RFC 5545 https://www.rfc-editor.org/rfc/rfc5545

Resources