🌐

WebChat 集成

將 OpenClaw 連接到 WebChat,直接在您的網站中嵌入 AI 助手。

快速開始

  • 在 openclaw.json 中配置 WebSocket Gateway
  • 啟用 Gateway 後啟動 OpenClaw
  • 在您的網站上嵌入聊天小部件
  • 預計時間:約 5 分鐘

設置步驟

步驟 1: 配置 openclaw.json

{
  "channels": {
    "webchat": {
      "enabled": true,
      "gateway": {
        "port": 3000,
        "path": "/ws",
        "auth": {
          "enabled": true,
          "apiKeys": ["your-api-key-1", "your-api-key-2"]
        }
      }
    }
  }
}

步驟 2: 啟動 OpenClaw

openclaw start

WebSocket Gateway 默認將在端口 3000 上啟動。

步驟 3: 嵌入聊天小部件

將 OpenClaw 聊天小部件添加到您的網站:

<script src="https://your-openclaw-server.com/widget.js"></script>
<script>
  OpenClaw.init({
    server: 'wss://your-openclaw-server.com/ws',
    apiKey: 'your-api-key',
    theme: {
      primaryColor: '#FF4500',
      position: 'bottom-right'
    }
  });
</script>

功能特性

可自定義

完全可自定義的小部件外觀。

API 密鑰

使用 API 密鑰進行安全身份驗證。

實時響應

WebSocket 實現即時響應。

主題

多種主題選項和深色模式。