> ## Documentation Index
> Fetch the complete documentation index at: https://stars-components.js.org/llms.txt
> Use this file to discover all available pages before exploring further.

# @wolfstar/twitch-helpers

> Call Twitch Helix and validate EventSub requests.

<CodeGroup>
  ```bash npm theme={"system"}
  npm install @wolfstar/twitch-helpers
  ```

  ```bash pnpm theme={"system"}
  pnpm add @wolfstar/twitch-helpers
  ```

  ```bash yarn theme={"system"}
  yarn add @wolfstar/twitch-helpers
  ```

  ```bash bun theme={"system"}
  bun add @wolfstar/twitch-helpers
  ```
</CodeGroup>

<CardGroup cols={2}>
  <Card title="npm" icon="npm" horizontal href="https://npmx.dev/package/@wolfstar/twitch-helpers" />

  <Card title="Source" icon="github" horizontal href="https://github.com/wolfstar-project/stars-components/tree/main/packages/twitch-helpers" />
</CardGroup>

## Description

Very basic Twitch helper functions for several Star bots to ensure we do not duplicate code.

## Features

* Powered by the `@wolfstar/safe-fetch` package

## Usage

First of all, you should make sure to define the following environment variables for your process:

* `TWITCH_CLIENT_ID`: The Client ID of your Twitch application (generated at [Twitch Dev Console](https://dev.twitch.tv/console/apps/))
* `TWITCH_CLIENT_SECRET`: The Client Secret from your Twitch application (generated at [Twitch Dev Console](https://dev.twitch.tv/console/apps/))
* `TWITCH_EVENT_SUB_CALLBACK`: A public HTTP callback URL that can be used for the [Twitch EventSub](https://dev.twitch.tv/docs/eventsub)
* `TWITCH_EVENT_SUB_SECRET`: A unique secret key that is sent to the EventSub system and returned by Twitch then used to validate whether a request is from Twitch or not.

After this, you can use the functions exported from this package to interact with the Twitch API.
