Twitch
Twitch is best treated as a live-channel companion, not an open public inbox. Fased joins Twitch chat through the IRC bridge, speaks as a Twitch bot account, and relies on allowlists or moderator roles to keep control of who can trigger it. Status: bundled channel extension through Twitch chat over IRC.Setup from Agent > Channels
Twitch ships with Fased as a local bundled channel extension. You do not need to download an npm package in a normal install. Open Agents, select the Agent, then use Agent > Channels > Twitch. Enter the bot username, access token, client ID, and channel name, save the channel, then restart the gateway if the UI reports that the runtime still needs to load.Quick setup (beginner)
Use a dedicated bot account when possible. It makes channel moderation, token rotation, and auditability much cleaner than sharing your primary Twitch identity.- Create a dedicated Twitch account for the bot (or use an existing account).
- Generate credentials: Twitch Token Generator
- Select Bot Token
- Verify scopes
chat:readandchat:writeare selected - Copy the Client ID and Access Token
- Find your Twitch user ID: https://www.streamweasels.com/tools/convert-twitch-username-to-user-id/
- Configure the token in Agent > Channels > Twitch:
- Env:
FASED_TWITCH_ACCESS_TOKEN=...(default account only) - Or config:
channels.twitch.accessToken - If both are set, config takes precedence (env fallback is default-account only).
- Env:
- Start the gateway.
allowFrom or allowedRoles) to prevent unauthorized users from triggering the bot. requireMention defaults to true.
Minimal config:
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
Configure the bot
Env var (default account only):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-%20to-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 gateway/configuration for the shared pattern.
Example (one bot account in two channels):
Access control
Role-based restrictions
Allowlist by User ID (most secure)
Role-based access (alternative)
allowFrom is a hard allowlist. When set, only those user IDs are allowed.
If you want role-based access, leave allowFrom unset and configure allowedRoles instead:
Disable @mention requirement
By default,requireMention is true. To disable and respond to all messages:
Troubleshooting
First, run diagnostic commands:Bot doesn’t respond to messages
Check access control: Ensure your user ID is inallowFrom, or temporarily remove
allowFrom and set allowedRoles: ["all"] to test.
Check the bot is in the channel: The bot must join the channel specified in channel.
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
Check logs for refresh events:- Ensure
clientSecretis provided - Ensure
refreshTokenis provided
Config
Account config:username- Bot usernameaccessToken- OAuth access token withchat:readandchat:writeclientId- Twitch Client ID (from Token Generator or your app)channel- Channel to join (required)enabled- Enable this account (default:true)clientSecret- Optional: For automatic token refreshrefreshToken- Optional: For automatic token refreshexpiresIn- Token expiry in secondsobtainmentTimestamp- Token obtained timestampallowFrom- User ID allowlistallowedRoles- Role-based access control ("moderator" | "owner" | "vip" | "subscriber" | "all")requireMention- Require @mention (default:true)
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 & 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)