Prompt
How do I create and update events in a user's calendar from my app?
Latest observation
Oct 15, 2026
OpenAI APIWeb search: off
To create and update events in a user’s calendar from your app, the general flow is:
-
Pick the calendar provider/API
- Most commonly:
- Google Calendar API
- Microsoft Outlook/Office 365 via Microsoft Graph
- Apple Calendar usually via the device’s native APIs, not a public cloud API in the same way
- If you want broad support, you typically integrate with Google and Microsoft separately.
- Most commonly:
-
Authenticate the user
- Use OAuth 2.0 so the user explicitly grants your app permission.
- Request the minimum scopes needed, such as:
- Google:
https://www.googleapis.com/auth/calendar.eventsor broadercalendar - Microsoft Graph:
Calendars.ReadWrite
- Google:
- Store tokens securely and refresh them as needed.
-
Get the user’s calendar list
- After login, fetch calendars so you know where to create events.
- Users may have multiple calendars, so let them choose one.
-
Create an event
- Send an API request with event details:
- title/summary
- start time
- end time
- timezone
- location
- description
- attendees
- Example fields:
- Google:
summary,start,end,attendees - Microsoft Graph:
subject,start,end,attendees
- Google:
- Send an API request with event details:
-
Update an event
- First, store the provider’s event ID when you create it.
- Use that ID later to modify the event.
- Update only the fields that changed, or replace the event object depending on the API.
- Handle concurrency if the event may have been changed elsewhere:
- Google uses etags / incremental sync patterns
- Microsoft Graph supports
@odata.etagand conditional updates
-
Handle recurring events carefully
- Recurring events are more complex:
- You may need to update the whole series or a single occurrence.
- The API usually treats recurrence separately from one-off events.
- Recurring events are more complex:
-
Sync changes back to your app
- If events can be edited in the calendar UI directly, use:
- webhooks / push notifications where available
- or periodic sync using sync tokens / delta queries
- If events can be edited in the calendar UI directly, use:
-
Respect permissions and privacy
- Be transparent about why you need calendar access.
- Allow users to disconnect their account and revoke access.
Example: Google Calendar
- Create:
events.insert - Update:
events.updateorevents.patch
Example: Microsoft Graph
- Create:
POST /me/events - Update:
PATCH /me/events/{id}
Minimal data model in your app
Store at least:
- your internal event ID
- provider name (
google,microsoft) - provider calendar ID
- provider event ID
- sync status / last updated time
If you want, I can give you:
- a step-by-step implementation
- sample code in Node.js, Python, or PHP
- or the exact API calls for Google Calendar or Microsoft Graph.