feat: add makeWASocketAutoVersion for automatic version fetching

Adds a new async function that automatically fetches the latest
WhatsApp Web version from web.whatsapp.com before connecting.

Usage:
```typescript
// Option 1: Auto-fetch version (recommended)
const sock = await makeWASocketAutoVersion({ auth: state })

// Option 2: Manual version (existing behavior)
const sock = makeWASocket({ auth: state })
```

Benefits:
- No need to update library for version changes
- Automatic fallback to bundled version if fetch fails
- Logged warnings when using fallback
This commit is contained in:
Claude
2026-01-21 16:38:46 +00:00
parent b9a7c2cabc
commit 76e080daec
4 changed files with 55 additions and 2 deletions
+1
View File
@@ -49,6 +49,7 @@ export const PROCESSABLE_HISTORY_TYPES = [
export const DEFAULT_CONNECTION_CONFIG: SocketConfig = {
version: version as WAVersion,
fetchLatestVersion: false,
browser: Browsers.macOS('Chrome'),
waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
connectTimeoutMs: 20_000,