Rawtoh Rawtoh / Docs

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:

Private vs public modules

Module definitions can be either:

The manifest

The manifest is the module's API contract. It lists:

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:

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:

  1. Register itself — authenticate with its API key
  2. Emit events — send data to Rawtoh that triggers can react to
  3. 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

  1. Go to Settings → Module Definitions and make sure the module definition exists (or create one)
  2. Go to Settings → Modules and create a new instance for that definition
  3. Give it a name and copy the generated API key (it's shown only once)
  4. Configure your external tool with the API key and Rawtoh's WebSocket URL
  5. The module will appear as connected once it establishes the WebSocket connection