Overview
The Microsoft 365 integration connects your Outlook email and Microsoft Calendar to Twenty. Once configured, you can:- Sync Outlook emails with contacts and companies
- View email threads in contact records
- Send emails through your Outlook account
- Sync Microsoft Calendar events
- Schedule meetings with contacts
Prerequisites
Before setting up the integration:- Microsoft 365 or Outlook.com account
- Admin access to your Twenty workspace
- For self-hosted: Microsoft Azure app registration
Setting Up Microsoft OAuth
For Cloud Users
Twenty Cloud users can connect directly without additional configuration:Connect Microsoft Account
Click Connect Microsoft Account and sign in with your Microsoft credentials.
Grant Permissions
Authorize Twenty to access:
- Read and send emails
- Access calendar events
- View profile information
For Self-Hosted Instances
Self-hosted users need to register an Azure application:Register Azure Application
- Go to Azure Portal
- Navigate to Azure Active Directory > App registrations
- Click New registration
- Enter application details:
- Name: Twenty CRM
- Supported account types: Accounts in any organizational directory
- Redirect URI:
https://your-domain.com/auth/microsoft-apis/get-access-token
Configure API Permissions
- In your app registration, go to API permissions
- Click Add a permission > Microsoft Graph
- Select Delegated permissions and add:
Mail.Read- Read user mailMail.Send- Send mail as userCalendars.ReadWrite- Read and write calendarsUser.Read- Sign in and read user profile
- Click Grant admin consent
Create Client Secret
- Go to Certificates & secrets
- Click New client secret
- Add a description and select expiration
- Copy the secret value immediately (it won’t be shown again)
Email Integration
The Microsoft 365 email integration syncs your Outlook emails with Twenty.Email Sync Features
- Automatic synchronization - Emails sync every few minutes
- Smart matching - Emails are matched to contacts based on sender/recipient
- Thread preservation - Email conversations are grouped as threads
- Sent mail sync - Emails sent from Twenty appear in Outlook
Viewing Synced Emails
To access emails in Twenty:- Open any contact or company record
- Click the Emails tab
- View all email conversations with that contact
Composing Emails
To send an email from Twenty:- Navigate to a contact record
- Click Compose Email
- Write your message
- Click Send
Calendar Integration
Microsoft Calendar events sync bidirectionally with Twenty:Calendar Features
- Two-way sync - Create events in either Twenty or Outlook
- Attendee management - Link meeting attendees to CRM contacts
- Availability view - See your schedule when booking meetings
- Recurring events - Full support for recurring meeting patterns
Managing Events
- Navigate to the Calendar section in Twenty
- Create, update, or delete events
- Changes sync automatically to Microsoft Calendar
Scheduling Meetings
To schedule a meeting with a contact:- Open the contact record
- Click Schedule Meeting
- Select date, time, and duration
- Add additional attendees if needed
- Click Create Meeting
Required Permissions
The Microsoft 365 integration uses these Microsoft Graph API permissions:| Permission | Type | Purpose |
|---|---|---|
Mail.Read | Delegated | Read emails from your mailbox |
Mail.Send | Delegated | Send emails on your behalf |
Calendars.ReadWrite | Delegated | Read and write calendar events |
User.Read | Delegated | Access your profile information |
Troubleshooting
Connection Failed
If you can’t connect your Microsoft account:- Check admin consent - Your organization may require admin approval for the app
- Verify redirect URIs - Ensure they match exactly in Azure portal
- Check credentials - Verify Client ID and Secret are correct
- Review permissions - Ensure all required API permissions are granted
Emails Not Appearing
If emails aren’t syncing:- Check connection status in Settings > Accounts
- Verify email addresses match contacts in your CRM
- Check sync logs for errors
- Try disconnecting and reconnecting
Calendar Sync Issues
If calendar events aren’t syncing:- Ensure calendar permissions are granted
- Check that the calendar is not marked private
- Verify events are in the default calendar
- Check for sync errors in account settings
Token Expiration
OAuth tokens expire periodically. If you see authentication errors:- Navigate to Settings > Accounts
- Click Reconnect next to your Microsoft account
- Re-authorize the connection
Client secrets in Azure also expire. Self-hosted users should monitor secret expiration dates and rotate them before they expire.
Security Considerations
- All OAuth tokens are encrypted at rest
- Twenty never stores your Microsoft password
- Tokens are scoped to only the permissions you grant
- You can revoke access anytime from Microsoft account settings
Implementation Details
The Microsoft 365 integration is implemented in:- OAuth controller:
packages/twenty-server/src/engine/core-modules/auth/controllers/microsoft-auth.controller.ts:26 - Email sync driver:
packages/twenty-server/src/modules/messaging/message-import-manager/drivers/microsoft/ - Calendar integration:
packages/twenty-server/src/modules/calendar/calendar-event-import-manager/drivers/microsoft/
Need Help?
Get support from our community on Discord.
