Step 1: Create a Twitch Account
Create a Twitch account for your bot (or use an existing one). The bot will send messages as this account.Step 2: Register a Twitch Application
Open the Developer Console
Go to dev.twitch.tv/console/apps and log in with any Twitch account (doesn’t need to be the bot account).
Register Your Application
Click Register Your Application and fill in the form:
- Name: anything (e.g., “My Spacebot”)
- OAuth Redirect URL:
http://localhost:3000 - Category: Chat Bot
Get Credentials
Click Manage on your new app:
- Copy the Client ID
- Click New Secret and copy the Client Secret
Step 3: Get an OAuth Token
You need to authorize the bot account withchat:read and chat:edit scopes. The easiest way is the Twitch CLI, but you can also do it manually.
- Twitch CLI
- Manual (curl)
Install the Twitch CLI and configure it with your app credentials:Then generate a user token. This opens a browser where you log in as the bot account:The CLI prints the access token and refresh token. Copy both.
Step 4: Add Credentials to Spacebot
Spacebot needs your username, OAuth token, client ID, client secret, and refresh token. With all five, Spacebot automatically refreshes expired tokens.- TOML Config
config.toml
Prefix the access token with
oauth:. For example, if the token is abc123def456, set oauth_token to oauth:abc123def456.config.toml
Step 5: Join Channels
Specify which Twitch channels the bot should join. Channel names are case-insensitive and should not include the# prefix.
config.toml
Verify It’s Working
Send a message (or a trigger command if you configured one) in a joined channel. You should see the bot reply.Trigger Prefix
Twitch channels can be extremely high-volume. By default the bot responds to every message, which is probably not what you want in a busy stream. Set a trigger prefix so the bot only responds to messages that start with it:config.toml
!ask. The prefix is stripped before processing — if someone types !ask what is rust?, the bot sees what is rust?.
Set to an empty string or omit to respond to all messages.
Filtering
Restrict to Specific Channels
By default the bot responds in every channel it joins. To route specific channels to specific agents, add channel names to your bindings.config.toml
channel_ids is empty or omitted, the bot responds in all joined channels.
User Filtering
Restrict which Twitch users can interact with the bot by adding login names to the binding’s allowed users list.config.toml
Multiple Channels, Multiple Agents
Route different Twitch channels to different agents.config.toml
Conversations
Each Twitch channel maps to a single conversation (twitch:<channel_name>). Unlike Discord or Slack, Twitch chat has no threads — all messages in a channel share one conversation context.
Limitations
- No streaming — Twitch IRC doesn’t support message editing, so responses are sent as complete messages rather than streamed word-by-word.
- Text only — File attachments are sent as
[File: filename]text notices since Twitch chat doesn’t support media. - 500 character limit — Long responses are automatically split into multiple messages.
- No history backfill — Twitch IRC doesn’t provide message history, so new conversations start fresh.
- Rate limits — Twitch limits bots to ~20 messages per 30 seconds (100 if the bot account is a verified bot or moderator in the channel).
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Login authentication failed | Invalid or expired OAuth token | Re-run the token flow from Step 3. If you have client_id, client_secret, and refresh_token configured, Spacebot refreshes automatically — check that all three are set. |
| Bot connects but doesn’t respond | Trigger prefix set | Messages must start with the configured prefix (e.g., !ask) |
| Bot responds to everything | No trigger prefix | Set trigger_prefix in the config to limit when the bot responds |
| Messages getting dropped | Rate limit | Reduce response frequency or get the bot account verified |
| Bot doesn’t join channel | Wrong channel name | Use the login name (lowercase), not the display name |
Next Steps
Configure Permissions
Set up user filters and access control
Agent Configuration
Create multiple agents for different channels
Trigger Prefixes
Control when the bot responds