Twitch chat support via IRC connection. OpenClaw connects as a Twitch user (bot account) to receive and send messages in channels.Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
Bundled plugin
Twitch ships as a bundled plugin in current OpenClaw releases, so normal packaged builds do not need a separate install.
- npm registry
- Local checkout
Quick setup (beginner)
Ensure plugin is available
Current packaged OpenClaw releases already bundle it. Older/custom installs can add it manually with the commands above.
Create a Twitch bot account
Create a dedicated Twitch account for the bot (or use an existing account).
Generate credentials
Use Twitch Token Generator:
- Select Bot Token
- Verify scopes
chat:readandchat:writeare selected - Copy the Client ID and Access Token
Find your Twitch user ID
Use https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/ to convert a username to a Twitch user ID.
Configure the token
- Env:
OPENCLAW_TWITCH_ACCESS_TOKEN=...(default account only) - Or config:
channels.twitch.accessToken
What it is
- A Twitch channel owned by the Gateway.
- Deterministic routing: replies always go back to Twitch.
- Each account maps to an isolated session key
agent:<agentId>:twitch:<accountName>. usernameis the bot’s account (who authenticates),channelis which chat room to join.
Setup (detailed)
Generate credentials
Use Twitch Token Generator:- Select Bot Token
- Verify scopes
chat:readandchat:writeare selected - Copy the Client ID and Access Token
No manual app registration needed. Tokens expire after several hours.
Configure the bot
- Env var (default account only)
- Config
Access control (recommended)
allowFrom for a hard allowlist. Use allowedRoles instead if you want role-based access.
Available roles: "moderator", "owner", "vip", "subscriber", "all".
Why user IDs? Usernames can change, allowing impersonation. User IDs are permanent.Find your Twitch user ID: https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/ (Convert your Twitch username to ID)
Token refresh (optional)
Tokens from Twitch Token Generator cannot be automatically refreshed - regenerate when expired. For automatic token refresh, create your own Twitch application at Twitch Developer Console and add to config:Multi-account support
Usechannels.twitch.accounts with per-account tokens. See Configuration for the shared pattern.
Example (one bot account in two channels):
Each account needs its own token (one token per channel).
Access control
- User ID allowlist (most secure)
- Role-based
- Disable @mention requirement
Troubleshooting
First, run diagnostic commands:Bot does not respond to messages
Bot does not respond to messages
- Check access control: Ensure your user ID is in
allowFrom, or temporarily removeallowFromand setallowedRoles: ["all"]to test. - Check the bot is in the channel: The bot must join the channel specified in
channel.
Token issues
Token issues
“Failed to connect” or authentication errors:
- Verify
accessTokenis the OAuth access token value (typically starts withoauth:prefix) - Check token has
chat:readandchat:writescopes - If using token refresh, verify
clientSecretandrefreshTokenare set
Token refresh not working
Token refresh not working
Check logs for refresh events:If you see “token refresh disabled (no refresh token)”:
- Ensure
clientSecretis provided - Ensure
refreshTokenis provided
Config
Account config
Bot username.
OAuth access token with
chat:read and chat:write.Twitch Client ID (from Token Generator or your app).
Channel to join.
Enable this account.
Optional: for automatic token refresh.
Optional: for automatic token refresh.
Token expiry in seconds.
Token obtained timestamp.
User ID allowlist.
Role-based access control.
Require @mention.
Provider options
channels.twitch.enabled- Enable/disable channel startupchannels.twitch.username- Bot username (simplified single-account config)channels.twitch.accessToken- OAuth access token (simplified single-account config)channels.twitch.clientId- Twitch Client ID (simplified single-account config)channels.twitch.channel- Channel to join (simplified single-account config)channels.twitch.accounts.<accountName>- Multi-account config (all account fields above)
Tool actions
The agent can calltwitch with action:
send- Send a message to a channel
Safety and ops
- Treat tokens like passwords — Never commit tokens to git.
- Use automatic token refresh for long-running bots.
- Use user ID allowlists instead of usernames for access control.
- Monitor logs for token refresh events and connection status.
- Scope tokens minimally — Only request
chat:readandchat:write. - If stuck: Restart the gateway after confirming no other process owns the session.
Limits
- 500 characters per message (auto-chunked at word boundaries).
- Markdown is stripped before chunking.
- No rate limiting (uses Twitch’s built-in rate limits).
Related
- Channel Routing — session routing for messages
- Channels Overview — all supported channels
- Groups — group chat behavior and mention gating
- Pairing — DM authentication and pairing flow
- Security — access model and hardening