Skip to content

Repository files navigation

Office Webhook Agent

Autocomplete for office work.

SWE + IDE                          Office Worker + This Agent
─────────────────────────────────  ─────────────────────────────────
Type code → suggestions appear     Meeting ends → minutes drafted
Commit → CI runs tests             Email arrives → response drafted
PR opened → linter checks          Calendar event → briefing prepared
Review & approve                   Review & approve

The human reviews instead of drafts from scratch.

How It Works

Microsoft 365 Event  →  Webhook  →  Claude Agent  →  Completed Work
     (trigger)          (catch)      (execute)        (review)
  1. Something happens in Microsoft 365 (meeting ends, email arrives, event approaches)
  2. Webhook fires to this agent
  3. Claude executes your custom workflow (slash command)
  4. You review the output

Architecture

Workflows are slash commands in your Claude Code project:

your-claude-project/
├── .mcp.json                    # MCP servers (office-mcp, etc.)
├── CLAUDE.md                    # System context
└── .claude/commands/
    ├── meetingminutes.md        # Meeting transcript workflow
    ├── email_responder.md       # Email workflow
    └── brief.md                 # Calendar prep workflow

Edit a slash command → changes apply on next webhook. No code deployment.

This agent is the webhook receiver and router. The workflows live in your Claude Code project.

Supported Workflows

Trigger Slash Command Output
Teams transcript ready /meetingminutes Email to attendees + Planner tasks
Email received /email_responder Draft response (not sent)
Calendar event approaching /brief Briefing with context

Add more by creating slash commands and webhook subscriptions.

Prerequisites

  • Python 3.11+
  • Claude Max subscription with Claude Code CLI authenticated
  • Microsoft 365 account
  • Azure AD App Registration with Graph API permissions
  • office-mcp for Microsoft 365 integration
  • Cloudflare Tunnel (or similar) for public webhook URL

Quick Start

1. Install

git clone https://github.com/your-username/office-webhook-agent.git
cd office-webhook-agent
python3 -m venv venv
source venv/bin/activate
pip install -e .

2. Configure

cp .env.example .env
# Edit .env with your settings

Key settings:

  • CLAUDE_PROJECT_DIR — Your Claude Code project with MCP servers and slash commands
  • WEBHOOK_URL — Public URL for Microsoft Graph notifications
  • GRAPH_CLIENT_ID / GRAPH_CLIENT_SECRET — Azure AD app credentials
  • USER_ID — Your Microsoft 365 user ID

3. Set Up Webhook URL

export TUNNEL_DOMAIN=your-domain.com
export TUNNEL_SUBDOMAIN=webhook
./scripts/setup_tunnel.sh

4. Start

# Terminal 1: Webhook server
./start.sh

# Terminal 2: Tunnel
cloudflared tunnel run office-webhook

# Terminal 3: Create subscription
python scripts/create_subscription.py

5. Test

Schedule a Teams meeting with transcription. When it ends, the agent:

  1. Receives the transcript webhook
  2. Executes /meetingminutes
  3. Sends minutes to attendees
  4. Creates Planner tasks for action items

Production

Systemd Service

sudo cp office-webhook-agent.service.example /etc/systemd/system/office-webhook-agent.service
sudo nano /etc/systemd/system/office-webhook-agent.service  # Edit paths
sudo systemctl daemon-reload
sudo systemctl enable office-webhook-agent
sudo systemctl start office-webhook-agent

Auto-Renewal

The agent renews Microsoft Graph subscriptions before expiry.

Adding Workflows

  1. Create slash command in your Claude Code project
  2. Add subscription in src/subscriptions/manager.py
  3. Add handler in src/webhook/handler.py
  4. Restart

Project Structure

office-webhook-agent/
├── src/
│   ├── main.py                 # FastAPI application
│   ├── config/settings.py      # Configuration
│   ├── webhook/handler.py      # Webhook routing
│   ├── agent/
│   │   ├── meeting_minutes.py  # Claude Code SDK executor
│   │   └── system_prompt.py    # Webhook → slash command routing
│   ├── subscriptions/          # Graph API subscription management
│   └── graph/                  # Authentication
├── scripts/
│   ├── setup_tunnel.sh
│   └── create_subscription.py
├── .env.example
└── office-webhook-agent.service.example

Security

  • Agent runs with bypassPermissions for autonomous execution
  • Implement clientState validation for production webhooks
  • Graph API tokens stored locally; set appropriate file permissions

Troubleshooting

Webhook not receiving:

  1. Verify tunnel: curl https://your-webhook-url/health
  2. Check subscription: curl http://localhost:8000/status
  3. Logs: journalctl -u office-webhook-agent -f

Authentication errors:

  1. Re-authenticate office-mcp
  2. Verify token file at GRAPH_TOKEN_PATH
  3. Check Azure AD app permissions

Slash command not found:

  1. Verify CLAUDE_PROJECT_DIR
  2. Check command exists in .claude/commands/
  3. Test in Claude Code CLI

License

MIT

About

Autocomplete for office work. Claude Code SDK agent that processes Microsoft 365 webhooks (Teams transcripts, emails, calendar) and executes custom slash command workflows.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages