Black Branch/Docs
All sections

Twitch

This page is for a streamer on Twitch. After it, your Twitch chat shows on your site, your Twitch stream plays in the site's player, and your viewers can link their Twitch accounts so the site knows who they are.

What connecting Twitch gives you

There are two levels. The first needs only your channel name. The second needs a free developer app that you register with Twitch.

With You get
Your channel name only Twitch chat in site chat, in real time. Twitch subs, resubs, gift subs and bits as alerts. Messages a Twitch mod deletes, and people a Twitch mod bans or times out, disappear from site chat too. Your Twitch stream in the site's player.
Your channel name and a Twitch app Everything above, plus: viewers can link their Twitch accounts; linked viewers can send messages from the site into Twitch chat (cross-posting) and use their own Twitch emotes on the site; your channel's own emotes appear in the emote picker; your mods can ban, time out and delete on Twitch from the site; Twitch AutoMod's held messages come to the Mod Panel; and the site can tell when you are live on Twitch.

The site reads chat without signing in to Twitch, the same way a logged-out visitor sees chat on twitch.tv. That is why the channel name alone is enough to start.

What you need first

Where Twitch is set up on your site

Twitch has no on/off switch. The site reads Twitch chat whenever a Twitch channel is set, and stops when you clear it.

Step 1: your Twitch channel

  1. Open the Twitch setup page (or Admin Panel → Platforms → Twitch).
  2. In Twitch channel, type your channel name in lower case, for example casey.
  3. Save.

Saving is enough. The ingest service (the part of your site that reads platform chat) follows the setting by itself: within a few seconds it starts reading the new channel, and it stops reading the old one. No restart is needed.

The app is your site's own registration with Twitch. It belongs to your Twitch account, so your site never depends on someone else's app. Twitch's own guide is Registering your app.

Register the app on Twitch

  1. Open the Twitch developer console and sign in with your channel's Twitch account. The first time, Twitch asks you to accept its developer terms.
  2. Press Register Your Application.
  3. Fill in the form:
Field on Twitch's form What to enter
Name Any name that is unique on Twitch, for example Casey Community Site. Viewers see it on Twitch's approval screen when they link, so pick something they will recognise.
OAuth Redirect URLs Your site's Twitch redirect URL, exactly as the setup page shows it. For a site at example.com it is https://example.com/api/auth/link/twitch/callback. Use the setup page's Copy button rather than typing it.
Category Website Integration
Client Type Confidential. Only a confidential app gets a client secret, and the site needs one.
  1. Press Create. Twitch takes you back to the list of your apps.
  2. Press Manage beside the new app. The page shows the Client ID. Copy it.
  3. Press New Secret, confirm, and copy the Client Secret. Twitch shows the secret once. If you lose it, press New Secret again and paste the new one into your site.

🖼 Image: Twitch's Register Your Application form filled in with the example values

The redirect URL must match character for character, including https:// and no slash at the end. If it does not, Twitch refuses the link with a "redirect_mismatch" error.

Twitch asks for no permissions when you register the app. The site asks for them later, when someone links an account, and that person sees them on Twitch's approval screen (see The permissions (scopes) Twitch shows).

Paste the values into your site

  1. On the Twitch setup page (or Admin Panel → Platforms → Twitch), paste the Client ID into Twitch app client id and the secret into Twitch app client secret. Both are stored encrypted.
  2. Press Check beside the secret. The site asks Twitch for an app token with your client id and secret, then looks up your channel.
  3. On success the result says accepted and channel found, id 123456789. That number is your channel's broadcaster id: Twitch's permanent number for your account. A channel name can change; the number never does.
  4. Save. You do not type the broadcaster id: the site finds it from your channel name and saves it for you.

In Admin Panel → Platforms → Twitch, Twitch broadcaster id shows locked, with "Found from the channel when it is saved." The site looks it up again whenever you save the channel name or the app's keys. If the lookup could not run (Twitch did not answer, or the app keys were not set yet), press Find again beside it.

The site needs the broadcaster id for moderation (it refuses to act on Twitch without it), for live detection, for your channel's own emotes, and for the 7TV and BTTV emotes tied to your channel. Once it is saved, your channel's 7TV emotes reach chat within half an hour (see 7TV emotes).

