Contents

Chatbots & IRC:
Twitch IRC Capability:
Chat Rooms

Overview

A channel can have multiple chat rooms. They can be previewed differently and have different join permissions; e.g., general, moderators-only, or subscribers-only. 

To distinguish among the chat rooms in a given channel, the commands in the following table use a UUID for each room. The UUID is unique across all of Twitch. To get a chat room’s UUID, use the Get Chat Rooms by Channel endpoint. 

Command Description
JOIN Join a specified chat room in a channel.
NOTICE Receive a general notice from the server.
PRIVMSG Send a message to a chat room.
ROOMSTATE Changes a room’s state.
USERSTATE Changes a user’s state.

JOIN (Twitch Chat Rooms)

Join a specified chat room in a channel.

Prototype

> :<user>!<user>@<user>.tmi.twitch.tv JOIN #chatrooms:<channel ID>:<room UUID>

Example: ronni joined chat room 04e762ec-ce8f-4cbc-b6a3-ffc871ab53da in channel 44322889.

> :ronni!ronni@ronni.tmi.twitch.tv JOIN #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da

NOTICE (Twitch Chat Rooms)

Receive a general notice from the server.

Prototype

> @msg-id=<msg id>:tmi.twitch.tv NOTICE #chatrooms:<channel ID>:<room UUID> :<message>
Parameter Description
message The message.
msg id A message ID string. Valid values: see Twitch IRC: msg-id Tags.

Example

> @msg-id=slow_off :tmi.twitch.tv NOTICE #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da :This room is no longer in slow mode.

PRIVMSG (Twitch Chat Rooms)

Send a message to a chat room. Only some Twitch Chat slash commands (/) are supported.

Prototype

> :<user>!<user>@<user>.tmi.twitch.tv PRIVMSG #chatrooms:<channel ID>:<room UUID> :This is a sample message

PRIVMSG: Supported Twitch Chat Slash Commands

For the following commands, there is no change in behavior.

General Commands User Moderation Commands Room Moderation Commands
/color
/disconnect
/help
/me
/mods
/w
/ban
/timeout
/unban
/untimeout
/emoteonly
/emoteonlyoff
/r9kbeta
/r9kbetaoff
/slow
/slowoff

PRIVMSG: Unsupported Twitch Chat Slash Commands

If you try to use any of the following commands in the context of a chat room, a NOTICE is returned, with:

msg-id: “unsupported_chatrooms_cmd”
message: “The command <command> cannot be used in a chatroom”
General Commands Room Moderation Commands
/commercial
/host
/raid
/unhost
/unraid
/clear
/followers
/followersoff

ROOMSTATE (Twitch Chat Rooms)

Changes a room’s state. When a user joins a channel or a room, the room’s state is changed. For a join, the message contains all chat-room settings. For changes, only the relevant tag is sent.

Prototype

> @emote-only=<emote only>;room-id=<channel ID>;r9k=<r9k>;slow=<slow>;:tmi.twitch.tv ROOMSTATE #chatrooms:<channel ID>:<room UUID>:<message>
Parameter Description
emote-only Emote only mode. If enabled, only messages with emotes are allowed. Valid values: 0 (disabled) or 1 (enabled). Default: 0.
room-id The channel ID for the channel owner (i.e., the broadcaster). Note that this value is specified twice in the command.
r9k R9K mode. If enabled, messages with more than 9 characters must be unique. Valid values: 0 (disabled) or 1 (enabled). Default: 0.
slow The number of seconds chatters without moderator privileges must wait between sending messages.

Example: This is for a join in chat room 04e762ec-ce8f-4cbc-b6a3-ffc871ab53da in channel 44322889.

> @emote-only=0;room-id=44322889;r9k=0;slow=0 :tmi.twitch.tv ROOMSTATE #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da

Example: In chat room 04e762ec-ce8f-4cbc-b6a3-ffc871ab53da in channel 44322889, slow mode is set to 10 seconds.

> @room-id=44322889;slow=10 :tmi.twitch.tv ROOMSTATE #chatrooms:44322889:04e762ec-ce8f-4cbc-b6a3-ffc871ab53da

USERSTATE (Twitch Chat Rooms)

Changes a user’s state. Use when a user joins a chat room or sends a PRIVMSG to a chat room. Use with the tags capability; see USERSTATE(Twitch Tags), which has additional parameters.

Prototype

> :tmi.twitch.tv USERSTATE #chatrooms:<channel ID>:<room UUID>