-
Notifications
You must be signed in to change notification settings - Fork 130
New integration: Microsoft outlook π Β #66
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersintegrationnew-featurenew-integration
Milestone
Description
Description
Add Microsoft Outlook integration to sync emails, calendar events, contacts, and mail activity into CORE via Microsoft Graph API.
Reference Implementations
Existing Integrations (use as templates)
integrations/gmail/- Similar email integration (if exists)integrations/github/- Similar OAuth and event-driven systemintegrations/slack/- For messaging reference
Required Files Structure
integrations/outlook/
βββ src/
β βββ index.ts # Main entry, OAuth spec
β βββ schedule.ts # Sync logic
β βββ utils.ts # Microsoft Graph API utilities
β βββ account-create.ts # OAuth setup
β βββ create-activity.ts # Activity formatting
βββ package.json
βββ tsup.config.ts
βββ README.md
Microsoft Graph API (Outlook) Integration
OAuth Setup
- Use OAuth 2.0 (Authorization Code Grant) via Microsoft Identity Platform
- Authorization URL:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize - Token URL:
https://login.microsoftonline.com/common/oauth2/v2.0/token - Required scopes:
Mail.Read- Read user's mailMail.ReadWrite- Read and write user's mailMail.Send- Send mail on behalf of userCalendars.Read- Read user's calendarsCalendars.ReadWrite- Read and write user's calendarsContacts.Read- Read user's contactsContacts.ReadWrite- Read and write user's contactsUser.Read- Read user's profileoffline_access- Refresh token supportopenid- OpenID Connect sign-inprofile- User profile info
Base URL
https://graph.microsoft.com/v1.0- Beta endpoint:
https://graph.microsoft.com/beta
Key Endpoints
GET /me/messages- List messagesGET /me/messages/{id}- Get a messagePOST /me/messages- Create a draft messagePOST /me/sendMail- Send a messagePATCH /me/messages/{id}- Update a messageDELETE /me/messages/{id}- Delete a messageGET /me/mailFolders- List mail foldersGET /me/mailFolders/{id}/messages- List messages in a folderGET /me/mailFolders/inbox/messages- List inbox messagesPOST /me/messages/{id}/move- Move a messagePOST /me/messages/{id}/reply- Reply to a messagePOST /me/messages/{id}/replyAll- Reply allPOST /me/messages/{id}/forward- Forward a messageGET /me/messages?$search="subject:keyword"- Search messages
Calendar
GET /me/events- List calendar eventsGET /me/events/{id}- Get an eventPOST /me/events- Create an eventPATCH /me/events/{id}- Update an eventDELETE /me/events/{id}- Delete an eventGET /me/calendars- List calendarsGET /me/calendarView?startDateTime={start}&endDateTime={end}- Get calendar viewPOST /me/events/{id}/accept- Accept event invitationPOST /me/events/{id}/decline- Decline event invitationPOST /me/events/{id}/tentativelyAccept- Tentatively accept
Contacts
GET /me/contacts- List contactsGET /me/contacts/{id}- Get a contactPOST /me/contacts- Create a contactPATCH /me/contacts/{id}- Update a contactDELETE /me/contacts/{id}- Delete a contactGET /me/contactFolders- List contact folders
Subscriptions (Webhooks)
POST /subscriptions- Create a subscription for change notificationsGET /subscriptions- List active subscriptionsPATCH /subscriptions/{id}- Renew a subscriptionDELETE /subscriptions/{id}- Delete a subscription
Events to Track
-
Mail Events
- Email received
- Email sent
- Email replied to
- Email forwarded
- Email moved to folder
- Email deleted
- Email read/unread status changed
-
Calendar Events
- Event created
- Event updated (time, location, attendees)
- Event cancelled
- Event invitation received
- Event accepted/declined/tentative
- Event reminder triggered
-
Contact Events
- Contact created
- Contact updated
- Contact deleted
Implementation Tasks
- Set up basic integration structure following
integrations/github/src/index.tspattern - Implement OAuth 2.0 flow in
account-create.tswith Microsoft Identity Platform - Create Microsoft Graph API utilities in
utils.ts - Implement sync logic in
schedule.tsfor mail, calendar, and contacts - Set up Graph API subscriptions (webhooks) for real-time change notifications
- Convert Outlook events to CORE activity format
- Handle delta queries for efficient incremental sync
- Implement pagination with
@odata.nextLink - Add error handling and rate limiting
- Create integration documentation
- Add to
integrations/README.md
Technical Notes
- Microsoft Graph API v1.0 is the stable endpoint; beta has newer features but may change
- Use
$select,$filter,$orderby,$top,$skipOData query parameters for efficient queries - Delta queries (
/me/messages/delta) enable efficient incremental sync without re-fetching all data - Subscriptions (webhooks) require a publicly accessible HTTPS endpoint and must be renewed before expiry (max 3 days for mail, 3 days for events)
- Access tokens expire after ~1 hour; refresh tokens last 90 days (or longer with continuous use)
- Microsoft supports both delegated (user) and application (daemon) permission models
- Rate limiting: 10,000 API requests per 10 minutes per app per mailbox
- Multi-tenant app registration supports personal Microsoft accounts and work/school accounts
$searchparameter available for full-text search of mail messages
Resources
- Microsoft Graph API Overview
- Outlook Mail REST API
- Outlook Calendar REST API
- Microsoft Graph Auth Overview
- Graph API Permissions Reference
- Subscriptions / Change Notifications
- Delta Queries
- Compare Graph and Outlook REST endpoints
Labels
enhancement, integration, new-feature
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomersintegrationnew-featurenew-integration
Type
Projects
Status
Review