Outlook Integration
Index Outlook emails and enable AI-powered responses using Microsoft Graph API.
Features
| Feature | Description |
|---|---|
| Email Indexing | Sync folders and conversations |
| Microsoft Graph | Native M365 integration |
| Auto-Response | AI replies with citations |
| Folder Filtering | Sync specific folders |
| Shared Mailboxes | Support for team mailboxes |
| Calendar Context | Meeting-aware responses |
Prerequisites
- Microsoft 365 subscription
- Azure AD app registration
- Mail.Read and Mail.Send permissions
Setup
Step 1: Azure AD App Registration
- Go to Azure Portal > App Registrations
- Click New Registration
- Configure:
- Name: \LH42 Email Integration\
- Redirect URI: \https://app.lakehouse42.com/api/auth/microsoft/callback\
- Add API permissions:
- \Mail.Read\ - Read user mail
- \Mail.Send\ - Send mail (for auto-response)
- \Mail.ReadWrite\ - Manage drafts
- \User.Read\ - Basic profile
- Grant admin consent (for organization-wide access)
Step 2: Connect in LH42
- Go to Settings > Integrations > Outlook
- Enter Azure AD credentials or click Sign in with Microsoft
- Authorize the requested permissions
Step 3: Configure Sync
\\\`python
client.integrations.outlook.configure({
"sync": {
"folders": ["Inbox", "Sent Items", "Support"],
"exclude_folders": ["Junk Email", "Deleted Items"],
"shared_mailboxes": ["support@company.com"],
"lookback_days": 90,
"include_attachments": True
},
"auto_response": {
"enabled": False,
"folders": ["Support"],
"mode": "draft"
}
})
\\\`
Microsoft Graph Integration
Outlook integration uses Microsoft Graph API:
\\\`
Microsoft Graph API
│
├── /me/messages - User's mailbox
├── /me/mailFolders - Folder structure
├── /me/messages/{id}/attachments - Attachments
│
└── Webhooks for real-time updates
└── subscriptions (change notifications)
\\\`
Email Processing
| Content | Indexed | Notes |
|---|---|---|
| Email body | ✅ | HTML and plain text |
| Subject | ✅ | Searchable |
| Sender/Recipients | ✅ | For filtering |
| Conversation threads | ✅ | Full context |
| Attachments | ✅ | Office docs, PDFs |
| Categories/Flags | ✅ | As metadata |
Auto-Response Configuration
\\\`python
client.integrations.outlook.configure({
"auto_response": {
"enabled": True,
"mode": "draft", # draft | send | approval
"trigger_folders": ["Support"],
"response_template": "professional",
"include_citations": True,
"signature": "—\nLH42 AI Assistant",
"rules": [
{
"condition": "subject contains 'urgent'",
"action": "prioritize",
"response_time": "immediate"
}
]
}
})
\\\`
Shared Mailbox Support
Index team mailboxes:
\\\`python
client.integrations.outlook.add_shared_mailbox({
"email": "support@company.com",
"sync_folders": ["Inbox", "Resolved"],
"auto_response": True,
"assign_to_team": "support_team"
})
\\\`
API Reference
List Emails
\\\`bash
GET /api/integrations/outlook/messages?folder=Inbox&limit=50
\\\`
Generate Response
\\\`bash
POST /api/integrations/outlook/generate-response
{
"message_id": "AAMk...",
"context": "Reply to pricing question"
}
\\\`
Create Draft
\\\`bash
POST /api/integrations/outlook/drafts
{
"conversation_id": "...",
"body": "Thank you for your inquiry...",
"citations": true
}
\\\`
Webhook Notifications
Real-time email notifications via Graph subscriptions:
\\\`python
# Automatically configured when integration is enabled
# Webhook endpoint: /api/gateway/outlook/notifications
# Subscription renewal handled automatically
# Expiration: 3 days (auto-renewed)
\\\`
Security
| Aspect | Implementation |
|---|---|
| Authentication | OAuth 2.0 via Azure AD |
| Authorization | Delegated permissions |
| Token Storage | Encrypted, auto-refresh |
| Audit | Full logging via Graph |
Troubleshooting
| Issue | Solution |
|---|---|
| Not syncing | Verify Graph API permissions |
| Shared mailbox errors | Check mailbox access rights |
| Token expired | Tokens auto-refresh; check Azure AD |
| Webhook not firing | Verify subscription status |
Next Steps
- Zoom Integration - Meeting transcription
- Communication Overview - Architecture deep-dive