Modules
Modules are external services that connect to Rawtoh via WebSocket. They are the bridge between the outside world and your automations.
What is a module?
Section titled “What is a module?”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.
Module groups
Section titled “Module groups”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)
How modules connect
Section titled “How modules connect”- You create a module group in the dashboard
- You add a module with a name and a token (used for authentication)
- The external module connects to the WebSocket endpoint and registers with its group, name, and token
- Once registered, it can emit events and receive commands
Calling modules from actions
Section titled “Calling modules from actions”From your action scripts, you can call module methods in two ways:
Request (with response)
Section titled “Request (with response)”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!"});Notify (fire-and-forget)
Section titled “Notify (fire-and-forget)”Use module.notify() when you just want to send a command without waiting.
await module.notify("obs", "switchScene", { scene: "BRB"});Targeting
Section titled “Targeting”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
Module manifest
Section titled “Module manifest”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)
Methods
Section titled “Methods”Each method in the manifest describes:
| Field | Description |
|---|---|
| name | The method name (e.g. sendMessage) |
| summary | A short description of what it does |
| params | The parameters it accepts (name, type, required or not) |
| result | What the method returns |
| errors | Possible error codes and messages |
| examples | Example calls with expected results |
Events
Section titled “Events”Each event in the manifest describes:
| Field | Description |
|---|---|
| name | The event type (e.g. ChatMessage) |
| summary | A short description |
| payload | The structure of the event data |
The manifest helps the dashboard display available methods and events, and auto-fills parameters when you test RPC calls.
Test RPC (dashboard)
Section titled “Test RPC (dashboard)”The dashboard includes a Test RPC tool to call module methods directly, without writing an action. This is useful for testing and debugging.
- Select a module group and a module
- Choose a method from the manifest (the parameters form is auto-filled based on the manifest)
- Edit the parameters (JSON)
- 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.