Channels
MAX_Plugin_OpenClaw
OpenClaw channel plugin for MAX messenger
Install
npm install
#
README
# MAX Channel Plugin for OpenClaw
OpenClaw channel plugin for [MAX messenger](https://max.ru).
## Status
✅ **Working** — polling inbound, outbound text messaging, DM security.
## Features
- **Inbound**: long-polling via `getUpdates` API
- **Outbound**: text messages via `sendMessage` API
- **DM security**: `open` / `allowlist` / `pairing` policies
- **Multi-user**: direct messages and group chats
## Config
```json5
{
channels: {
max: {
token: "your-bot-token", // required
dmPolicy: "allowlist", // optional: open | allowlist | pairing
pollingTimeout: 30, // optional: 5-60 seconds (default: 30)
allowFrom: ["user123"] // optional: for allowlist policy
}
}
}
```
Or via environment variable: `API_MAX_BOT=your-token`
## Development
```bash
# Install dependencies
cd ~/.openclaw/workspace/max-channel
npm install
# Build
npx tsc
# Install as plugin
openclaw plugins install --link ~/.openclaw/workspace/max-channel
openclaw gateway restart
# Watch logs
journalctl --user -u openclaw-gateway -f | grep "\[max\]"
```
## Architecture
```
index.ts → Plugin entry point (defineChannelPluginEntry)
├── src/channel.ts → ChannelPlugin + gateway (startAccount/stopAccount)
├── src/client.ts → MAX API HTTP client
├── src/types.ts → TypeScript types
└── setup-entry.ts → Lightweight setup entry
```
Key design decisions:
- **Polling loop is in `gateway.startAccount`** using `waitUntilAbort()` — this is the correct pattern for OpenClaw channel plugins. Never use `api.registerService()` for polling in channel plugins.
- **`gateway` is added via spread** after `createChatChannelPlugin()`, not passed as a parameter.
- **`ctx.abortSignal`** from the gateway context controls the polling lifecycle.
## API Reference
- [MAX Platform API](https://dev.max.ru/docs-api)
- [OpenClaw Channel Plugins](https://docs.openclaw.ai/plugins/sdk-channel-plugins)
channels
Comments
Sign in to leave a comment