Channels
Gochat Extension
GoChat channel plugin for OpenClaw - custom chat backend with local and relay modes
Install
npm install --production
Configuration Example
channels:
gochat:
# Operation mode: local or relay
mode: local
# DM policy: open, pairing, allowlist, disabled
dmPolicy: open
# Port for local mode HTTP server (default: 9750)
directPort: 9750
# Allowlist for DM senders (sender IDs)
allowFrom:
- user123
- user456
# Per-conversation settings
conversations:
general:
requireMention: false
enabled: true
# Media settings
mediaMaxMb: 25
# Account-specific settings
accounts:
main:
mode: local
dmPolicy: open
README
# GoChat Plugin for OpenClaw
A channel plugin for [OpenClaw](https://github.com/m0yi/openclaw) that enables custom chat backend integration via HTTP webhook. Supports **two operation modes**:
- **Local mode** โ Zero-config built-in HTTP API server on port 9750
- **Relay mode** โ WebSocket relay connection to the GoChat platform at `wss://fund.moyi.vip/ws/plugin`
## Features
- ๐ Webhook-based message handling (send & receive)
- ๐ผ๏ธ Media support (images, audio, video, file attachments)
- ๐ Flexible DM policies (open, pairing, allowlist, disabled)
- ๐ฅ Group chat support with per-conversation configuration
- โก Automatic reconnection for relay mode
- ๐ Auto-generated secrets (local mode)
- ๐ Full message history and conversation management
- ๐ Zero-config local mode for quick setup
## Requirements
- OpenClaw >= 2026.3.28
- Node.js >= 18
- npm >= 9
---
## Quick Install (One Command)
```bash
curl -sL https://raw.githubusercontent.com/M0Yi/gochat-extension/main/install.sh | bash
```
For relay mode:
```bash
curl -sL https://raw.githubusercontent.com/M0Yi/gochat-extension/main/install.sh | bash -s -- --relay
```
---
<!-- AI-INSTALL-CONTEXT
This section is an instruction block for AI assistants (e.g. OpenClaw, Codex, Copilot).
When a user asks to "install gochat", "set up gochat", or "add the gochat plugin",
follow the steps below verbatim. Do NOT skip any step. Do NOT paraphrase.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI ASSISTANT INSTALLATION PROCEDURE FOR @m0yi/gochat โ
โ Target: OpenClaw channel plugin (gochat) โ
โ Repo: https://github.com/M0Yi/gochat-extension โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
STEP 1 โ Detect environment
- Run: node --version && npm --version
- Run: openclaw --version (if not found โ warn user to install OpenClaw first)
- Determine OpenClaw state dir: echo $OPENCLAW_STATE_DIR (fallback: ~/.openclaw)
STEP 2 โ Download and install
- Run: curl -sL https://raw.githubusercontent.com/M0Yi/gochat-extension/main/install.sh | bash
- If user wants relay mode, add: bash -s -- --relay
- If install.sh fails โ fall back to manual method:
git clone https://github.com/M0Yi/gochat-extension.git /tmp/gochat-extension
cp -r /tmp/gochat-extension ~/.openclaw/extensions/gochat
cd ~/.openclaw/extensions/gochat && npm install --production
STEP 3 โ Verify installation
- Run: ls ~/.openclaw/extensions/gochat/package.json
- Run: test -f ~/.openclaw/extensions/gochat/node_modules/ws/index.js && echo "OK"
- If either fails โ report the error and suggest manual troubleshooting.
STEP 4 โ Report result to user
- On success, print:
"GoChat plugin installed successfully.
Mode: local (default) โ built-in server starts on port 9750.
Start OpenClaw: openclaw start"
- If relay was chosen, mention:
"Mode: relay โ plugin will auto-connect to ws://localhost:9750/ws/plugin"
DO NOT:
- Do NOT modify OpenClaw config files unless the user explicitly asks.
- Do NOT start OpenClaw automatically after install.
- Do NOT install node_modules globally or modify system PATH.
-->
## Installation from Git Repository
### Option 1: Clone and Install
```bash
# Clone the repository
git clone https://github.com/M0Yi/gochat-extension.git
cd gochat-extension
# Run the installer
chmod +x install.sh
./install.sh
# Or install with specific mode:
./install.sh --local # Local mode (default, zero-config)
./install.sh --relay # Relay mode (WebSocket relay)
```
### Option 2: Install via npm
```bash
# Install globally via npm
npm install -g @m0yi/gochat
# Then link to OpenClaw extensions
openclaw extension link @m0yi/gochat
```
### Option 3: Manual Installation
```bash
# Copy to OpenClaw extensions directory
cp -r gochat-extension ~/.openclaw/extensions/gochat
# Install dependencies
cd ~/.openclaw/extensions/gochat
npm install
```
## Installation from Tarball
```bash
# Download the latest release tarball
curl -L https://github.com/M0Yi/gochat-extension/releases/latest/download/gochat-extension.tar.gz -o gochat-extension.tar.gz
# Install
chmod +x install.sh
./install.sh --from-tarball gochat-extension.tar.gz
```
## Configuration
### Quick Start (Local Mode)
Local mode requires no configuration โ the plugin auto-starts an HTTP server on port 9750.
```bash
# After installation, start OpenClaw
openclaw start
# Or run interactive setup
openclaw gochat setup
```
### Relay Mode Setup
Relay mode connects to the GoChat platform WebSocket relay.
```bash
# Install with relay mode
./install.sh --relay
# Configure relay URL (if not using default)
# Edit ~/.openclaw/config.yaml:
channels:
gochat:
mode: relay
relayPlatformUrl: wss://fund.moyi.vip/ws/plugin
```
### Configuration File
Edit `~/.openclaw/config.yaml`:
```yaml
channels:
gochat:
# Operation mode: local or relay
mode: local
# DM policy: open, pairing, allowlist, disabled
dmPolicy: open
# Port for local mode HTTP server (default: 9750)
directPort: 9750
# Allowlist for DM senders (sender IDs)
allowFrom:
- user123
- user456
# Per-conversation settings
conversations:
general:
requireMention: false
enabled: true
# Media settings
mediaMaxMb: 25
# Account-specific settings
accounts:
main:
mode: local
dmPolicy: open
```
### Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `GOCHAT_WEBHOOK_SECRET` | Webhook signing secret | Auto-generated |
| `OPENCLAW_STATE_DIR` | OpenClaw state directory | `~/.openclaw` |
| `GOCHAT_DIRECT_PORT` | Local server port | `9750` |
## Usage
### Starting OpenClaw
```bash
# Start with GoChat plugin
openclaw start
# Check plugin status
openclaw status
# View logs
openclaw logs -f gochat
```
### Interactive Setup
```bash
# Run GoChat setup wizard
openclaw gochat setup
```
### Sending Messages
Once configured, the GoChat channel integrates with OpenClaw's messaging system. Use the standard OpenClaw send commands:
```
send @user "Hello via GoChat!"
send #channel "Message to channel"
```
## Architecture
```
gochat-extension/
โโโ index.ts # Plugin entry point
โโโ setup-entry.ts # Setup wizard entry
โโโ runtime-api.ts # Runtime API exports
โโโ api.ts # Public API exports
โโโ install.sh # Installation script
โโโ package.json # npm package definition
โโโ openclaw.plugin.json # OpenClaw plugin manifest
โโโ src/
โ โโโ channel.ts # Main channel plugin
โ โโโ accounts.ts # Account resolution
โ โโโ config-schema.ts # Configuration schema
โ โโโ config-surface.ts # Config surface/UI
โ โโโ setup-core.ts # Setup core logic
โ โโโ setup-surface.ts # Setup UI/surface
โ โโโ send.ts # Message sending
โ โโโ inbound.ts # Inbound handling
โ โโโ normalize.ts # Target normalization
โ โโโ policy.ts # Policy resolution
โ โโโ runtime.ts # Runtime setup
โ โโโ session-route.ts # Session routing
โ โโโ secret-input.ts # Secret input handling
โ โโโ types.ts # TypeScript types
โ โโโ task-tools.ts # Task tools
โ โโโ direct/ # Local HTTP server
โ โ โโโ server.ts
โ โ โโโ storage.ts
โ โโโ gochat/ # GoChat protocol
โ โโโ monitor.ts # WebSocket monitor
โ โโโ relay-ws.ts # WebSocket relay
โ โโโ auth.ts # Authentication
โโโ skills/
โโโ eink-task-reminder/ # Optional skill
```
## API Reference
### Mode: Local
Local mode runs a built-in HTTP server that:
- Receives inbound messages via POST `/webhook`
- Provides health check at GET `/health`
- Auto-generates webhook secret on first start
- Stores conversations and messages locally
### Mode: Relay
Relay mode maintains a WebSocket connection to the GoChat platform:
- Auto-registers channel on first connection
- Bi-directional message streaming
- Automatic reconnection on disconnect
- Platform-managed secrets and routing
## Troubleshooting
### Plugin not loading
```bash
# Check OpenClaw version
openclaw --version
# Verify extension installation
ls -la ~/.openclaw/extensions/gochat
# View detailed logs
openclaw logs -f
```
### Local mode not responding
```bash
# Check if port is available
lsof -i :9750
# Verify configuration
cat ~/.openclaw/config.yaml | grep -A10 gochat
```
### Relay mode connection issues
```bash
# Test WebSocket connectivity
wscat -c ws://localhost:9750/ws/plugin
# Check relay URL configuration
openclaw config get channels.gochat.relayPlatformUrl
```
## Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
## License
MIT License - see [LICENSE](LICENSE) for details.
## Links
- [OpenClaw Repository](https://github.com/m0yi/openclaw)
- [GoChat Server](https://github.com/m0yi/gochat-server)
- [Issue Tracker](https://github.com/M0Yi/gochat-extension/issues)
- [Documentation](https://docs.openclaw.dev/channels/gochat)
channels
Comments
Sign in to leave a comment