Modules
Modules are the bridge between Rawtoh and the outside world — learn how they work.
Modules are the bridge between Rawtoh and the outside world. They connect to external services and let your automations interact with them.
Module (definition)
A module (also called a module definition or module group) describes an integration. It defines:
- A slug — a unique identifier like
twitch,obs, orspotify - A name — a human-readable label
- A manifest — a JSON document describing what the module can do
Private vs public modules
Module definitions can be either:
- Public — visible to all organizations. These are shared integrations (e.g. Twitch, OBS).
- Private — scoped to a single organization. Only members of that organization can use them.
The manifest
The manifest is the module's API contract. It lists:
- Events the module can emit — e.g.
chat.message,eventsub.stream_online. These are the events your triggers can watch for. - Methods the module exposes — e.g.
chat.say,scene.set_current. These are functions your actions can call.
The manifest is provided by the module itself when it connects. It powers the autocomplete in the script editor and lets you see what's available. All names use dot notation — e.g. chat.message, chat.say.
Module Instance
A module instance is an actual, running connection. While a module is a definition, an instance is a deployment.
Example:
- Module definition:
twitch - Instances:
main-bot— your primary Twitch botalerts-bot— a secondary bot for alerts
Each instance has its own API key. The key is generated at creation and shown once — make sure to copy it. The external tool uses this key to authenticate when connecting via WebSocket.
Why instances?
You might need multiple connections to the same service. For example, two Twitch bots, or multiple OBS instances on different machines. Each instance operates independently and can emit its own events.
How modules connect
Modules connect to Rawtoh via a WebSocket connection. Once connected, a module can:
- Register itself — authenticate with its API key
- Emit events — send data to Rawtoh that triggers can react to
- Receive method calls — Rawtoh sends requests to the module when an action calls one of its methods
Rawtoh automatically manages subscriptions — when you create, update, or delete triggers, connected modules are kept in sync without any manual action.
Calling modules from scripts
In your action code, use the module() function to call methods on connected modules:
import { module } from "rawtoh"
// By group only (picks the most recently connected instance)
await module("twitch").request("chat.say", { message: "Hello!" })
// By group and instance name (targets a specific instance)
await module("twitch", "main-bot").request("chat.say", { message: "Hello!" })
// Fire-and-forget (doesn't wait for the module's response)
await module("obs").notify("scene.set_current", { scene_name: "BRB" })Communication modes
| Mode | Description |
|---|---|
.request(method, params) | Waits for the module's response before continuing |
.notify(method, params) | Fire-and-forget — continues immediately without waiting |
Setting up a module
- Go to Settings → Module Definitions and make sure the module definition exists (or create one)
- Go to Settings → Modules and create a new instance for that definition
- Give it a name and copy the generated API key (it's shown only once)
- Configure your external tool with the API key and Rawtoh's WebSocket URL
- The module will appear as connected once it establishes the WebSocket connection