Twitch
Twitch Moderation Toolkit — cross-channel moderation visibility for Twitch moderators.
This extension provides a model for interacting with the Twitch Helix API (chatters, bans, mod events, user lookups), a workflow that audits all your moderated channels in parallel, and a report that correlates findings cross-channel to surface suspicious users and ban overlap.
Quick Start
swamp extension pull @webframp/twitch
# Create one model instance per channel you moderate
swamp model create @webframp/twitch mod-drongo \
--global-arg channel=drongo \
--global-arg moderatorId=YOUR_TWITCH_USER_ID
# Run the cross-channel audit
swamp workflow run @webframp/twitch-mod-auditAuthentication
Requires a Twitch application with OAuth2 user tokens. Store credentials in vault:
swamp vault set twitch-client-id YOUR_CLIENT_ID
swamp vault set twitch-client-secret YOUR_CLIENT_SECRET
swamp vault set twitch-access-token YOUR_ACCESS_TOKEN
swamp vault set twitch-refresh-token YOUR_REFRESH_TOKENTo obtain tokens, register an app at dev.twitch.tv/console/apps with redirect URL http://localhost:3000 and category "Chat Bot". Then authorize:
# 1. Open in browser (replace YOUR_CLIENT_ID):
# https://id.twitch.tv/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://localhost:3000&response_type=code&scope=moderator:read:chatters+moderation:read+moderator:manage:banned_users+user:write:chat+channel:read:editors+moderator:read:suspicious_users+moderator:read:warnings
# 2. Copy the code from the redirect URL, then exchange for tokens:
curl -X POST 'https://id.twitch.tv/oauth2/token' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&code=AUTH_CODE&grant_type=authorization_code&redirect_uri=http://localhost:3000'
# 3. Get your moderator user ID:
curl -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
-H 'Client-Id: YOUR_CLIENT_ID' \
'https://api.twitch.tv/helix/users'The model refreshes expired access tokens automatically using the refresh token.
Scopes
Request all scopes during app registration to avoid re-authorization later.
| Scope | Used by | Purpose |
|---|---|---|
| moderator:read:chatters | get_chatters | List users in chat |
| moderation:read | get_banned_users, get_mod_events | Read bans and mod activity |
| moderator:manage:banned_users | ban_user, unban_user | Issue bans/timeouts and unban |
| user:write:chat | send_message | Send chat messages as your user |
| channel:read:editors | get_channel | Read channel metadata |
| moderator:read:suspicious_users | (future) | Twitch-flagged suspicious users |
| moderator:read:warnings | (future) | Warnings issued to users |
2026.07.03.1
Changed: Added JSDoc documentation to HELIX_BASE, TOKEN_URL,
helixApiPaginated (API helpers), and report export for improved deno doc
coverage and quality rubric compliance.
2026.06.29.2
Added: README with quick start, authentication guide, method reference, and workflow/report documentation. Apache 2.0 LICENSE. JSDoc on model export.
Quality grade fix — addresses all missing scorer gates (README, code example, license, symbol documentation).
Global Arguments
| Argument | Type | Description |
|---|---|---|
| channel | string | Twitch channel login name |
| moderatorId | string | Your Twitch user ID (the moderator performing actions) |
| clientId | string | Twitch application client ID |
| clientSecret | string | Twitch application client secret |
| accessToken | string | OAuth2 access token |
| refreshToken | string | OAuth2 refresh token |
| Argument | Type | Description |
|---|---|---|
| login | string | Twitch login name to look up |
| Argument | Type | Description |
|---|---|---|
| userId | string | Twitch user ID to ban |
| reason? | string | Reason for the ban |
| duration? | number | Timeout duration in seconds (omit for permanent ban) |
| Argument | Type | Description |
|---|---|---|
| userId | string | Twitch user ID to unban |
| Argument | Type | Description |
|---|---|---|
| message | string | Message text to send (max 500 chars) |
| replyToMessageId? | string | Message ID to reply to (threads the response) |
Resources
Cross-channel Twitch moderation audit. Gathers chatters, bans, and channel info from all channel instances in parallel, then flags suspicious users (new accounts, cross-channel ban overlap, multi-channel presence). NOTE: Steps use modelIdOrName: "*" to target all @webframp/twitch model instances. Create one model instance per channel before running this workflow (e.g. swamp model create --type @webframp/twitch --name channel1).
Cross-channel moderation report highlighting suspicious users, ban overlap, and recent mod activity
2026.06.29.2
Added: README with quick start, authentication guide, method reference, and workflow/report documentation. Apache 2.0 LICENSE. JSDoc on model export.
Quality grade fix — addresses all missing scorer gates (README, code example, license, symbol documentation).
2026.06.29.1
Fixed: Switched to inline npm:zod@4.4.3 specifier so deno doc --lint resolves the import without an import map (fixes scorer compatibility).
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned