Summary
## Feature Description
Add support for configuring a proxy for WhatsApp connections, similar to the existing proxy support for Telegram.
## Use Case
Users in regions where WhatsApp is blocked (e.g., China mainland) need to use a proxy to connect to WhatsApp Web. Currently, Telegram already supports proxy configuration via `channels.telegram.proxy`, but WhatsApp does not have this option.
## Proposed Solution
Add a `proxy` configuration option to `WhatsAppConfig` in `src/config/types.whatsapp.ts`, similar to how it's implemented for Telegram:
```typescript
// In WhatsAppConfig:
proxy?: string;
Then pass this proxy to the Baileys makeWASocket function in src/web/session.ts:
import { ProxyAgent } from "undici";
const sock = makeWASocket({
// ... existing options
fetchAgent: new ProxyAgent(proxyUrl),
});
Why This Works
- The
@whiskeysockets/baileys library supports proxy via the fetchAgent option
- Telegram already has a working proxy implementation in
src/telegram/proxy.ts using undici's ProxyAgent
- This approach is consistent with the existing Telegram proxy feature
Additional Context
### Problem to solve
## Why This Works
- The `@whiskeysockets/baileys` library supports proxy via the `fetchAgent` option
- Telegram already has a working proxy implementation in `src/telegram/proxy.ts` using `undici`'s `ProxyAgent`
- This approach is consistent with the existing Telegram proxy feature
## Additional Context
- Telegram proxy config: `channels.telegram.proxy`
- Telegram proxy implementation: `src/telegram/monitor.ts` (line ~120)
- Baileys documentation: https://github.com/WhiskeySockets/Baileys#using-a-proxy
### Proposed solution
## Proposed Solution
Add a `proxy` configuration option to `WhatsAppConfig` in `src/config/types.whatsapp.ts`, similar to how it's implemented for Telegram:
```typescript
// In WhatsAppConfig:
proxy?: string;
Then pass this proxy to the Baileys makeWASocket function in src/web/session.ts:
import { ProxyAgent } from "undici";
const sock = makeWASocket({
// ... existing options
fetchAgent: new ProxyAgent(proxyUrl),
});
Alternatives considered
No response
Impact
Additional Context
Evidence/examples
No response
Additional information
No response
Summary
Then pass this proxy to the Baileys
makeWASocketfunction insrc/web/session.ts:Why This Works
@whiskeysockets/baileyslibrary supports proxy via thefetchAgentoptionsrc/telegram/proxy.tsusingundici'sProxyAgentAdditional Context
channels.telegram.proxysrc/telegram/monitor.ts(line ~120)Then pass this proxy to the Baileys
makeWASocketfunction insrc/web/session.ts:Alternatives considered
No response
Impact
Additional Context
channels.telegram.proxysrc/telegram/monitor.ts(line ~120)Evidence/examples
No response
Additional information
No response