Channels
How to Connect OpenClaw to Twitch
Browse more in Channels.
All channels guides →This guide shows you how to connect OpenClaw to Twitch so your agent can read and respond to Twitch chat in real time. You will generate a Twitch bot token, wire it into OpenClaw, and lock down who is allowed to trigger the bot.
By the end, your OpenClaw gateway will join a Twitch channel and handle chat messages over IRC.
Prerequisites
- ✓An existing OpenClaw gateway installation with access to edit its config and restart the process.
- ✓A Twitch account to act as the bot (you can create a dedicated Twitch account for the bot or use an existing account).
- ✓Access to Twitch Token Generator at https://twitchtokengenerator.com/ to create a Bot Token with `chat:read` and `chat:write` scopes.
- ✓Your Twitch user ID, which you can get from https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/.
Steps
- 1
Ensure the Twitch plugin is available
First confirm that the Twitch channel plugin is present so OpenClaw can speak IRC to Twitch. Current packaged OpenClaw releases already bundle it, but older or custom builds may need a manual install from npm or a local checkout.
bashopenclaw plugins install @openclaw/twitch - 2
Install the Twitch plugin from a local checkout (optional)
If you run OpenClaw from a git repo and keep the Twitch plugin locally, install it via the filesystem path instead of npm. This is useful when you customize the plugin or track it alongside your gateway code.
bashopenclaw plugins install ./path/to/local/twitch-plugin - 3
Generate a Twitch bot token and client ID
Create the credentials that OpenClaw uses to authenticate as your Twitch bot account. Use Twitch Token Generator to create a Bot Token with the correct scopes, then copy both the Client ID and the OAuth Access Token for later config.
textUse Twitch Token Generator (https://twitchtokengenerator.com/): * Select **Bot Token** * Verify scopes `chat:read` and `chat:write` are selected * Copy the **Client ID** and **Access Token** - 4
Configure the Twitch access token via environment variable
For a single default Twitch account, you can inject the OAuth token through an environment variable. This keeps secrets out of your config file and is enough to get a basic bot online.
bashOPENCLAW_TWITCH_ACCESS_TOKEN=oauth:abc123... - 5
Configure the Twitch channel in the OpenClaw config
Define the Twitch channel settings in your OpenClaw config so the gateway knows which bot account to log in as and which channel to join. This config also wires in the access token and client ID you generated earlier.
json{ channels: { twitch: { enabled: true, username: "openclaw", // Bot's Twitch account accessToken: "oauth:abc123...", // OAuth Access Token (or use OPENCLAW_TWITCH_ACCESS_TOKEN env var) clientId: "xyz789...", // Client ID from Token Generator channel: "vevisk", // Which Twitch channel's chat to join (required) allowFrom: ["123456789"], // (recommended) Your Twitch user ID only - get it from https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/ }, }, } - 6
Lock down access with allowFrom or allowedRoles
Restrict who can trigger your Twitch bot so random viewers cannot spam your agent. The most secure option is an allowlist of Twitch user IDs, but you can also grant access by role if you prefer moderators or VIPs only.
json{ channels: { twitch: { allowFrom: ["123456789"], // (recommended) Your Twitch user ID only }, }, } - 7
Enable multi-account or multi-channel Twitch bots (optional)
accounts`. Each account needs its own token, even if they share the same username.
json{ channels: { twitch: { accounts: { channel1: { username: "openclaw", accessToken: "oauth:abc123...", clientId: "xyz789...", channel: "vevisk", }, channel2: { username: "openclaw", accessToken: "oauth:def456...", clientId: "uvw012...", channel: "secondchannel", }, }, }, }, } - 8
Start the gateway and verify Twitch connectivity
With the plugin installed and config in place, start or restart your OpenClaw gateway so it connects to Twitch IRC. Use the built-in diagnostics to confirm the Twitch channel is healthy and responding.
bashopenclaw doctor openclaw channels status --probe
Configuration
| Option | Description | Example |
|---|---|---|
| OPENCLAW_TWITCH_ACCESS_TOKEN | OAuth access token for the default Twitch account when configured via environment variable. | oauth:abc123... |
| channels.twitch.enabled | Enables or disables the Twitch channel provider at startup. | true |
| channels.twitch.username | Bot username for the simplified single-account Twitch configuration. | openclaw |
| channels.twitch.accessToken | OAuth access token with `chat:read` and `chat:write` scopes for the simplified single-account config. | oauth:abc123... |
| channels.twitch.clientId | Twitch Client ID used by the Twitch bot in simplified single-account config. | xyz789... |
| channels.twitch.channel | The Twitch channel name that the bot joins in simplified single-account config. | vevisk |
| channels.twitch.allowFrom | User ID allowlist that restricts which Twitch users can trigger the bot. | ["123456789"] |
| channels.twitch.allowedRoles | Role-based access control list for Twitch users when not using a hard allowlist. | ["moderator", "vip"] |
| channels.twitch.clientSecret | Client secret for automatic Twitch token refresh when using your own Twitch application. | secret123... |
| channels.twitch.refreshToken | Refresh token used with `clientSecret` to automatically refresh the Twitch access token. | refresh456... |
| channels.twitch.accounts.<accountName>.username | Bot username for a specific Twitch account in multi-account configuration. | mybot |
| channels.twitch.accounts.<accountName>.accessToken | OAuth access token for a specific Twitch account in multi-account configuration. | oauth:abc123... |
| channels.twitch.accounts.<accountName>.clientId | Twitch Client ID for a specific Twitch account in multi-account configuration. | xyz789... |
| channels.twitch.accounts.<accountName>.channel | Twitch channel that a specific account joins in multi-account configuration. | your_channel |
| channels.twitch.accounts.<accountName>.enabled | Enables or disables a specific Twitch account in multi-account configuration. | true |
| channels.twitch.accounts.<accountName>.clientSecret | Client secret for automatic token refresh for a specific Twitch account. | secret123... |
| channels.twitch.accounts.<accountName>.refreshToken | Refresh token for automatic token refresh for a specific Twitch account. | refresh456... |
| channels.twitch.accounts.<accountName>.expiresIn | Token expiry time in seconds for a specific Twitch account. | 14400 |
| channels.twitch.accounts.<accountName>.obtainmentTimestamp | Timestamp when the token was obtained for a specific Twitch account. | 1706092800000 |
| channels.twitch.accounts.<accountName>.allowFrom | User ID allowlist for a specific Twitch account in multi-account configuration. | ["123456789", "987654321"] |
| channels.twitch.accounts.<accountName>.allowedRoles | Role-based access control for a specific Twitch account in multi-account configuration. | ["moderator"] |
| channels.twitch.accounts.<accountName>.requireMention | Controls whether the bot only responds when @mentioned in Twitch chat. | false |
Troubleshooting
Bot does not respond to messages
First verify that your Twitch user ID is allowed by your access control settings. Ensure your user ID is in `allowFrom`, or temporarily remove `allowFrom` and set `allowedRoles: ["all"]` to test, and confirm the bot has actually joined the channel specified in `channel`.
{
channels: {
twitch: {
accounts: {
default: {
allowedRoles: ["all"],
},
},
},
},
}“Failed to connect” or authentication errors
These errors usually mean the Twitch token is wrong or missing required scopes. Confirm that `accessToken` is the OAuth access token value (typically starting with `oauth:`), that it has `chat:read` and `chat:write` scopes, and if you use token refresh, that both `clientSecret` and `refreshToken` are set.
{
channels: {
twitch: {
clientSecret: "your_client_secret",
refreshToken: "your_refresh_token",
},
},
}Token refresh not working and logs show “token refresh disabled (no refresh token)”
OpenClaw disables automatic refresh when the Twitch refresh token or client secret is missing. Check the logs for refresh events and ensure both `clientSecret` and `refreshToken` are configured for the Twitch account that should auto-refresh.
Using env token source for mybot
Access token refreshed for user 123456 (expires in 14400s)Twitch channel health is unclear after configuration changes
When you are unsure if the Twitch integration is healthy, run the built-in diagnostics. Use `openclaw doctor` and `openclaw channels status --probe` to check connectivity and channel status after updating tokens or config.
openclaw doctor
openclaw channels status --probeFrequently asked questions
Powered by Mem0
Add persistent memory to OpenClaw
Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.