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>"
}
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 Twitch
or YouTube
accounts.
{
"request": "GetActiveViewers",
"id": "<id>"
}