Commit Graph

2 Commits

Author SHA1 Message Date
Bob (AI Agent)
c4183e2ce6 fix: TypeScript type for onWhatsApp (allow undefined return) 2026-01-29 20:41:22 +00:00
Bob (AI Agent)
5fc974ef20 fix(whatsapp): resolve Brazilian mobile JID variants (8/9 digit)
Brazilian mobile numbers transitioned from 8 to 9 digits around 2012-2016.
WhatsApp accounts created before the migration may still be registered
with the old 8-digit format internally, causing silent message delivery
failures.

This fix:
- Adds brazil-jid.ts resolver that detects BR mobile numbers
- Uses sock.onWhatsApp() to query which format is actually registered
- Caches results for 7 days to avoid repeated lookups
- Modifies monitor.ts to pass onWhatsApp to createWebSendApi
- Falls back gracefully if onWhatsApp is not available

Tested: Successfully resolved +5511999998888 → 551199998888@s.whatsapp.net

Fixes #4168
2026-01-29 20:35:11 +00:00