twitch setup

Set up Twitch

Four values into config.env and your bot posts thank-yous in your Twitch chat. Takes about ten minutes if you've never done it before, less if you have. everything happens in your own Twitch developer portal.

Last verified: April 19, 2026 Twitch's developer portal, API, and scope names change occasionally. If the screens or terms you see don't match what this page describes, trust Twitch's current documentation — and tell us so we can update this page. Authoritative reference: Twitch's official chatbot guide.
What you'll end up with Four values pasted into your bot's config.env on your own host: a Client ID, an OAuth token, and two numeric user IDs. Your Twitch account stays in your control; nothing about this setup routes through us. When the bot starts, it connects to Twitch's EventSub, subscribes to your channel's chat, and posts thank-yous when a tip lands on-chain.
step 1

Have a Twitch account for the bot

The bot posts in chat as a Twitch account. You have two options and they're both fine:

Whichever you pick, you'll need to be signed in as that account when you generate the OAuth token in Step 3. If you're using a dedicated bot account, sign in to it first in your browser.

Phone verification Twitch may require phone verification for the bot account before it can send chat messages in some channels. If you hit a "verified phone number required" error later, go to the bot account's Security & Privacy settings and add a phone number.
step 2

Register an app at dev.twitch.tv

Registering an app gives you a Client ID — a public identifier Twitch uses to recognize your bot's API calls. Not a secret.

  1. Go to dev.twitch.tv/console/apps (sign in with your Twitch account if prompted — can be your main or your bot account; doesn't matter for this step)
  2. Click Register Your Application
  3. Fill in the form:
    • Name: anything — e.g. "mybot-tipping"
    • OAuth Redirect URLs: http://localhost:3000 (required by the form; we don't actually use this redirect)
    • Category: Chat Bot
    • Client Type: Confidential
  4. Click Create
  5. On the app's details page, copy the Client ID — save it somewhere you can find again in a minute

You don't need the Client Secret for this bot. We use user-access tokens, not app-access tokens, so the secret isn't part of the flow.

step 3

Generate a User Access Token

The OAuth token is a credential that lets the bot read chat and post chat as the bot's Twitch account. It's a secret. Treat it like a password.

Required scopes

Option A — Twitch CLI (recommended if you're comfortable with a terminal)

The Twitch CLI is Twitch's official tool. Install it, then:

twitch configure
# paste your Client ID when prompted
twitch token --user-token --scopes "user:bot user:read:chat user:write:chat"

It opens a browser, you sign in as the bot account, approve the scopes, and it prints the token to your terminal. Copy it — you'll paste it into config.env in a moment.

Option B — Web-based generator

If you'd rather stay in a browser: twitchtokengenerator.com is a popular community tool. Select Custom Scope Token, tick the three scopes above, authorize, and it gives you a token. This runs on someone else's infrastructure — if you'd rather not trust a third-party generator, use the CLI instead.

Token lifetime User Access Tokens expire periodically (Twitch rotates them). When yours does, the bot will log a clear error in /check and you'll regenerate via the same steps and paste the new token in. No other cleanup needed.
step 4

Find the numeric user IDs

Twitch's API identifies accounts by numeric ID, not by the visible login name. You need two:

If your bot account is your streaming channel (solo streamer using the main account), these two IDs are identical.

Option A — Lookup tool

Enter the account's login name at streamweasels's username-to-ID tool — it returns the numeric ID instantly. Do this twice (once for the bot account, once for the channel) unless they're the same account.

Option B — Helix API directly

If you have the OAuth token from Step 3 handy and curl available:

curl -H "Authorization: Bearer YOUR_OAUTH_TOKEN" \
     -H "Client-Id: YOUR_CLIENT_ID" \
     "https://api.twitch.tv/helix/users?login=YOUR_LOGIN_NAME"

The response has an id field — that's the numeric user ID.

step 5

Paste into config.env and restart

Open your bot's config.env file and fill in the Twitch section:

your config.env additions TWITCH_BOT_CLIENT_ID=from step 2
TWITCH_BOT_OAUTH_TOKEN=from step 3 (no "oauth:" prefix)
TWITCH_BOT_USER_ID=from step 4 (bot account)
TWITCH_ANNOUNCE_CHANNEL_USER_ID=from step 4 (target channel)

Save the file and restart the bot:

# if you're running locally
# stop the bot (ctrl-C) and run npm start again

# if you're on Railway/Render/Fly
# redeploy — they'll restart with the new env vars

Open /check on your bot's URL. The Twitch row should go green, with a message like "connecting to eventsub; announcing in channel user 12345678". If it shows red, the detail text on the row tells you what to fix.

What happens next

When a tip lands on any chain the bot watches, the Twitch adapter posts a thank-you in the target channel. When a viewer mentions the bot with the word "tip" or starts a message with !tip, the bot replies with your tip page URL. Both are stateless — the bot doesn't remember anything between tips.

if something goes wrong

Troubleshooting

Twitch row on /check shows "401 Unauthorized" or "invalid token"

The OAuth token is wrong, expired, or missing scopes. Regenerate it in Step 3 and make sure all three scopes are selected. Tokens don't include the oauth: prefix anymore — paste just the letters and digits.

"403 Forbidden" when trying to post

The bot's account doesn't have permission to post in the target channel — or the channel's chat is in a mode (emote-only, followers-only, subscribers-only) that excludes the bot. Make the bot account a moderator in the channel, or adjust the channel's chat mode.

"A verified phone number is required to chat in this channel"

Twitch requires some channels' chatters to have phone verification. Sign in to the bot account, go to Security & Privacy settings, add a phone number, verify it.

Bot connects but never posts thank-yous

First check that tips are actually landing — open /check and confirm the chain rows (XRPL/Base/Arbitrum/Solana) are green. If they are but Twitch doesn't post, check the bot's logs for twitch send-chat-message failed — the error message tells you whether it's an auth issue (revalidate token) or a channel permission issue (make bot a mod).

Something else

See the general troubleshooter or post an issue. For Twitch-specific quirks not covered here, the Twitch chat documentation is the authoritative source — their error messages tend to be precise.

All four values in hand?

Head to the configurator, scroll to the Twitch subsection of the chat platforms block, and paste them in. The generator includes them in your bundle's config.env.

You can also skip the configurator entirely and just edit config.env directly in an existing bundle — the bot picks up the values on next restart.

Related