microsoft-graph-webhooks
БесплатноЗапускает вложенные скриптыНе проверенReceive and verify Microsoft Graph change notifications (webhooks). Use when setting up a Microsoft Graph webhook / subscription handler, completing the…
от hookdeck★ 104 звезды на GitHubОб этом скилле
Microsoft Graph Webhooks
Microsoft Graph delivers change notifications (webhooks) when a resource you
subscribe to — Outlook messages, Teams chatMessages, OneDrive/SharePoint
driveItems, users, groups, presence, and more — is created, updated, or
deleted. There is no HMAC signature and it does not follow the Standard
Webhooks spec. Instead, Graph uses a three-part validation model.
When to Use This Skill
- How do I receive Microsoft Graph webhooks / change notifications?
- How do I respond to the
validationTokenendpoint validation handshake? - How do I validate the
clientStateon a Microsoft Graph notification? - How do I create/renew a Microsoft Graph subscription (they expire fast)?
- How do I decrypt rich notifications with
includeResourceData: true? - How do I handle lifecycle notifications (
reauthorizationRequired,subscriptionRemoved,missed)? - Why is my Microsoft Graph subscription creation failing validation?
The Three-Part Validation Model
- Endpoint validation handshake — On subscription create (and when the
notificationUrlchanges), Graph sendsPOST <notificationUrl>?validationToken={token}with an empty body. You must echo the URL-decoded token back astext/plainwith HTTP 200 within 10 seconds, or the subscription is not created. clientState— An opaque shared secret (max 128 chars) you set when creating the subscription. Graph echoes it in theclientStatefield of every notification. Compare it (timing-safe) to your stored value and reject mismatches — this is what authenticates ordinary notifications.validationTokens(rich notifications only) — When you subscribe withincludeResourceData: true, each POST includes avalidationTokensarray of JWTs signed by the Microsoft identity platform, and the resource data is AES-encrypted. See references/verification.md.
Verification (core)
The two checks every handler needs — the handshake and the clientState compare:
const crypto = require('crypto');
// 1) Endpoint validation handshake.
// Graph sends ?validationToken=... on subscription create/renewal.
// Echo the (already URL-decoded) token back as text/plain, HTTP 200, < 10s.
// e.g. Express: const token = req.query.validationToken;
// if (token) return res.status(200).type('text/plain').send(token);
// 2) clientState — compare the value Graph echoes to your stored secret.
// Timing-safe, length-checked. Reject the notification on mismatch.
function verifyClientState(received, expected) {
if (!received || !expected) return false;
const a = Buffer.from(received);
const b = Buffer.from(expected);
if (a.length !== b.length) return false; // timingSafeEqual throws on length mismatch
return crypto.timingSafeEqual(a, b);
}
For complete handlers with tests (handshake + clientState + change/lifecycle dispatch, plus a subscribe/renew helper), see examples/express/, examples/nextjs/, examples/fastapi/.
Notification Payload
A basic notification (includeResourceData: false) is a batch under value:
{
"value": [
{
"subscriptionId": "b3a...guid",
"subscriptionExpirationDateTime": "2026-07-22T22:11:09.952Z",
"changeType": "updated",
"resource": "Users/{user-id}/messages/{message-id}",
"clientState": "your-opaque-secret",
"tenantId": "84bd8158-6d4d-4958-8b9f-9d6445542f95",
"resourceData": {
"@odata.type": "#Microsoft.Graph.Message",
"@odata.id": "Users/{user-id}/Messages/{message-id}",
"id": "{message-id}"
}
}
]
}
Return 202 Accepted within 3 seconds (queue heavy work, process async).
Graph retries failed deliveries with backoff for up to 4 hours.
Change Types (events)
Subscribe with one or more, comma-combined (e.g. "created,updated"):
changeType |
Fires when | Notes |
|---|---|---|
created |
A matching resource is created | Not supported for user/group |
updated |
A matching resource is updated | Only value supported by driveItem root / SharePoint list |
deleted |
A matching resource is deleted (or soft-deleted) |
Lifecycle Events
Sent to a separate lifecycleNotificationUrl in the lifecycleEvent field.
Acknowledge each with 202 Accepted, then act:
lifecycleEvent |
Meaning | Action |
|---|---|---|
reauthorizationRequired |
Subscription/token about to expire or permissions changed | POST /subscriptions/{id}/reauthorize and/or PATCH a new expirationDateTime |
subscriptionRemoved |
Graph removed the subscription | Recreate it, then resync via delta query |
missed |
One or more notifications could not be delivered | Resync missed data via delta query |
Subscription Lifetimes (renew before expiry)
Graph enforces s
Установить microsoft-graph-webhooks в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл microsoft-graph-webhooks?
Receive and verify Microsoft Graph change notifications (webhooks). Use when setting up a Microsoft Graph webhook / subscription handler, completing the validationToken endpoint validation handshake, validating clientState, decrypting rich notifications (includeResourceData), handling lifecycle events (reauthorizationRequired, subscriptionRemoved, missed), or processing created/updated/deleted change notifications for Outlook mail, Teams messages, OneDrive/SharePoint driveItems, users, and groups.
Как установить скилл microsoft-graph-webhooks?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл microsoft-graph-webhooks запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic