@octokit/webhooks-types
TypeScript type definitions for every GitHub webhook event payload, generated from community-maintained JSON schemas.
Repository Health
Technical Analysis
@octokit/webhooks-types provides TypeScript type definitions for GitHub’s webhook event payloads, covering everything from pushes and pull requests to security alerts and workflow runs. The types are generated automatically from JSON Schemas kept in sync with GitHub’s actual webhook payloads, so consumers get accurate, discriminated-union types like PushEvent, IssuesOpenedEvent, and PullRequestReviewEvent without hand-writing interfaces.
The package ships a single schema.d.ts file with zero runtime code and zero dependencies — it’s imported purely for compile-time type checking in webhook handlers, GitHub Apps, and CI bots that need to safely narrow on an event’s action field.
What You Get
- Full webhook coverage - Types for every GitHub webhook event GitHub publishes, from
pushandpull_requesttodependabot_alertandworkflow_run. - Discriminated unions - Multi-action events are further split into per-action variants (e.g.
IssuesOpenedEvent,IssuesClosedEvent) for precise narrowing. - Zero runtime footprint - Ships only a generated
.d.tsfile with no dependencies, so it adds nothing to bundle size. - Auto-regenerated from schemas - Types are compiled by
json-schema-to-typescriptfrom the community-maintained JSON Schemas in the same monorepo, so they track GitHub’s payload changes.
Common Use Cases
- Typing webhook handlers - Narrow an incoming
WebhookEventpayload to a specific event/action to safely read fields likeissue.titleorpull_request.merged. - Building GitHub Apps - Get compile-time safety across the dozens of event types a GitHub App or bot might receive.
- CI/CD bots - Type-check logic that reacts to
workflow_run,check_suite, ordeployment_statusevents. - Webhook payload validation tooling - Pair the types with
@octokit/webhooksor a custom Express/Fastify handler to catch payload-shape regressions at build time.
Under The Hood
Architecture
The published package is one leaf of the octokit/webhooks monorepo’s generation pipeline: bin/octokit-schema.mts builds a consolidated JSON Schema from community-contributed payload definitions, and bin/octokit-types.mts compiles that schema into payload-types/schema.d.ts via json-schema-to-typescript, including a hand-assembled EventPayloadMap that maps each webhook event name to its generated interface. @octokit/webhooks-types itself is just that output directory packaged for npm — no source files, no build step at install time, and no code path beyond the type declarations.
Tech Stack
The repo is TypeScript/Node (tsx for running .mts scripts), using json-schema-to-typescript and ajv/ajv-formats for schema compilation and validation, got for fetching upstream GitHub documentation, cheerio and turndown for scraping/converting docs into schema fragments, and semantic-release (with per-package pkgRoot npm plugins) to independently version and publish payload-types, payload-schemas, and payload-examples from one repo.
Code Quality
The monorepo validates itself rather than the types package having its own test suite: test.mts uses ajv to assert every example in payload-examples matches a basic webhook-definition shape, and bin/validate-schema.mts/validate-payload-examples.mts cross-check the compiled schema against real payloads. CI runs this validation plus Prettier formatting and CodeQL analysis on every push. The types package itself has no runtime logic to unit test — its correctness is entirely a function of the schema-generation pipeline being validated.
What Makes It Unique
Most API SDKs hand-write their types; this package instead treats GitHub’s webhook shapes as a machine-generated build artifact, with EventPayloadMap giving consumers a single indexable interface across every event/action combination and the README’s explicit strictNullChecks caveat documenting a real inference gotcha other generated-types packages often leave undocumented.
Used by 9 apps in this directory
Botpress
AI Assistants · AI Development · Customer Support
The open-source hub for building and deploying LLM-powered AI agents with TypeScript-first tooling, 40+ integrations, and a revolutionary code-execution agent framework.
flue
AI Agents · Developer Tools
Build autonomous AI agents and powerful workflows with a programmable TypeScript harness that gives any model sessions, tools, sandboxes, and durable execution.
Huly Platform
Project Management · Team Chat · Collaboration
Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.
Infisical
Security · Devops
The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.
Mistle
AI Agents · Developer Tools
Self-hostable platform for running autonomous coding agents in isolated, credentialless sandboxes with brokered credentials, reusable snapshots, and event-driven triggers.
OpenCode
AI Code Assistants
A fully open-source AI coding agent built for the terminal, with a TUI, desktop app, web client, plugin system, and SDK — one of the most-starred AI coding agents on GitHub.
Outline
Knowledge Management · Collaboration
A fast, real-time collaborative knowledge base for growing teams built on React, Node.js, and ProseMirror.
Payload CMS
Developer Tools · Blogging · CMS
The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.
PostHog
Analytics · Monitoring · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.