Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GoogleCalendarAPI accept/decline event

I am working on GoogleCalendar API and using node.js as a platform to build my application. I am able to create events using authentication procedure and creating the calendar event using the access token generated while authenticating.

My question is that suppose if we have any attendee in the event and I want to accept/decline the event using the calendar API from the attendee's side, how can we do that?

I have tried fetching the calendar event of the attendee and matching it with the iCalUID of the event which was originally created and then modifying the event using update event on the attendee's calendar.

like image 406
Mohit Mathur Avatar asked Jan 07 '16 04:01

Mohit Mathur


1 Answers

Event creator or owner cannot modify the response of attendees. Only attendees can modify their status.

To update the status on the side of the user, You may use the Event.update API and provide value for 'attendees.responseStatus'. Attendee's response status has 4 (four) possible value (described below).

'needsAction' - has not responded to the invitation. 'declined' - has declined the invitation. 'tentative' - has tentatively accepted the invitation 'accepted' - has accepted the invitation.

In addition to this, You can use the word "primary" as value for the calendar id to represent the currently logged in user

CalendarId: Calendar identifier. To retrieve calendar IDs call the calendarList.list method. If you want to access the primary calendar of the currently logged in user, use the "primary" keyword. (string).

For the id, you need to use the "id" returned by the Events.list API not the "iCalUID". Those two are different as described here.

Other fields that you need to provide are the email (of the attendee), startdate and enddate.

For more information, you may view the official documentation, link below: https://developers.google.com/google-apps/calendar/v3/reference/events

like image 76
Android Enthusiast Avatar answered Oct 21 '22 16:10

Android Enthusiast