Examples

Example code for interacting with the WebSocket server using JavaScript
Check out the Streamer.bot Client library if you are using JavaScript or TypeScript!

Connect

// Streamerbot Client will automatically connect to 127.0.0.1:8080
const client = new StreamerbotClient();

Execute Actions

// Execute an action with actionId "9c6203fd-363f-4834-983e-b10423c568ea"
const response = await client.doAction("9c6203fd-363f-4834-983e-b10423c568ea");

Subscribe to Events

// Subscribe to Twitch Chat messages and register an event handler
client.on('Twitch.ChatMessage', (data) => {
  // Do something with Twitch Chat data...
  console.log('Twitch Chat:', data);
});

Handle Events

// Subscribe to Twitch Chat messages and register an event handler
client.on('Twitch.ChatMessage', (data) => {
  // Do something with Twitch Chat data...
  console.log('Twitch Chat:', data);
});