Register an application in the Twitch Developer Console to obtain a client_id and client_secret; authenticate using the Client Credentials flow (POST https://id.twitch.tv/oauth2/token with grant_type=client_credentials) to get an app access token.
Deploy a publicly accessible HTTPS endpoint (no self-signed certs) that can receive POST requests; Twitch requires the callback URL to respond to a challenge during subscription creation.
Create a subscription by POSTing to https://api.twitch.tv/helix/eventsub/subscriptions with Client-Id: {client_id} and Authorization: Bearer {app_access_token} headers, and a JSON body specifying type (e.g., stream.online), version, condition (e.g., broadcaster_user_id), and transport with method: webhook, callback URL, and a random secret string.
When Twitch sends a POST to your callback URL with a message_type of webhook_callback_verification, respond with HTTP 200 and the challenge string from the request body within a few seconds.
Validate all subsequent event notifications by computing HMAC-SHA256 of the Twitch-Eventsub-Message-Id + Twitch-Eventsub-Message-Timestamp + raw request body using your subscription secret, and comparing to the Twitch-Eventsub-Message-Signature header (prefixed with sha256=).
Acknowledge every valid event notification with a 200 response; Twitch will retry deliveries that do not receive a timely 2xx response.
Known gotchas
The challenge verification step during subscription creation must respond with exactly the challenge string as plain text (not JSON-wrapped) and return HTTP 200 within a strict timeout; any deviation or delay causes subscription creation to fail.
Subscriptions for user-context events (like channel.subscribe) require a user access token with the appropriate scope at subscription creation time, not just the app access token — this is a common source of 403 errors when setting up user-specific event types.
Twitch will disable and delete a subscription if your callback endpoint consistently fails to respond with 2xx; you must monitor subscription status via GET https://api.twitch.tv/helix/eventsub/subscriptions and re-create disabled subscriptions.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp