Guide
Executing Actions
Fetch your actions list and execute specific actions on your Streamer.bot instance
There are multiple requests that allow you to fetch various data from your Streamer.bot instance.
Explore the Methods API Reference which documents all requests and their responses.
Fetching Actions
You can fetch a list of all actions on your Streamer.bot instance with the getActions method.
Request
const response = await client.getActions();
Response
{
"status": "ok",
"id": "[request-id]",
"actions" : [
{
"enabled": true,
"group": "None",
"id": "a0ff6f91-a51e-4b7d-948b-5e03ff4a82f0",
"name": "Action Number One",
"subaction_count": 4
},
{
"enabled": false,
"group": "None",
"id": "84a0dfe7-5033-4e14-964b-ce2dfe9f5e09",
"name": "Action Number Two",
"subaction_count": 18
},
],
"count": 2
}
Executing Actions
You can execute an action on your Streamer.bot instance with the doAction method.
The first parameter accepts the actionId
which can be acquired from your Streamer.bot application, or programmatically using the getActions method outlined above.
Basic Example
// Execute an action with actionId "9c6203fd-363f-4834-983e-b10423c568ea"
const response = await client.doAction("9c6203fd-363f-4834-983e-b10423c568ea");
You can pass in custom arguments as a JavaScript object in the second parameter.
Example with Arguments
const response = await client.doAction(
"9c6203fd-363f-4834-983e-b10423c568ea",
{
// Will be available as %myCustomArgument% inside your Streamer.bot action!
"myCustomArgument": "Hello!",
// Will be available as %anotherCustomArgument%
"anotherCustomArgument": 200
}
)