| name | openclaw-multi-channel-ai-assistant |
| description | Self-hosted multi-channel AI assistant platform with unified Gateway, supporting WhatsApp, Telegram, Discord, and 20+ chat platforms with Claude, GPT, DeepSeek integration |
| triggers | ["how do I set up OpenClaw with Telegram","configure OpenClaw gateway and channels","deploy OpenClaw AI assistant","connect OpenClaw to WhatsApp or Discord","OpenClaw agent configuration and tools","troubleshoot OpenClaw channel connection","setup OpenClaw with Claude or GPT","OpenClaw node and plugin system"] |
OpenClaw Multi-Channel AI Assistant
Skill by ara.so — Hermes Skills collection.
OpenClaw is a self-hosted multi-channel AI assistant platform that connects Web control UI, chat channels (WhatsApp, Telegram, Discord, Slack, Signal, Feishu, etc.), nodes, tools, and AI models through a unified Gateway architecture. This skill covers installation, configuration, channel setup, AI provider integration, plugin development, and troubleshooting.
What OpenClaw Does
- Unified Gateway: Central control plane that routes messages between channels, nodes, and AI agents
- Multi-Channel Support: 20+ chat platforms including WhatsApp, Telegram, Discord, Slack, Signal, iMessage, Feishu, Teams, Matrix
- Multi-Model Support: Anthropic Claude, OpenAI GPT, DeepSeek, Qwen, Kimi, GLM, Ollama, and more
- Tool System: Browser automation, code execution, skills, sub-agents
- Plugin Architecture: Hooks, adapters, and extensible agent framework
- Mobile Nodes: Remote execution nodes for distributed AI workflows
- Web UI: Browser-based control panel for configuration and monitoring
Installation
Quick Start (Docker)
git clone https://github.com/openclaw/openclaw.git
cd openclaw
cp .env.example .env
nano .env
docker-compose up -d
Node.js Installation
git clone https://github.com/openclaw/openclaw.git
cd openclaw
npm install
cp .env.example .env
npm run gateway:start
npm run web:start
npm run channel:telegram
Cloud Deployment
curl -fsSL https://get.openclaw.ai | bash
wget https://github.com/openclaw/openclaw/releases/latest/download/install.sh
chmod +x install.sh
./install.sh
Core Architecture
Gateway Configuration
The Gateway is the central hub. Configure in config/gateway.yaml:
gateway:
host: 0.0.0.0
port: 3000
secret: ${GATEWAY_SECRET}
channels:
- type: telegram
enabled: true
token: ${TELEGRAM_BOT_TOKEN}
- type: whatsapp
enabled: true
provider: baileys
- type: discord
enabled: true
token: ${DISCORD_BOT_TOKEN}
models:
- provider: anthropic
model: claude-3-5-sonnet-20241022
apiKey: ${ANTHROPIC_API_KEY}
- provider: openai
model: gpt-4-turbo
apiKey: ${OPENAI_API_KEY}
- provider: ollama
model: llama3
baseURL: http://localhost:11434
agent:
defaultModel:
Environment Variables
Create .env file:
GATEWAY_SECRET=your-secure-random-secret
GATEWAY_PORT=3000
ANTHROPIC_API_KEY=sk-ant-xxxxx
OPENAI_API_KEY=sk-xxxxx
DEEPSEEK_API_KEY=sk-xxxxx
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
DISCORD_BOT_TOKEN=MTk4NjIy...
WHATSAPP_SESSION_PATH=./sessions/whatsapp
DATABASE_URL=postgresql://user:pass@localhost:5432/openclaw
DATABASE_URL=sqlite:./data/openclaw.db
MEMORY_PROVIDER=sqlite
MEMORY_RETENTION_DAYS=30
ENABLE_BROWSER_TOOL=true
ENABLE_CODE_EXECUTION=false
SEARXNG_URL=http://localhost:8080
CLI Commands
Gateway Management
npm run gateway:start
./openclaw gateway start
./openclaw gateway status
./openclaw gateway reload
./openclaw gateway logs --tail 100
Channel Management
./openclaw channels list
./openclaw channel start telegram
./openclaw channel start whatsapp
./openclaw channel start discord
./openclaw channel stop telegram
./openclaw channel auth whatsapp
Node Management
./openclaw node register --name "mobile-node-1" --type mobile
./openclaw node list
./openclaw node start mobile-node-1
./openclaw node health mobile-node-1
Plugin Management
./openclaw plugin list
./openclaw plugin install @openclaw/plugin-calendar
./openclaw plugin create my-custom-plugin
./openclaw plugin enable my-custom-plugin
./openclaw plugin disable my-custom-plugin
Channel Adapter Implementation
Creating a Custom Channel Adapter
import { ChannelAdapter } from '@openclaw/core';
export default class MyChannelAdapter extends ChannelAdapter {
constructor(config) {
super(config);
this.client = null;
}
async initialize() {
this.client = new MyChannelClient({
token: this.config.token,
apiUrl: this.config.apiUrl
});
this.client.on('message', this.handleIncomingMessage.bind(this));
await this.client.connect();
this.logger.info('MyChannel adapter initialized');
}
() {
message = {
: rawMessage.,
: ,
: rawMessage..,
: rawMessage.,
: rawMessage.,
: {
: rawMessage..,
: rawMessage.
}
};
.(message);
}
() {
{ chatId } = .(sessionKey);
..({
chatId,
: response.,
: response.
});
}
() {
(.) {
..();
}
}
}
manifest = {
: ,
: ,
: ,
: [],
: []
};
Register Channel in Gateway
import MyChannelAdapter from './plugins/channels/my-channel/index.js';
export const channelRegistry = {
telegram: TelegramAdapter,
whatsapp: WhatsAppAdapter,
discord: DiscordAdapter,
'my-channel': MyChannelAdapter
};
Agent Configuration & Tools
Custom Agent Prompt
export const agentConfig = {
systemPrompt: `You are a helpful AI assistant with access to various tools.
Available tools:
- browser: Navigate websites and extract information
- webSearch: Search the internet using SearXNG
- executeCode: Run Python code (sandboxed)
Guidelines:
- Be concise but helpful
- Always cite sources when using web search
- Ask for confirmation before executing code
- Respect user privacy`,
model: 'claude-3-5-sonnet-20241022',
temperature: 0.7,
maxTokens: 4096,
tools: {
browser: {
enabled: true,
timeout: 30000,
userAgent: 'OpenClaw/1.0'
},
webSearch: {
enabled: true,
searxngUrl: process.env.SEARXNG_URL,
maxResults: 5
},
codeExecution: {
enabled: false,
languages: ['python', 'javascript'],
timeout: 10000
}
},
memory: {
enabled: true,
contextWindow: 50,
summarization: true,
:
}
};
Implementing a Custom Tool
import { Tool } from '@openclaw/core';
export default class WeatherTool extends Tool {
constructor() {
super({
name: 'getWeather',
description: 'Get current weather for a location',
parameters: {
type: 'object',
properties: {
location: {
type: 'string',
description: 'City name or coordinates'
},
units: {
type: 'string',
enum: ['metric', 'imperial'],
default: 'metric'
}
},
required: ['location']
}
});
}
async execute({ location, units = 'metric' }) {
const apiKey = process.env.WEATHER_API_KEY;
const response = await fetch(
`https://api.openweathermap.org/data/2.5/weather?q=${location}&units=&appid=`
);
(!response.) {
();
}
data = response.();
{
: data.,
: data..,
: data.[].,
: data..,
units
};
}
}
{ registerTool } ;
( ());
Agent with Tool Usage
import { Agent } from '@openclaw/core';
const agent = new Agent({
model: 'claude-3-5-sonnet-20241022',
apiKey: process.env.ANTHROPIC_API_KEY,
tools: ['getWeather', 'webSearch', 'browser']
});
async function processUserMessage(message, sessionKey) {
const context = await agent.getContext(sessionKey);
const response = await agent.process({
messages: [...context, { role: 'user', content: message }],
sessionKey,
toolChoice: 'auto'
});
if (response.toolCalls) {
console.log('Tools used:', response.toolCalls.map(t => t.name));
}
await agent.(sessionKey, response);
response.;
}
Session & Context Management
Session Key Format
OpenClaw uses session keys to route conversations:
const sessionKey = 'telegram:123456789:987654321';
const sessionKey = 'whatsapp:+1234567890:group123';
const sessionKey = 'discord:user123:channel456';
function parseSessionKey(sessionKey) {
const [channel, userId, chatId] = sessionKey.split(':');
return { channel, userId, chatId };
}
function createSessionKey(channel, userId, chatId) {
return `${channel}:${userId}:${chatId || userId}`;
}
Context Window Management
import { ContextManager } from '@openclaw/core';
const contextManager = new ContextManager({
provider: 'sqlite',
dbPath: './data/context.db',
maxMessages: 50,
summarizationThreshold: 30
});
await contextManager.addMessage(sessionKey, {
role: 'user',
content: 'What is the weather in Tokyo?',
timestamp: Date.now()
});
const context = await contextManager.getContext(sessionKey, {
maxTokens: 4000,
includeSummary: true
});
await contextManager.pruneContext(sessionKey, {
keepLast: 20,
summarizeRest: true
});
await contextManager.clearContext(sessionKey);
Plugin Development
Plugin Hook System
export default class MyPlugin {
constructor(core) {
this.core = core;
}
async onBeforeAgentProcess(message, context) {
console.log('Processing message:', message.text);
if (message.text.includes('urgent')) {
context.priority = 'high';
}
return { message, context };
}
async onBeforeMessageSend(response, sessionKey) {
response.text += '\n\n_Powered by OpenClaw_';
await this.logAnalytics(sessionKey, response);
return response;
}
async onToolExecute(toolName, params, result) {
console.log(`Tool ${toolName} executed with:`, params);
return result;
}
() {
}
}
manifest = {
: ,
: ,
: [
,
,
]
};
Plugin Configuration
plugins:
- name: my-plugin
enabled: true
config:
customSetting: value
- name: analytics-plugin
enabled: true
config:
endpoint: https://analytics.example.com
apiKey: ${ANALYTICS_API_KEY}
- name: calendar-integration
enabled: false
Advanced Configuration
Multi-Model Fallback
export const modelConfig = {
providers: [
{
name: 'primary',
provider: 'anthropic',
model: 'claude-3-5-sonnet-20241022',
apiKey: process.env.ANTHROPIC_API_KEY,
priority: 1
},
{
name: 'fallback-1',
provider: 'openai',
model: 'gpt-4-turbo',
apiKey: process.env.OPENAI_API_KEY,
priority: 2
},
{
name: 'fallback-2',
provider: 'ollama',
model: 'llama3',
baseURL: 'http://localhost:11434',
priority: 3
}
],
fallbackStrategy: 'priority',
retryAttempts: 3,
timeoutMs: 30000
};
import { Agent } from '@openclaw/core';
const agent = new Agent({ : modelConfig });
Memory Backends
export const memoryConfig = {
provider: 'sqlite',
path: './data/memory.db'
};
export const memoryConfig = {
provider: 'postgres',
connectionString: process.env.DATABASE_URL,
schema: 'openclaw_memory'
};
export const memoryConfig = {
provider: 'redis',
host: process.env.REDIS_HOST || 'localhost',
port: process.env.REDIS_PORT || 6379,
password: process.env.REDIS_PASSWORD,
db: 0,
ttl: 2592000
};
Common Patterns
Multi-Channel Broadcasting
import { Gateway } from '@openclaw/core';
const gateway = new Gateway();
async function broadcast(message, channels) {
const promises = channels.map(async ({ channel, userId }) => {
const sessionKey = `${channel}:${userId}:${userId}`;
await gateway.sendMessage(sessionKey, {
text: message,
metadata: { broadcast: true }
});
});
await Promise.all(promises);
}
await broadcast('System maintenance in 10 minutes', [
{ channel: 'telegram', userId: '123456' },
{ channel: 'discord', userId: '789012' },
{ channel: 'whatsapp', userId: '+1234567890' }
]);
Scheduled Tasks with Cron
import cron from 'node-cron';
import { Gateway } from '@openclaw/core';
export default class SchedulerPlugin {
constructor(core) {
this.core = core;
this.gateway = new Gateway();
this.jobs = [];
}
async initialize() {
const dailySummary = cron.schedule('0 9 * * *', async () => {
await this.sendDailySummary();
});
this.jobs.push(dailySummary);
const reminderCheck = cron.schedule('0 * * * *', async () => {
await this.checkReminders();
});
this.jobs.push(reminderCheck);
}
async sendDailySummary() {
users = ..();
( user users) {
summary = .(user);
..(user., {
:
});
}
}
() {
}
() {
..( job.());
}
}
Webhook Integration
import express from 'express';
import { Gateway } from '@openclaw/core';
const app = express();
const gateway = new Gateway();
app.use(express.json());
app.post('/webhooks/github', async (req, res) => {
const event = req.headers['x-github-event'];
const payload = req.body;
if (event === 'push') {
const message = `🔔 New push to ${payload.repository.full_name}\n` +
`Branch: ${payload.ref}\n` +
`Commits: ${payload.commits.length}\n` +
`Author: ${payload.pusher.name}`;
await gateway.sendMessage(
process.env.GITHUB_NOTIFICATION_SESSION,
{ text: message }
);
}
res.status(200).send('OK');
});
app.listen(3001, () => {
.();
});
Troubleshooting
Gateway Connection Issues
curl http://localhost:3000/health
tail -f logs/gateway.log
./openclaw config verify
./openclaw channel test telegram
Channel Adapter Not Receiving Messages
logging:
level: debug
channels: true
DEBUG=openclaw:channel:* npm run gateway:start
Memory/Context Issues
import { ContextManager } from '@openclaw/core';
const cm = new ContextManager();
const stats = await cm.getContextStats(sessionKey);
console.log('Messages:', stats.messageCount);
console.log('Estimated tokens:', stats.tokenCount);
await cm.summarizeContext(sessionKey);
await cm.clearContext(sessionKey);
Model API Errors
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-3-5-sonnet-20241022","max_tokens":1024,"messages":[{"role":"user","content":"test"}]}'
./openclaw models test anthropic
export const agentConfig = {
enableFallback: true,
fallbackModels: ['openai/gpt-4-turbo', 'ollama/llama3']
};
WhatsApp QR Code Not Appearing
rm -rf sessions/whatsapp/*
./openclaw channel stop whatsapp
./openclaw channel start whatsapp --fresh-auth
tail -f logs/whatsapp.log
docker-compose logs -f whatsapp
Database Migration Issues
./openclaw db status
./openclaw db migrate
./openclaw db rollback
./openclaw db reset --confirm
Performance Optimization
export const performanceConfig = {
streaming: true,
parallelTools: true,
maxParallelTools: 3,
contextCache: {
enabled: true,
ttl: 300,
maxSize: 100
},
rateLimit: {
enabled: true,
maxRequests: 50,
windowMs: 60000
}
};
Production Deployment Checklist
GATEWAY_SECRET=$(openssl rand -hex 32)
NODE_ENV=production
module.exports = {
apps: [{
name: 'openclaw-gateway',
script: './dist/gateway.js',
instances: 2,
exec_mode: 'cluster',
env: {
NODE_ENV: 'production'
}
}]
};
This skill covers OpenClaw installation, channel configuration, agent setup, plugin development, and production deployment. All code examples use environment variables for secrets and demonstrate real integration patterns.