Subscribe to Twitch EventSub events via WebSocket transport for real-time in-game notifications

domain: dev.twitch.tv · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Obtain a user access token with the required scopes for your desired event types (e.g., channel.follow requires moderator:read:followers scope) using the OAuth authorization code flow.
  2. Connect to the Twitch EventSub WebSocket endpoint; immediately after connection, receive a session_welcome message containing a session_id.
  3. Create a subscription by calling the EventSub Subscriptions API (POST to the subscriptions endpoint) with the event type, version, condition (e.g., broadcaster_user_id), transport type of websocket, and the session_id from the welcome message.
  4. Listen for notification messages on the WebSocket; each message contains a subscription object and an event payload specific to the subscribed event type.
  5. Respond to keepalive messages within the keepalive_timeout_seconds value specified in the welcome message; if no message arrives within that window, the connection is considered dead and must be re-established.
  6. Handle reconnect messages by connecting to the provided reconnect_url before closing the old connection, then migrate subscriptions to the new session.

Known gotchas

Related routes

Subscribe to Twitch EventSub stream.online webhook event
dev.twitch.tv · 6 steps · unrated
Subscribe to Twitch EventSub webhook events for live stream and channel point redemption notifications
dev.twitch.tv · 6 steps · unrated
Scale Twitch EventSub subscriptions using EventSub Conduits
gaming · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans