Hi everyone! I'm running OpenClaw on a VPS (Contabo) to send WhatsApp notifications from a web app. I'm experiencing significant delays and looking for optimization advice.
π Setup
VPS: Contabo Linux, OpenClaw installed with WhatsApp + Telegram channels configured
Gateway running via PM2 (openclaw-gateway)
I built a Python HTTP wrapper (oc-send-api.py) on port 18800 that receives requests from my Vercel app and calls the CLI:
openclaw message send
--channel whatsapp
--target +628xxx
--message "..."
--json
For file attachments, I add --media /path/to/file
Exposed via Cloudflare Tunnel β Vercel calls it as an API
π Issues
Issue 1 β Text message latency (25s+ timeout)
Simple text messages sometimes take >25 seconds for openclaw message send to return. My subprocess timeout is 25s, causing a 504 back to the frontend. The message eventually gets delivered, but the CLI doesn't return in time.
Issue 2 β Attachment latency (30β90 seconds)
Sending a file with --media takes 30β90 seconds. I've worked around this with fire-and-forget (background thread), but the delay is still felt by the end user.
Issue 3 β Gateway frequent restarts
PM2 shows openclaw-gateway has restarted 12+ times. I suspect each restart causes the WA session to reconnect, making the next few sends slow. Is there a way to make the gateway more stable?
Issue 4 β Inbound webhook to Supabase latency
I have a hook (wa-to-supabase) that fires on message:received and does a POST to my Supabase endpoint. Sometimes there's a noticeable delay between a user sending a WA message and it appearing in our app's inbox. Is the hook fired synchronously or async? Any way to reduce this latency?
What I've already tried
Added --channel whatsapp flag (required since I have multiple channels)
Switched text sends to sync + 25s timeout, attachment sends to background thread (fire-and-forget)
Added a serial worker queue to prevent concurrent openclaw processes
Running gateway via PM2 for auto-restart