WebSocket Requests
Overview
Requests can be made to the server in stringified JSON format.
Requests and responses follow the following base schema:
{
"request": "<request>",
"id": "<id>"
}
id
can be any string
value you want, and can be used to identify request/response pairs.Requests
Subscribe
Subscribe to a set of events from the connected Streamer.bot instance.
- If you are using the @streamerbot/client library, subscriptions are automatically added when using the
.on()
event handler - If you are interacting directly with the WebSocket Server, you must make a
Subscribe
request
{
"request": "Subscribe",
"id": "<id>",
"events": {
"<event category>": [
"<event name>",
"<event name>",
"...",
]
},
}
UnSubscribe
Unsubscribe from any events you are currently subscribed to.
{
"request": "UnSubscribe",
"id": "<id>",
"events": {
"<event category>": [
"<event name>",
"<event name>",
"...",
]
},
}
GetEvents
Fetch a list of all events that can be subscribed to on the connected Streamer.bot instance.
{
"request": "GetEvents",
"id": "<id>",
}
GetActions
Fetch a list of all actions in the connected Streamer.bot instance.
{
"request": "GetActions",
"id": "<id>"
}
DoAction
Execute an action on the connected Streamer.bot instance.
{
"request": "DoAction",
"action": {
"id": "<guid>",
"name": "<name>"
},
"args": {
"key": "value",
},
"id": "<id>"
}
{
"request": "DoAction",
"id": "sb:client:req:1753224740175-3103164791"
"action": {
"name": "example action"
},
"args": {
"stringArg": "abcdef",
"numArg": 1234
},
}
GetBroadcaster
Fetch information about the connected broadcaster account(s)
{
"request": "GetBroadcaster",
"id": "<id>"
}
GetCredits
Fetch the current credits system data.
{
"request": "GetCredits",
"id": "<id>"
}
TestCredits
Fill credits system with test data for testing.
{
"request": "TestCredits",
"id": "<id>"
}
ClearCredits
Reset the current credits system data.
{
"request": "ClearCredits",
"id": "<id>"
}
GetInfo
Fetch information about the connected Streamer.bot instance.
{
"request": "GetInfo",
"id": "<id>"
}
GetActiveViewers
Fetch a list of all active viewers for connected broadcaster accounts.
{
"request": "GetActiveViewers",
"id": "<id>"
}
GetCodeTriggers
Returns the list of code triggers available to be invoked by ExecuteCodeTrigger.
{
"request": "GetCodeTriggers",
"id": "<id>"
}
ExecuteCodeTrigger
Triggers a code trigger, causing any associated actions to be executed.
{
"request": "ExecuteCodeTrigger",
"id": "<id>",
"triggerName": "<triggerName>",
"args": {
"key": "value",
}
}
GetCommands
Returns the list of defined commands.
{
"request": "GetCommands",
"id": "<id>"
}
TwitchGetEmotes
Fetches a list of emotes for Twitch.
{
"request": "TwitchGetEmotes",
"id": "<id>"
}
YouTubeGetEmotes
Fetches a list of emotes for YouTube.
{
"request": "YouTubeGetEmotes",
"id": "<id>"
}
GetGlobals
Returns all the global variables, either persisted or temporary.
{
"request": "GetGlobals",
"id": "<id>",
"persisted": <bool>
}
GetGlobal
Gets a single persisted or temporary global variable. Returns an error if the variable doesn't exist.
{
"request": "GetGlobal",
"id": "<id>",
"variable": "<name>",
"persisted": <bool>,
}
TwitchGetUserGlobals
Fetches the values of a given user variable across all Twitch users.
{
"request": "TwitchGetUserGlobals",
"id": "<id>",
"variable": "<name>",
"persisted": <bool>,
}
TwitchGetUserGlobal
Gets either a single user variable for a given user, or all variables for that user.
{
"request": "TwitchGetUserGlobal",
"id": "<id>",
"userId": "<userId>",
"persisted": <bool>,
}
{
"request": "TwitchGetUserGlobal",
"id": "my-subscribe-id",
"userId": "136079477",
"variable": "tuna",
"persisted": true
}
SendMessage
Sends a message to the broadcaster's chat.
{
"request": "SendMessage",
"id": "<id>",
"platform": "twitch | kick | trovo | youtube",
"bot": <bool>,
"internal": <bool>,
"message": "<message>"
}
GetUserPronouns
Fetches the pronouns for a given user.
{
"request": "GetUserPronouns",
"id": "<id>",
"platform": "twitch",
"userLogin": "<login>"
}