OpenClaw Plugin
Connect OpenClaw AI agents to Opengram using the official plugin.
The @opengramsh/openclaw-plugin plugin connects OpenClaw agents to Opengram, letting them send and receive messages, handle interactive requests, and stream responses through the Opengram chat UI.
Prerequisites
- Node.js >= 20
- OpenClaw >= 2026.1.0
How it works
The plugin registers Opengram as a communication channel for your OpenClaw agent. When a message is dispatched to your agent, OpenClaw receives it through the plugin, runs its reasoning loop, and streams responses back through the Opengram API. The plugin handles SSE-based event listening, dispatch claiming, heartbeating, and completing the dispatch lifecycle automatically.
Capabilities
| Feature | Supported |
|---|---|
| Direct chats | Yes |
| Media attachments | Yes |
| Block streaming | Yes |
| Native commands | Soon |
| Threads | No |
| Reactions | No |
Installation
Option A: Install script (recommended)
curl -fsSL https://opengram.sh/openclaw/install | shThe script installs the plugin and runs the interactive setup wizard, which configures everything for you.
Option B: npm install
npm install -g @opengramsh/openclaw-plugin
opengram-openclaw setupThe opengram-openclaw setup command patches your openclaw.json automatically (adding the plugin to plugins.load.paths and plugins.allow), then walks you through the connection setup.
Option C: via opengram init
If the openclaw CLI is available on your system, the Opengram init wizard detects it automatically during opengram init. When detected, the wizard offers to install the plugin and run the setup wizard with pre-filled connection settings.
Reconfiguring
After initial setup, you can reconfigure the plugin at any time:
opengram-openclaw setupOr, if the plugin is already loaded in OpenClaw:
openclaw opengram setupBoth commands run the same interactive wizard -- they test the connection, configure the instance secret, let you select which agents to link, and optionally restart the gateway to apply changes.
Manual configuration
If you prefer to skip the wizard entirely, add the plugin to your openclaw.json manually:
{
"plugins": {
"allow": ["@opengramsh/openclaw-plugin"],
"load": {
"paths": ["/path/to/node_modules/@opengramsh/openclaw-plugin"]
},
"entries": {
"@opengramsh/openclaw-plugin": { "enabled": true }
}
},
"channels": {
"opengram": {
"baseUrl": "http://localhost:3000",
"instanceSecret": "your_opengram_instance_secret",
"agents": ["my-agent"]
}
}
}Start OpenClaw and the plugin connects via SSE, listening for user messages automatically.
Configuration
All configuration lives under channels.opengram in your OpenClaw config file.
| Key | Type | Default | Description |
|---|---|---|---|
baseUrl | string | http://localhost:3000 | Opengram instance URL |
instanceSecret | string | — | API auth secret. Also reads OPENGRAM_INSTANCE_SECRET env var. |
agents | string[] | [] | Linked OpenClaw agent IDs |
dmPolicy | string | "pairing" | DM policy: open, pairing, allowlist, or disabled |
allowFrom | string[] | [] | User IDs always permitted to message (used with allowlist policy) |
showReasoningMessages | boolean | false | Show agent reasoning/thinking messages in chat |
defaultModelId | string | — | Default model ID for chats created in Opengram |
reconnectDelayMs | number | 3000 | SSE reconnect delay in ms after connection loss |
The plugin also supports an autoRename object for automatic chat title generation. See the Auto Rename feature docs for details.
Agent tools
The plugin provides three tools that your OpenClaw agents can use during their reasoning loop:
opengram_chat-- Create, update, and list chats.opengram_media-- Upload media files to a chat.opengram_search-- Full-text search across conversations.
These tools are registered automatically when the plugin loads -- no extra configuration needed.
When to use this plugin
The OpenClaw plugin is a good fit if you are already building agents with OpenClaw and want to give them a chat interface without writing HTTP plumbing yourself. If you are using a different agent framework, or building your agent from scratch, use the Dispatch System and REST API directly instead.