Skip to content

Modules

Modules are external services that connect to Rawtoh via WebSocket. They are the bridge between the outside world and your automations.

A module is any service that:

  • Connects to Rawtoh via a WebSocket connection
  • Emits events when something happens (e.g. a chat message, a song change)
  • Receives commands from your automations (e.g. “send a message”, “switch scene”)

Examples: a Twitch integration, an OBS controller, a media player.

Modules are organized into groups. A group represents a type of integration (e.g. “twitch”, “obs”). Each group can have multiple modules — for example, you could have two Twitch bots under the “twitch” group.

Each module has :

  • Un nom pour l’identifier (ex: bot1)
  • Un token d’authentification pour se connecter au WebSocket
  • Un état actif/inactif (enable/disable)
  1. You create a module group in the dashboard
  2. You add a module with a name and a token (used for authentication)
  3. The external module connects to the WebSocket endpoint and registers with its group, name, and token
  4. Once registered, it can emit events and receive commands

From your action scripts, you can call module methods in two ways:

Use module.request() when you need a result back. The call waits for the module to respond.

const result = await module.request("twitch", "sendMessage", {
text: "Hello from Rawtoh!"
});

Use module.notify() when you just want to send a command without waiting.

await module.notify("obs", "switchScene", {
scene: "BRB"
});

The target parameter can be:

  • A group name (e.g. "twitch") — sends to any available module in that group
  • A group/name (e.g. "twitch/bot1") — sends to a specific module

Each module group can have a manifest — a description of what the module can do. The manifest lists:

  • Methods — the commands the module accepts (e.g. sendMessage, switchScene)
  • Events — the types of events the module can emit (e.g. ChatMessage, SceneChanged)

Each method in the manifest describes:

FieldDescription
nameThe method name (e.g. sendMessage)
summaryA short description of what it does
paramsThe parameters it accepts (name, type, required or not)
resultWhat the method returns
errorsPossible error codes and messages
examplesExample calls with expected results

Each event in the manifest describes:

FieldDescription
nameThe event type (e.g. ChatMessage)
summaryA short description
payloadThe structure of the event data

The manifest helps the dashboard display available methods and events, and auto-fills parameters when you test RPC calls.

The dashboard includes a Test RPC tool to call module methods directly, without writing an action. This is useful for testing and debugging.

  1. Select a module group and a module
  2. Choose a method from the manifest (the parameters form is auto-filled based on the manifest)
  3. Edit the parameters (JSON)
  4. Click Call and see the response with the response time

This sends a request to the module via the backend (POST /module/{id}/rpc) and displays the result.

You can check if a module is online by using the ping button in the module list. It sends a special ping RPC call and shows whether the module responded.