| name | openclaw-feishu-webhook-setup |
| description | Fix OpenClaw Feishu integration when messages aren't received. Diagnoses WebSocket failures, switches to webhook mode, creates cloudflared tunnel for public URL, and configures event subscription. |
OpenClaw Feishu Webhook Setup
Fix Feishu integration when personal chat or group messages aren't being received by the agent.
Problem Symptoms
- No response when messaging the bot in Feishu personal chat
- Groups show the bot but messages aren't processed
- Gateway logs show:
ws connect failed or unable to connect to the server
Root Cause
WebSocket mode requires special app permissions that may not be available for all Feishu app types. The error:
"receive events or callbacks through persistent connection only available in self-build & Feishu app"
Solution: Switch to webhook mode with a public URL tunnel.
Quick Fix Workflow
Step 1: Diagnose Current State
openclaw config get channels.feishu.connectionMode
openclaw config get channels.feishu
tail -50 ~/.openclaw/logs/gateway.log | grep -E '(feishu|websocket|webhook)'
Step 2: Create Public URL Tunnel
Option A: cloudflared (Recommended - Free)
which cloudflared
nohup cloudflared tunnel --url http://localhost:8080 > /tmp/cloudflared.log 2>&1 &
sleep 5
export PUBLIC_URL=$(cat /tmp/cloudflared.log | grep -o 'https://[a-z0-9-]*\.trycloudflare\.com' | head -1)
echo "Public URL: $PUBLIC_URL"
Option B: ngrok (If cloudflared unavailable)
ngrok http 8080
Step 3: Configure OpenClaw for Webhook Mode
openclaw config set channels.feishu.connectionMode webhook
openclaw config set channels.feishu.webhookUrl 'https://your-tunnel-url.trycloudflare.com/feishu/events'
openclaw config get channels.feishu.connectionMode
openclaw config get channels.feishu.webhookUrl
Step 4: Restart Gateway
openclaw gateway restart
tail -30 ~/.openclaw/logs/gateway.log | grep -E '(feishu|webhook)'
Expected output:
[feishu] starting feishu[default] (mode: webhook)
[feishu] feishu[default]: bot open_id resolved: ou_xxxxx
Step 5: Configure Feishu Open Platform
- Go to Feishu Open Platform
- Select your app (e.g.,
cli_a92c417c1b38dced)
- Navigate to 「事件与回调」 → 「事件订阅」
- Set 请求地址 to:
https://your-tunnel-url.trycloudflare.com/feishu/events
- Click 保存 (Save)
- Verify the URL is reachable (platform will test it)
Step 6: Test
Send a message to your bot in Feishu personal chat or a configured group.
Additional Configuration
Allow Personal Chat (DM)
openclaw config set channels.feishu.dmPolicy open
openclaw config set channels.feishu.allowFrom '["ou_your_user_id"]'
Configure Groups
openclaw config set channels.feishu.groups.oc_xxxxx.enabled true
openclaw config set channels.feishu.groups.oc_xxxxx.allowFrom '["ou_your_user_id"]'
Troubleshooting
| Issue | Solution |
|---|
ws connect failed | Switch to webhook mode (this guide) |
authentication failed | Check appId and appSecret in config |
unable to connect to the server | WebSocket not supported; use webhook |
| cloudflared fails | Check if port 8080 is available; try port 18789 |
| ngrok proxy error | Unset http_proxy environment variables |
| Events not received | Verify URL in Feishu platform matches tunnel URL |
Important Notes
- cloudflared tunnel is temporary - URL changes on restart. For production, use a fixed domain.
- Webhook mode is more reliable than WebSocket for most use cases.
- Gateway port - Default is 8080, but check
openclaw config get gateway.port to confirm.
- Keep tunnel running - If cloudflared stops, Feishu events won't be received.
Automation Script
#!/bin/bash
set -e
echo "=== OpenClaw Feishu Webhook Fix ==="
if ! command -v cloudflared &> /dev/null; then
echo "❌ cloudflared not found. Install with: brew install cloudflare/cloudflare/cloudflared"
exit 1
fi
pkill -f "cloudflared tunnel" || true
echo "Starting cloudflared tunnel..."
nohup cloudflared tunnel --url http://localhost:8080 > /tmp/cloudflared.log 2>&1 &
sleep 6
PUBLIC_URL=$(cat /tmp/cloudflared.log | grep -o 'https://[a-z0-9-]*\.trycloudflare\.com' | head -1)
if [ -z "$PUBLIC_URL" ]; then
echo "❌ Failed to get public URL. Check /tmp/cloudflared.log"
exit 1
fi
echo "✅ Public URL: $PUBLIC_URL"
openclaw config set channels.feishu.connectionMode webhook
openclaw config set channels.feishu.webhookUrl "${PUBLIC_URL}/feishu/events"
openclaw gateway restart
echo ""
echo