Manage Microsoft Outlook from Your AI Agent with the Outlook Skill
If you're working in a Microsoft 365 environment, the Outlook skill for Clawdbot gives your AI agent full access to email, calendar, and contacts through the Microsoft Graph API โ no manual OAuth dance required.
Why Use the Outlook Skill?
Microsoft Outlook is the backbone of corporate communication. But switching context between your AI assistant and email client breaks your flow. This skill solves that by letting your agent:
- Read and manage emails โ list messages, check unread mail, mark as read, move to folders
- Send emails โ compose and send directly, or create drafts for review
- Handle calendar events โ view your schedule, create meetings, manage attendees
- Access contacts โ look up contact details, create new contacts
All through a clean API proxy that handles authentication automatically via Maton.
Installation
Install the skill in one command:
npx clawhub@latest install outlook-apiSetup
The skill uses Maton for managed OAuth. You'll need a free Maton API key:
- Sign up at maton.ai
- Go to maton.ai/settings and copy your API key
- Set the environment variable:
export MATON_API_KEY="your-api-key"Then connect your Microsoft account:
import urllib.request, os, json
data = json.dumps({"app": "outlook"}).encode()
req = urllib.request.Request("https://ctrl.maton.ai/connections", data=data, method="POST")
req.add_header("Authorization", f"Bearer {os.environ['MATON_API_KEY']}")
req.add_header("Content-Type", "application/json")
result = json.load(urllib.request.urlopen(req))
print(f"Open this URL to authorize: {result['connection']['url']}")Open the URL in your browser to complete OAuth authorization.
Usage Examples
Check Unread Emails
import urllib.request, os, json
req = urllib.request.Request(
"https://gateway.maton.ai/outlook/v1.0/me/messages?$filter=isRead eq false&$top=5"
)
req.add_header("Authorization", f"Bearer {os.environ['MATON_API_KEY']}")
messages = json.load(urllib.request.urlopen(req))
for msg in messages.get("value", []):
print(f"From: {msg['from']['emailAddress']['address']}")
print(f"Subject: {msg['subject']}\n")Send an Email
import urllib.request, os, json
email_data = json.dumps({
"message": {
"subject": "Meeting Follow-up",
"body": {
"contentType": "Text",
"content": "Thanks for the meeting. Here are the action items..."
},
"toRecipients": [
{"emailAddress": {"address": "colleague@company.com"}}
]
},
"saveToSentItems": True
}).encode()
req = urllib.request.Request(
"https://gateway.maton.ai/outlook/v1.0/me/sendMail",
data=email_data,
method="POST"
)
req.add_header("Authorization", f"Bearer {os.environ['MATON_API_KEY']}")
req.add_header("Content-Type", "application/json")
urllib.request.urlopen(req)
print("Email sent!")List Today's Calendar Events
import urllib.request, os, json
from datetime import datetime
today = datetime.now().strftime("%Y-%m-%d")
req = urllib.request.Request(
f"https://gateway.maton.ai/outlook/v1.0/me/calendar/events?$filter=start/dateTime ge '{today}'&$top=10"
)
req.add_header("Authorization", f"Bearer {os.environ['MATON_API_KEY']}")
events = json.load(urllib.request.urlopen(req))
for event in events.get("value", []):
print(f"{event['start']['dateTime']} - {event['subject']}")Create a Meeting
import urllib.request, os, json
event_data = json.dumps({
"subject": "Project Sync",
"start": {"dateTime": "2026-02-20T14:00:00", "timeZone": "UTC"},
"end": {"dateTime": "2026-02-20T15:00:00", "timeZone": "UTC"},
"attendees": [
{"emailAddress": {"address": "team@company.com"}, "type": "required"}
]
}).encode()
req = urllib.request.Request(
"https://gateway.maton.ai/outlook/v1.0/me/calendar/events",
data=event_data,
method="POST"
)
req.add_header("Authorization", f"Bearer {os.environ['MATON_API_KEY']}")
req.add_header("Content-Type", "application/json")
result = json.load(urllib.request.urlopen(req))
print(f"Meeting created: {result['webLink']}")Pro Tips
Use OData queries for precision โ The Microsoft Graph API supports powerful filters:
$top=10โ Limit results$filter=isRead eq falseโ Unread only$orderby=receivedDateTime descโ Newest first$select=subject,fromโ Fetch only needed fields (faster)$search="keyword"โ Full-text search
Well-known folder names work as IDs โ Use Inbox, Drafts, SentItems, DeletedItems, Archive, or JunkEmail directly instead of looking up folder IDs.
Multiple Microsoft accounts? โ List connections with the /connections endpoint, then pass Maton-Connection: <connection_id> header to target a specific account.
HTML emails โ Set contentType to HTML and pass formatted HTML in the body content for rich emails.
When to Use This
- Triaging inbox during morning briefings
- Sending follow-up emails after meetings
- Creating calendar events from conversation context
- Looking up contact info mid-conversation
- Moving/organizing emails based on rules you define
Summary
The Outlook skill brings Microsoft 365 email, calendar, and contacts into your Clawdbot workflow. With Maton handling OAuth, setup takes minutes and you get the full power of Microsoft Graph without the complexity.
Links:
Comments (0)
No comments yet. Be the first to comment!