One more step makes moderation and AutoMod work fully. Signed in to your site as your admin account (the one you made on the first setup page, which the site also treats as the streamer's account):

  1. Open your profile card from your picture in the chat typing bar and press Link a platform account.
  2. Press Link Twitch, and approve on Twitch's page while signed in as your channel's account.

Your admin account counts as a mod, so Twitch asks you for the moderation permissions as well as the basic ones. The site then uses your link as the fallback when a mod's own link cannot carry out an action, and as the account that receives AutoMod's held messages. The viewer's side of linking is on Linking your platforms.

The permissions (scopes) Twitch shows

When someone links Twitch, Twitch shows an approval screen listing what the site asks for. Each item is a scope. Regular viewers are asked for four. Mods and admins are asked for four more, so a viewer never sees a moderation request. Twitch describes every scope in its scope reference.

Scope What it lets the site do Why it is needed
user:read:email Read the email address on the Twitch account Part of Twitch's basic identity request. The site identifies a person by their Twitch user id and login; it does not keep the email address.
chat:read Read Twitch chat as that account Requested together with the chat permission. The site reads your channel's chat through its own anonymous connection, not through viewers' links.
user:write:chat Send chat messages as that account So a message a viewer sends from the site to Twitch arrives in Twitch chat under their own name.
user:read:emotes See which Twitch emotes the account can use So a viewer's own emotes (for example, subscriber emotes from other channels) appear in the emote picker for them.

Mods and admins, in addition

Scope What it lets the site do Why it is needed
moderator:manage:banned_users Ban, time out and unban people in your channel So a ban or timeout made on the site also happens on Twitch.
moderator:manage:chat_messages Delete chat messages in your channel So deleting a message on the site also deletes it on Twitch.
moderator:manage:chat_settings Change chat settings such as slow mode So slow mode set from the site applies to Twitch chat too.
moderator:manage:automod See, approve and deny messages that AutoMod held So Twitch AutoMod's held messages appear in the Mod Panel. This works from the streamer's own link.

A mod's link acts only where that person is a mod on Twitch. The site picks the account to act with by its permissions: if the mod's own link has the scope the action needs, the site uses it; only if it lacks the scope does the site use the streamer's link instead, and the mod log records which one acted. If the mod's link has the scope but the person is not a mod of your Twitch channel, Twitch refuses, and the site does not retry as the streamer. The mod log shows Twitch's refusal (see Reports and the mod log). Make the person a mod on Twitch too (/mod name in your Twitch chat). If someone became a mod after linking, their linked-accounts row shows Update permissions: pressing it and approving again adds the moderation scopes.

Live detection

With the Twitch app and the broadcaster id saved, the ingest service asks Twitch every so often whether your channel is live. It uses an app token (the app's own sign-in, no person involved). Without the app or the broadcaster id, Twitch takes no part in the "you are live" check, and the site judges going live from the other platforms you stream on.

Coming later: a bot account

Signing in a bot account from the Twitch setup page comes in a later release. Until then the site reads Twitch chat through its own anonymous connection, and nothing posts into Twitch chat as a bot.

How to check it worked

  1. Type a message in your Twitch chat (you do not need to be live) and watch your site's chat. It appears with the Twitch mark beside the name within a second or two.
  2. In Admin Panel → Platforms → Twitch, press Check on Twitch app client secret. accepted with channel found means the app works and the channel name is right.
  3. Link a test account (or your own). A banner that starts Twitch linked. means the redirect URL and the app match.
  4. Open Admin Panel → Doctor. The row Platform keys accepted lists Twitch when its app works, and Chat readers started shows Twitch as running.

Common problems

What you see What it means What to do
No Twitch messages in site chat The channel name is missing or misspelled Check Twitch channel: lower case, without twitch.tv/. The site's Stream tab (admins only, beside Home) shows whether the Twitch reader is running, and why not if it failed.
rejected (HTTP 400) or rejected (HTTP 403) Twitch does not accept the client id or secret Copy both again from the Twitch console. If unsure, press New Secret and paste the new one.
not found at the provider The app works, but no Twitch channel has the name you saved Fix Twitch channel.
found, but its id is … The saved broadcaster id belongs to a different channel Press Find again beside Twitch broadcaster id.
Twitch shows "redirect_mismatch" when someone links The redirect URL on the Twitch app differs from your site's In the Twitch console, press Manage and paste the exact URL from your setup page.
No Link Twitch button for viewers The client id or secret is not saved Finish step 2.
Bans on the site do not reach Twitch No broadcaster id, or neither the mod nor the streamer has linked Twitch with the moderation scopes Press Find again beside Twitch broadcaster id, then link your own Twitch account as the admin (or press Update permissions).
Only global emotes, none of your channel's The broadcaster id is not found yet, or the emote list has not refreshed yet Press Find again beside Twitch broadcaster id, then Refresh now on Admin Panel → Platforms → Emotes.

Next: Kick

← Connect your platforms