velho
Examples

Fetch Live Streams

Use the Helix client with client-credential tokens to fetch live stream data, with typed responses and troubleshooting hints.

Environment

TWITCH_CLIENT_ID, TWITCH_CLIENT_SECRET

Get started

  1. Install dependencies with bun install.
  2. Export TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET (or add them to .env).
  3. Run bun run examples/FETCH_STREAMS.ts to request the first page of live streams from the Helix API.
  4. Review the console output for the raw API payload or any authentication troubleshooting tips.

What you can do

  • Swap the first query parameter to page through more results.
  • Add filters like game_id or user_login for targeted lookups.
  • Reuse the authenticated HelixClient instance for subsequent API calls in your app.
  • Hook the data into analytics, overlays, or moderation workflows.

Extend it further

  • Combine with the authorization code example to act on behalf of a broadcaster.
  • Cache stream responses using your preferred store to avoid rate-limit pressure.
  • Trigger EventSub subscriptions for channels returned by the query.

Resources

On this page