Channels
Outlook365
OpenClaw Outlook 365 channel plugin scaffold with Microsoft Graph OAuth and webhook integration
Install
npm install
npm
Configuration Example
{
"accounts": {
"sap-requests": {
"tenantId": "your-tenant-id",
"clientId": "your-client-id",
"authMode": "oauth-delegated",
"mailboxes": ["[email protected]"],
"filters": {
"fromAddresses": ["[email protected]"],
"fromDomains": ["partner.com"],
"subjectPrefixes": ["SAP Access Request", "Role Request"],
"subjectIncludes": ["PRD", "approved"],
"subjectRegex": "^SAP Access Request\\s+-\\s+[A-Z0-9_-]+$"
}
}
}
}
README
# openclaw-outlook365
OpenClaw Outlook 365 channel plugin scaffold for Microsoft Graph-based mail triggers.
## What This Repository Is
This repository is a public-ready starting point for an OpenClaw plugin that:
- authenticates against Microsoft 365 using Microsoft identity platform OAuth
- receives Outlook 365 / Microsoft Graph mail notifications
- exchanges OAuth authorization codes for tokens
- exposes Graph webhook and lifecycle handlers
- provisions and renews mail subscriptions
- applies trigger filters before emitting events
- normalizes inbound mail events
- maps Outlook threads to OpenClaw sessions
- keeps business logic outside the plugin
## What This Repository Is Not
This plugin is intentionally an **integration boundary**, not the SAP workflow engine.
It should own:
- OAuth onboarding
- Graph webhook receipt
- subscription lifecycle management
- mailbox event normalization
- thread correlation
- optional outbound replies
It should not own:
- SAP authorization rules
- ServiceNow ticket policy
- customer-specific orchestration logic
- role assignment workflows
## Recommended Architecture
```text
Outlook 365
-> Microsoft Graph change notification
-> openclaw-outlook365 plugin
-> normalized event
-> auth-automation-orchestrator
-> OpenClaw execution nodes
```
## Repository Layout
```text
.
โโโ docs/
โ โโโ architecture.md
โโโ src/
โ โโโ config-schema.ts
โ โโโ openclaw-plugin-sdk.d.ts
โ โโโ plugin.ts
โ โโโ runtime.ts
โ โโโ types.ts
โโโ index.ts
โโโ openclaw.plugin.json
โโโ package.json
โโโ runtime-api.ts
โโโ tsconfig.json
```
## Planned Features
- delegated OAuth onboarding with PKCE
- optional application-permission mode for shared mailboxes
- Graph subscription creation and renewal
- Graph validation and lifecycle handlers
- message fetch and normalization helpers
- outbound reply adapter
- health and status surfaces
## Current Implementation
This repository now includes:
- OAuth start URL generation with PKCE
- OAuth callback code exchange
- delegated token refresh and application token acquisition
- Microsoft Graph client helpers
- Graph webhook validation token handling
- lifecycle notification handler
- in-memory subscription and token state
- subscription renewal service scaffolding
- sender/domain/subject trigger filters
- setup adapter with next-step guidance
## Trigger Filters
Each account can restrict which emails produce OpenClaw events.
Supported filters:
- `fromAddresses`
- `fromDomains`
- `subjectPrefixes`
- `subjectIncludes`
- `subjectRegex`
Example:
```json
{
"accounts": {
"sap-requests": {
"tenantId": "your-tenant-id",
"clientId": "your-client-id",
"authMode": "oauth-delegated",
"mailboxes": ["[email protected]"],
"filters": {
"fromAddresses": ["[email protected]"],
"fromDomains": ["partner.com"],
"subjectPrefixes": ["SAP Access Request", "Role Request"],
"subjectIncludes": ["PRD", "approved"],
"subjectRegex": "^SAP Access Request\\s+-\\s+[A-Z0-9_-]+$"
}
}
}
}
```
Filter behavior:
- all configured filter groups are combined with `AND`
- values within the same filter group are combined with `OR`
- if a filter group is omitted, it does not constrain matching
## Local Validation
```bash
npm install
npm run check
```
## Public Plugin Design Rules
- keep vendor integration logic inside the plugin
- keep business workflows outside the plugin
- use SecretRef-style config for secrets
- treat webhook handlers as fast-ack ingress points
- make all external event handling replay-safe
## References
- [Architecture](./docs/architecture.md)
- [Development Guidelines](./docs/development-guidelines.md)
channels
Comments
Sign in to leave a comment