Skip to content

[Feature]: Add proxy support for WhatsApp channel (Baileys) #9882

Description

@dangogit

Problem
When running OpenClaw on cloud platforms (Fly.io, Railway, AWS, etc.), WhatsApp linking fails because WhatsApp detects and blocks datacenter IP addresses. The connection succeeds initially but immediately gets logged out:

WhatsApp QR received.
WhatsApp session logged out. Run: openclaw channels login
[default] channel exited: {"error":{"data":{"reason":"401","location":"atn"}...}

This is a known WhatsApp security measure - they block connections from datacenter IPs to prevent automation abuse.

Proposed Solution
Baileys already supports proxy configuration via the agent and fetchAgent options:

import { SocksProxyAgent } from 'socks-proxy-agent';

const wa = makeWASocket({
  agent: new SocksProxyAgent('socks5://user:pass@host:port'),
  fetchAgent: new SocksProxyAgent('socks5://user:pass@host:port'),
});

Request: Expose this configuration in OpenClaw, either via:

Config file - channels.whatsapp.proxy field:

{
  "channels": {
    "whatsapp": {
      "proxy": "socks5://user:pass@host:port"
    }
  }
}

Environment variable - WHATSAPP_PROXY or OPENCLAW_WHATSAPP_PROXY

Use Case
Users running OpenClaw on cloud platforms can configure a residential proxy (like Smartproxy, Bright Data, or similar) to route WhatsApp traffic through non-datacenter IPs, allowing successful WhatsApp linking.

Workaround Attempted
Setting system-level env vars (ALL_PROXY, HTTPS_PROXY) does not work because Baileys uses WebSocket connections directly and doesn't respect these environment variables.

Environment
OpenClaw version: 2026.2.3
Platform: Fly.io
Node.js: (from Docker image)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions