[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M793WW1B3G5993JF86MSZWZ8":3,"skill-same:01M793WW1B3G5993JF86MSZWZ8":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":6,"ownerHtmlUrl":38,"ownerBlogUrl":39,"ownerDescription":40,"updatedAt":41,"install":42,"resources":55},"01M793WW1B3G5993JF86MSZWZ8","onenote-webhooks-events",null,"Implement change detection for OneNote using polling and delta queries (webhooks decommissioned June 2023).\nUse when building real-time sync, change monitoring, or event-driven OneNote integrations.\nTrigger with \"onenote changes\", \"onenote polling\", \"onenote sync\", \"onenote delta query\".","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--onenote-pack--onenote-webhooks-events\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: onenote-webhooks-events\ndescription: |\n  Implement change detection for OneNote using polling and delta queries (webhooks decommissioned June 2023).\n  Use when building real-time sync, change monitoring, or event-driven OneNote integrations.\n  Trigger with \"onenote changes\", \"onenote polling\", \"onenote sync\", \"onenote delta query\".\nallowed-tools: Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ntags: [saas, onenote, microsoft]\ncompatible-with: claude-code\n---\n\n# OneNote — Change Detection (Polling & Delta Queries)\n\n## Overview\n\n> **OneNote webhooks were decommissioned June 16, 2023.** The Graph subscription API (`POST \u002Fsubscriptions` with `changeType: \"updated\"` on OneNote resources) returns `400 Bad Request`. Unlike Outlook mail, calendar, and OneDrive — which still support push notifications — OneNote has no webhook replacement. You must poll.\n\nThis skill implements efficient change detection for OneNote using `lastModifiedDateTime` comparisons, delta query patterns, and rate-limit-aware polling intervals. The approach balances freshness (detecting changes within minutes) against the 600 requests\u002Fminute per-user rate limit.\n\nKey pain points addressed:\n- Subscription API for OneNote resources returns `400` — do not attempt it\n- Delta queries (`\u002Fme\u002Fonenote\u002Fpages\u002Fdelta`) are not officially documented but work on some tenants\n- Polling must stay within rate budget (600\u002Fmin per user, 10,000\u002F10min per tenant)\n- Change detection requires comparing timestamps, not content diffs (output HTML is unstable)\n\n## Prerequisites\n\n- Azure app registration with delegated permissions: `Notes.Read` or `Notes.ReadWrite`\n- App-only auth deprecated March 31, 2025 — use delegated auth only\n- Python: `pip install msgraph-sdk azure-identity`\n- Node\u002FTypeScript: `npm install @microsoft\u002Fmicrosoft-graph-client @azure\u002Fidentity @azure\u002Fmsal-node`\n- A persistent store for tracking last-seen timestamps (Redis, SQLite, file system)\n\n## Instructions\n\n### Step 1 — Understand Why Webhooks Do Not Work\n\n```typescript\n\u002F\u002F DO NOT DO THIS — it will return 400 Bad Request\n\u002F\u002F OneNote webhooks decommissioned June 16, 2023\nconst subscription = await client.api(\"\u002Fsubscriptions\").post({\n  changeType: \"updated\",\n  notificationUrl: \"https:\u002F\u002Fyourapp.com\u002Fwebhooks\u002Fonenote\",\n  resource: \"\u002Fme\u002Fonenote\u002Fpages\",  \u002F\u002F NOT SUPPORTED\n  expirationDateTime: new Date(Date.now() + 3600000).toISOString(),\n});\n\u002F\u002F Error: \"Subscription validation request failed. Resource not found.\"\n```\n\nFor comparison, these Graph resources still support webhooks: Outlook messages, calendar events, OneDrive files, Teams messages, Planner tasks. OneNote is the notable exception.\n\n### Step 2 — Implement Timestamp-Based Polling (TypeScript)\n\nThe core pattern: periodically list pages ordered by `lastModifiedDateTime` and compare against your stored watermark.\n\n```typescript\nimport { Client } from \"@microsoft\u002Fmicrosoft-graph-client\";\n\ninterface ChangeEvent {\n  pageId: string;\n  title: string;\n  sectionId: string;\n  modifiedAt: string;\n  changeType: \"created\" | \"modified\";\n}\n\nclass OneNotePoller {\n  private watermarks: Map\u003Cstring, string> = new Map(); \u002F\u002F sectionId → ISO timestamp\n  private intervalMs: number;\n  private timer: NodeJS.Timeout | null = null;\n  private client: Client;\n  private onChanges: (events: ChangeEvent[]) => void;\n\n  constructor(\n    client: Client,\n    onChanges: (events: ChangeEvent[]) => void,\n    intervalSeconds: number = 30  \u002F\u002F Poll every 30s — uses ~2 req\u002Fmin per section\n  ) {\n    this.client = client;\n    this.onChanges = onChanges;\n    this.intervalMs = intervalSeconds * 1000;\n  }\n\n  async start(sectionIds: string[]): Promise\u003Cvoid> {\n    \u002F\u002F Initialize watermarks to \"now\" to avoid processing historical pages\n    const now = new Date().toISOString();\n    for (const id of sectionIds) {\n      this.watermarks.set(id, now);\n    }\n    this.timer = setInterval(() => this.poll(sectionIds), this.intervalMs);\n    console.log(`Polling ${sectionIds.length} sections every ${this.intervalMs \u002F 1000}s`);\n  }\n\n  stop(): void {\n    if (this.timer) clearInterval(this.timer);\n  }\n\n  private async poll(sectionIds: string[]): Promise\u003Cvoid> {\n    const allChanges: ChangeEvent[] = [];\n\n    for (const sectionId of sectionIds) {\n      try {\n        const watermark = this.watermarks.get(sectionId)!;\n        const pages = await this.client.api(\n          `\u002Fme\u002Fonenote\u002Fsections\u002F${sectionId}\u002Fpages`\n        )\n          .select(\"id,title,lastModifiedDateTime,createdDateTime\")\n          .filter(`lastModifiedDateTime ge ${watermark}`)\n          .orderby(\"lastModifiedDateTime desc\")\n          .top(50)\n          .get();\n\n        for (const page of pages.value ?? []) {\n          if (!page.title) continue; \u002F\u002F Skip deleted pages (null title)\n          const isNew = page.createdDateTime === page.lastModifiedDateTime;\n          allChanges.push({\n            pageId: page.id,\n            title: page.title,\n            sectionId,\n            modifiedAt: page.lastModifiedDateTime,\n            changeType: isNew ? \"created\" : \"modified\",\n          });\n        }\n\n        \u002F\u002F Advance watermark\n        if (pages.value?.length > 0) {\n          this.watermarks.set(sectionId, pages.value[0].lastModifiedDateTime);\n        }\n      } catch (err: any) {\n        if (err.statusCode === 429) {\n          const retryAfter = parseInt(err.headers?.[\"retry-after\"] ?? \"60\", 10);\n          console.warn(`Rate limited on section ${sectionId}, backing off ${retryAfter}s`);\n          await new Promise((r) => setTimeout(r, retryAfter * 1000));\n        } else {\n          console.error(`Poll error for section ${sectionId}:`, err.message);\n        }\n      }\n    }\n\n    if (allChanges.length > 0) {\n      this.onChanges(allChanges);\n    }\n  }\n}\n```\n\n### Step 3 — Rate Budget Planning\n\nWith a 600 requests\u002Fminute per-user limit, plan your polling capacity:\n\n| Sections Monitored | Poll Interval | Requests\u002FMin | Budget Used |\n|---|---|---|---|\n| 5 | 30s | 10 | 1.7% |\n| 20 | 30s | 40 | 6.7% |\n| 50 | 60s | 50 | 8.3% |\n| 100 | 60s | 100 | 16.7% |\n| 200 | 120s | 100 | 16.7% |\n\nReserve at least 50% of your rate budget for user-initiated operations (CRUD, search). If monitoring 100+ sections, increase the poll interval to 120s or use the tiered approach below.\n\n### Step 4 — Tiered Polling (Prioritize Active Sections)\n\nNot all sections change equally. Poll recently-active sections more frequently:\n\n```typescript\ninterface TieredSection {\n  id: string;\n  tier: \"hot\" | \"warm\" | \"cold\";\n  lastChange: Date;\n}\n\nfunction assignTier(lastChange: Date): \"hot\" | \"warm\" | \"cold\" {\n  const ageMs = Date.now() - lastChange.getTime();\n  const oneHour = 3600_000;\n  const oneDay = 86400_000;\n  if (ageMs \u003C oneHour) return \"hot\";     \u002F\u002F Changed in last hour\n  if (ageMs \u003C oneDay) return \"warm\";     \u002F\u002F Changed in last day\n  return \"cold\";                          \u002F\u002F Stale\n}\n\nconst pollIntervals = {\n  hot: 15_000,    \u002F\u002F 15 seconds\n  warm: 120_000,  \u002F\u002F 2 minutes\n  cold: 600_000,  \u002F\u002F 10 minutes\n};\n\u002F\u002F Re-evaluate tiers after each poll cycle\n```\n\n### Step 5 — Python Async Polling\n\n```python\nimport asyncio\nfrom datetime import datetime, timezone\nfrom msgraph import GraphServiceClient\n\nclass OneNotePoller:\n    def __init__(self, client: GraphServiceClient, interval_seconds: int = 30):\n        self.client = client\n        self.interval = interval_seconds\n        self.watermarks: dict[str, str] = {}\n        self._running = False\n\n    async def start(self, section_ids: list[str], callback):\n        \"\"\"Start polling sections for changes.\"\"\"\n        self._running = True\n        now = datetime.now(timezone.utc).isoformat()\n        for sid in section_ids:\n            self.watermarks[sid] = now\n\n        while self._running:\n            changes = []\n            for sid in section_ids:\n                try:\n                    pages = await self.client.me.onenote.sections.by_onenote_section_id(\n                        sid\n                    ).pages.get()\n\n                    for page in (pages.value or []):\n                        if not page.title:\n                            continue\n                        modified = page.last_modified_date_time.isoformat()\n                        if modified > self.watermarks[sid]:\n                            changes.append({\n                                \"page_id\": page.id,\n                                \"title\": page.title,\n                                \"section_id\": sid,\n                                \"modified_at\": modified,\n                            })\n                            self.watermarks[sid] = max(self.watermarks[sid], modified)\n                except Exception as e:\n                    print(f\"Poll error for {sid}: {e}\")\n\n            if changes:\n                await callback(changes)\n\n            await asyncio.sleep(self.interval)\n\n    def stop(self):\n        self._running = False\n```\n\n### Step 6 — Event Processing Pipeline\n\nStructure your change handler to decouple detection from processing:\n\n```typescript\ninterface ChangeProcessor {\n  type: string;\n  match: (event: ChangeEvent) => boolean;\n  handle: (event: ChangeEvent, client: Client) => Promise\u003Cvoid>;\n}\n\nconst processors: ChangeProcessor[] = [\n  {\n    type: \"sync-to-database\",\n    match: (e) => e.changeType === \"modified\",\n    handle: async (e, client) => {\n      const content = await client.api(`\u002Fme\u002Fonenote\u002Fpages\u002F${e.pageId}\u002Fcontent`).get();\n      \u002F\u002F Parse HTML, extract structured data, upsert to your DB\n    },\n  },\n  {\n    type: \"notify-team\",\n    match: (e) => e.changeType === \"created\",\n    handle: async (e) => {\n      \u002F\u002F Send Slack\u002FTeams notification for new pages\n      console.log(`New page: \"${e.title}\" in section ${e.sectionId}`);\n    },\n  },\n];\n\n\u002F\u002F In your poller callback:\nasync function processChanges(events: ChangeEvent[], client: Client) {\n  for (const event of events) {\n    for (const proc of processors) {\n      if (proc.match(event)) {\n        await proc.handle(event, client);\n      }\n    }\n  }\n}\n```\n\n## Output\n\nThe polling service produces change events with:\n- `pageId` — Graph resource ID for the changed page\n- `title` — Page title (null for deleted pages, which are filtered out)\n- `sectionId` — Parent section identifier\n- `modifiedAt` — ISO 8601 timestamp of the change\n- `changeType` — `\"created\"` if `createdDateTime === lastModifiedDateTime`, otherwise `\"modified\"`\n\n## Error Handling\n\n| Status | Cause | Fix |\n|--------|-------|-----|\n| 400 | Attempted webhook subscription on OneNote resource | Use polling — webhooks decommissioned June 2023 |\n| 429 | Polling too aggressively | Read `Retry-After` header; increase poll interval; use tiered polling |\n| 404 | Section deleted between polls | Remove section from poll list; log and continue |\n| 502 | Token expired mid-poll | Refresh credentials; MSAL handles this automatically with `DeviceCodeCredential` |\n| 500 | Graph service error | Retry with exponential backoff; do not count toward change detection |\n\n## Examples\n\n**Quick start — monitor a single section:**\n```typescript\nconst poller = new OneNotePoller(client, (changes) => {\n  changes.forEach((c) => console.log(`[${c.changeType}] ${c.title} at ${c.modifiedAt}`));\n}, 30);\n\nawait poller.start([\"section-id-here\"]);\n\u002F\u002F Output: [modified] Sprint Planning at 2026-03-23T15:30:00Z\n```\n\n**Production setup — tiered polling with error recovery:**\n```typescript\nconst sections = await client.api(\"\u002Fme\u002Fonenote\u002Fnotebooks\u002F{id}\u002Fsections\")\n  .select(\"id,displayName,lastModifiedDateTime\")\n  .get();\n\nconst tiered = sections.value.map((s) => ({\n  id: s.id,\n  tier: assignTier(new Date(s.lastModifiedDateTime)),\n  lastChange: new Date(s.lastModifiedDateTime),\n}));\n\n\u002F\u002F Start separate pollers per tier\nconst hotSections = tiered.filter((s) => s.tier === \"hot\").map((s) => s.id);\nconst warmSections = tiered.filter((s) => s.tier === \"warm\").map((s) => s.id);\n```\n\n## Resources\n\n- [OneNote API Overview](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fapi\u002Fresources\u002Fonenote-api-overview)\n- [Integration Guide](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fintegrate-with-onenote)\n- [Best Practices](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fonenote-best-practices)\n- [Known Issues](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fknown-issues)\n- [Error Codes](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fonenote-error-codes)\n- [Graph API Reference](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fapi\u002Foverview)\n\n## Next Steps\n\n- See `onenote-rate-limits` for rate budget management when polling many sections\n- See `onenote-core-workflow-b` for cross-notebook search if polling detects changes you need to query\n- See `onenote-performance-tuning` for caching notebook\u002Fsection structure to reduce poll overhead\n","# OneNote — Change Detection (Polling & Delta Queries)\n\n## Overview\n\n> **OneNote webhooks were decommissioned June 16, 2023.** The Graph subscription API (`POST \u002Fsubscriptions` with `changeType: \"updated\"` on OneNote resources) returns `400 Bad Request`. Unlike Outlook mail, calendar, and OneDrive — which still support push notifications — OneNote has no webhook replacement. You must poll.\n\nThis skill implements efficient change detection for OneNote using `lastModifiedDateTime` comparisons, delta query patterns, and rate-limit-aware polling intervals. The approach balances freshness (detecting changes within minutes) against the 600 requests\u002Fminute per-user rate limit.\n\nKey pain points addressed:\n- Subscription API for OneNote resources returns `400` — do not attempt it\n- Delta queries (`\u002Fme\u002Fonenote\u002Fpages\u002Fdelta`) are not officially documented but work on some tenants\n- Polling must stay within rate budget (600\u002Fmin per user, 10,000\u002F10min per tenant)\n- Change detection requires comparing timestamps, not content diffs (output HTML is unstable)\n\n## Prerequisites\n\n- Azure app registration with delegated permissions: `Notes.Read` or `Notes.ReadWrite`\n- App-only auth deprecated March 31, 2025 — use delegated auth only\n- Python: `pip install msgraph-sdk azure-identity`\n- Node\u002FTypeScript: `npm install @microsoft\u002Fmicrosoft-graph-client @azure\u002Fidentity @azure\u002Fmsal-node`\n- A persistent store for tracking last-seen timestamps (Redis, SQLite, file system)\n\n## Instructions\n\n### Step 1 — Understand Why Webhooks Do Not Work\n\n```typescript\n\u002F\u002F DO NOT DO THIS — it will return 400 Bad Request\n\u002F\u002F OneNote webhooks decommissioned June 16, 2023\nconst subscription = await client.api(\"\u002Fsubscriptions\").post({\n  changeType: \"updated\",\n  notificationUrl: \"https:\u002F\u002Fyourapp.com\u002Fwebhooks\u002Fonenote\",\n  resource: \"\u002Fme\u002Fonenote\u002Fpages\",  \u002F\u002F NOT SUPPORTED\n  expirationDateTime: new Date(Date.now() + 3600000).toISOString(),\n});\n\u002F\u002F Error: \"Subscription validation request failed. Resource not found.\"\n```\n\nFor comparison, these Graph resources still support webhooks: Outlook messages, calendar events, OneDrive files, Teams messages, Planner tasks. OneNote is the notable exception.\n\n### Step 2 — Implement Timestamp-Based Polling (TypeScript)\n\nThe core pattern: periodically list pages ordered by `lastModifiedDateTime` and compare against your stored watermark.\n\n```typescript\nimport { Client } from \"@microsoft\u002Fmicrosoft-graph-client\";\n\ninterface ChangeEvent {\n  pageId: string;\n  title: string;\n  sectionId: string;\n  modifiedAt: string;\n  changeType: \"created\" | \"modified\";\n}\n\nclass OneNotePoller {\n  private watermarks: Map\u003Cstring, string> = new Map(); \u002F\u002F sectionId → ISO timestamp\n  private intervalMs: number;\n  private timer: NodeJS.Timeout | null = null;\n  private client: Client;\n  private onChanges: (events: ChangeEvent[]) => void;\n\n  constructor(\n    client: Client,\n    onChanges: (events: ChangeEvent[]) => void,\n    intervalSeconds: number = 30  \u002F\u002F Poll every 30s — uses ~2 req\u002Fmin per section\n  ) {\n    this.client = client;\n    this.onChanges = onChanges;\n    this.intervalMs = intervalSeconds * 1000;\n  }\n\n  async start(sectionIds: string[]): Promise\u003Cvoid> {\n    \u002F\u002F Initialize watermarks to \"now\" to avoid processing historical pages\n    const now = new Date().toISOString();\n    for (const id of sectionIds) {\n      this.watermarks.set(id, now);\n    }\n    this.timer = setInterval(() => this.poll(sectionIds), this.intervalMs);\n    console.log(`Polling ${sectionIds.length} sections every ${this.intervalMs \u002F 1000}s`);\n  }\n\n  stop(): void {\n    if (this.timer) clearInterval(this.timer);\n  }\n\n  private async poll(sectionIds: string[]): Promise\u003Cvoid> {\n    const allChanges: ChangeEvent[] = [];\n\n    for (const sectionId of sectionIds) {\n      try {\n        const watermark = this.watermarks.get(sectionId)!;\n        const pages = await this.client.api(\n          `\u002Fme\u002Fonenote\u002Fsections\u002F${sectionId}\u002Fpages`\n        )\n          .select(\"id,title,lastModifiedDateTime,createdDateTime\")\n          .filter(`lastModifiedDateTime ge ${watermark}`)\n          .orderby(\"lastModifiedDateTime desc\")\n          .top(50)\n          .get();\n\n        for (const page of pages.value ?? []) {\n          if (!page.title) continue; \u002F\u002F Skip deleted pages (null title)\n          const isNew = page.createdDateTime === page.lastModifiedDateTime;\n          allChanges.push({\n            pageId: page.id,\n            title: page.title,\n            sectionId,\n            modifiedAt: page.lastModifiedDateTime,\n            changeType: isNew ? \"created\" : \"modified\",\n          });\n        }\n\n        \u002F\u002F Advance watermark\n        if (pages.value?.length > 0) {\n          this.watermarks.set(sectionId, pages.value[0].lastModifiedDateTime);\n        }\n      } catch (err: any) {\n        if (err.statusCode === 429) {\n          const retryAfter = parseInt(err.headers?.[\"retry-after\"] ?? \"60\", 10);\n          console.warn(`Rate limited on section ${sectionId}, backing off ${retryAfter}s`);\n          await new Promise((r) => setTimeout(r, retryAfter * 1000));\n        } else {\n          console.error(`Poll error for section ${sectionId}:`, err.message);\n        }\n      }\n    }\n\n    if (allChanges.length > 0) {\n      this.onChanges(allChanges);\n    }\n  }\n}\n```\n\n### Step 3 — Rate Budget Planning\n\nWith a 600 requests\u002Fminute per-user limit, plan your polling capacity:\n\n| Sections Monitored | Poll Interval | Requests\u002FMin | Budget Used |\n|---|---|---|---|\n| 5 | 30s | 10 | 1.7% |\n| 20 | 30s | 40 | 6.7% |\n| 50 | 60s | 50 | 8.3% |\n| 100 | 60s | 100 | 16.7% |\n| 200 | 120s | 100 | 16.7% |\n\nReserve at least 50% of your rate budget for user-initiated operations (CRUD, search). If monitoring 100+ sections, increase the poll interval to 120s or use the tiered approach below.\n\n### Step 4 — Tiered Polling (Prioritize Active Sections)\n\nNot all sections change equally. Poll recently-active sections more frequently:\n\n```typescript\ninterface TieredSection {\n  id: string;\n  tier: \"hot\" | \"warm\" | \"cold\";\n  lastChange: Date;\n}\n\nfunction assignTier(lastChange: Date): \"hot\" | \"warm\" | \"cold\" {\n  const ageMs = Date.now() - lastChange.getTime();\n  const oneHour = 3600_000;\n  const oneDay = 86400_000;\n  if (ageMs \u003C oneHour) return \"hot\";     \u002F\u002F Changed in last hour\n  if (ageMs \u003C oneDay) return \"warm\";     \u002F\u002F Changed in last day\n  return \"cold\";                          \u002F\u002F Stale\n}\n\nconst pollIntervals = {\n  hot: 15_000,    \u002F\u002F 15 seconds\n  warm: 120_000,  \u002F\u002F 2 minutes\n  cold: 600_000,  \u002F\u002F 10 minutes\n};\n\u002F\u002F Re-evaluate tiers after each poll cycle\n```\n\n### Step 5 — Python Async Polling\n\n```python\nimport asyncio\nfrom datetime import datetime, timezone\nfrom msgraph import GraphServiceClient\n\nclass OneNotePoller:\n    def __init__(self, client: GraphServiceClient, interval_seconds: int = 30):\n        self.client = client\n        self.interval = interval_seconds\n        self.watermarks: dict[str, str] = {}\n        self._running = False\n\n    async def start(self, section_ids: list[str], callback):\n        \"\"\"Start polling sections for changes.\"\"\"\n        self._running = True\n        now = datetime.now(timezone.utc).isoformat()\n        for sid in section_ids:\n            self.watermarks[sid] = now\n\n        while self._running:\n            changes = []\n            for sid in section_ids:\n                try:\n                    pages = await self.client.me.onenote.sections.by_onenote_section_id(\n                        sid\n                    ).pages.get()\n\n                    for page in (pages.value or []):\n                        if not page.title:\n                            continue\n                        modified = page.last_modified_date_time.isoformat()\n                        if modified > self.watermarks[sid]:\n                            changes.append({\n                                \"page_id\": page.id,\n                                \"title\": page.title,\n                                \"section_id\": sid,\n                                \"modified_at\": modified,\n                            })\n                            self.watermarks[sid] = max(self.watermarks[sid], modified)\n                except Exception as e:\n                    print(f\"Poll error for {sid}: {e}\")\n\n            if changes:\n                await callback(changes)\n\n            await asyncio.sleep(self.interval)\n\n    def stop(self):\n        self._running = False\n```\n\n### Step 6 — Event Processing Pipeline\n\nStructure your change handler to decouple detection from processing:\n\n```typescript\ninterface ChangeProcessor {\n  type: string;\n  match: (event: ChangeEvent) => boolean;\n  handle: (event: ChangeEvent, client: Client) => Promise\u003Cvoid>;\n}\n\nconst processors: ChangeProcessor[] = [\n  {\n    type: \"sync-to-database\",\n    match: (e) => e.changeType === \"modified\",\n    handle: async (e, client) => {\n      const content = await client.api(`\u002Fme\u002Fonenote\u002Fpages\u002F${e.pageId}\u002Fcontent`).get();\n      \u002F\u002F Parse HTML, extract structured data, upsert to your DB\n    },\n  },\n  {\n    type: \"notify-team\",\n    match: (e) => e.changeType === \"created\",\n    handle: async (e) => {\n      \u002F\u002F Send Slack\u002FTeams notification for new pages\n      console.log(`New page: \"${e.title}\" in section ${e.sectionId}`);\n    },\n  },\n];\n\n\u002F\u002F In your poller callback:\nasync function processChanges(events: ChangeEvent[], client: Client) {\n  for (const event of events) {\n    for (const proc of processors) {\n      if (proc.match(event)) {\n        await proc.handle(event, client);\n      }\n    }\n  }\n}\n```\n\n## Output\n\nThe polling service produces change events with:\n- `pageId` — Graph resource ID for the changed page\n- `title` — Page title (null for deleted pages, which are filtered out)\n- `sectionId` — Parent section identifier\n- `modifiedAt` — ISO 8601 timestamp of the change\n- `changeType` — `\"created\"` if `createdDateTime === lastModifiedDateTime`, otherwise `\"modified\"`\n\n## Error Handling\n\n| Status | Cause | Fix |\n|--------|-------|-----|\n| 400 | Attempted webhook subscription on OneNote resource | Use polling — webhooks decommissioned June 2023 |\n| 429 | Polling too aggressively | Read `Retry-After` header; increase poll interval; use tiered polling |\n| 404 | Section deleted between polls | Remove section from poll list; log and continue |\n| 502 | Token expired mid-poll | Refresh credentials; MSAL handles this automatically with `DeviceCodeCredential` |\n| 500 | Graph service error | Retry with exponential backoff; do not count toward change detection |\n\n## Examples\n\n**Quick start — monitor a single section:**\n```typescript\nconst poller = new OneNotePoller(client, (changes) => {\n  changes.forEach((c) => console.log(`[${c.changeType}] ${c.title} at ${c.modifiedAt}`));\n}, 30);\n\nawait poller.start([\"section-id-here\"]);\n\u002F\u002F Output: [modified] Sprint Planning at 2026-03-23T15:30:00Z\n```\n\n**Production setup — tiered polling with error recovery:**\n```typescript\nconst sections = await client.api(\"\u002Fme\u002Fonenote\u002Fnotebooks\u002F{id}\u002Fsections\")\n  .select(\"id,displayName,lastModifiedDateTime\")\n  .get();\n\nconst tiered = sections.value.map((s) => ({\n  id: s.id,\n  tier: assignTier(new Date(s.lastModifiedDateTime)),\n  lastChange: new Date(s.lastModifiedDateTime),\n}));\n\n\u002F\u002F Start separate pollers per tier\nconst hotSections = tiered.filter((s) => s.tier === \"hot\").map((s) => s.id);\nconst warmSections = tiered.filter((s) => s.tier === \"warm\").map((s) => s.id);\n```\n\n## Resources\n\n- [OneNote API Overview](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fapi\u002Fresources\u002Fonenote-api-overview)\n- [Integration Guide](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fintegrate-with-onenote)\n- [Best Practices](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fonenote-best-practices)\n- [Known Issues](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fknown-issues)\n- [Error Codes](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fonenote-error-codes)\n- [Graph API Reference](https:\u002F\u002Flearn.microsoft.com\u002Fen-us\u002Fgraph\u002Fapi\u002Foverview)\n\n## Next Steps\n\n- See `onenote-rate-limits` for rate budget management when polling many sections\n- See `onenote-core-workflow-b` for cross-notebook search if polling detects changes you need to query\n- See `onenote-performance-tuning` for caching notebook\u002Fsection structure to reduce poll overhead\n",{"name":5,"tags":24,"author":28,"license":15,"version":29,"description":30,"allowed-tools":31,"compatible-with":32},[25,26,27],"saas","onenote","microsoft","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Implement change detection for OneNote using polling and delta queries (webhooks decommissioned June 2023).\nUse when building real-time sync, change monitoring, or event-driven OneNote integrations.\nTrigger with \"onenote changes\", \"onenote polling\", \"onenote sync\", \"onenote delta query\".\n","Read, Write, Edit, Bash(npm:*), Bash(pip:*), Grep","claude-code","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fsaas-packs--onenote-pack--onenote-webhooks-events",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":43,"prompt":53,"zipAvailable":54},[44,47,50],{"tool":45,"command":46},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill onenote-webhooks-events",{"tool":48,"command":49},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill onenote-webhooks-events",{"tool":51,"command":52},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill onenote-webhooks-events","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--onenote-pack--onenote-webhooks-events\u002FSKILL.md",true,[],[57,64,71,78,85,93],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":89,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]