Skip to content

[core] Add Argentine Phone Numbers app for outbound resolution - #2260

Draft
ropu wants to merge 4 commits into
devlikeapro:devfrom
ropu:codex-ropu/argentine-phone-numbers
Draft

[core] Add Argentine Phone Numbers app for outbound resolution#2260
ropu wants to merge 4 commits into
devlikeapro:devfrom
ropu:codex-ropu/argentine-phone-numbers

Conversation

@ropu

@ropu ropu commented Sep 7, 2026

Copy link
Copy Markdown

Problem and behavior

Integrations may supply Argentine destinations as 54 + national number or 549 + national number. This adds an opt-in argentine-phone-numbers app that resolves the supplied phone through checkNumberStatus before sending. It tries the other form only after WhatsApp explicitly reports that the original does not exist, then sends once to the returned PN/JID or LID.

For example, if 5411XXXXXXXX is absent and 54911XXXXXXXX resolves, the send uses the returned identifier. If the original exists, it wins. Both forms may resolve independently: cache entries and concurrent lookups are keyed by the original input, not the candidate pair.

This follows the apps/session-plugin direction described in #2180. It uses existing hooks and engine interfaces; there are no engine changes or new HTTP endpoints.

Scope

  • International geographic Argentine numbers, including area codes beyond Buenos Aires; optional +, @c.us and @s.whatsapp.net.
  • Per-session app, disabled unless installed/enabled, with lookup, strict and memoryTtl configuration.
  • Successful in-memory cache (24h default), brief confirmed-negative cache, and deduplicated lookups per input. No database migration or persistent cache in this first version.
  • Timeouts and incomplete lookup answers preserve the original destination and are not cached. Strict mode returns 422 only after both candidates explicitly report absence.
  • Message-send chat targets only. No changes to mentions, incoming identifiers, call rejection, deletion, read/presence or group administration. The allowlist also prevents recursive WPP lookups.
  • No inference from local 011/15 forms or missing country codes, and no alternate-contact shortcut that would bypass checking the original.

Configuration and a reproducible live validation procedure are in src/apps/argentine-phone-numbers/README.md.

Validation

  • yarn test:unit --runInBand argentine-phone-numbers: 47 passed. Includes real hook registration, native JID conversion, recursive lookup prevention, separate accounts/caches, concurrent queries, LIDs, expiry without background timers, negative results and transient failures.
  • yarn tsc --noEmit: passed.
  • Scoped yarn oxlint --deny-warnings: passed.
  • yarn build: passed.
  • Brazilian regression suites: 26 failed / 19 passed. Reproduced the same 26 failures in a clean worktree at upstream 92c7923c35cbb8e5975f30fec66440b571c2c12f: test sessions omit media.events, and two repository date tests fail. These files are unchanged.
  • Docker (Linux ARM64 / Node 24): docker buildx build --target build --output type=cacheonly . passed on the final code. The complete build stage was rebuilt; no runtime image was exported or deployed. An earlier image-export attempt was canceled after compilation while exporting layers.

Draft / live validation still needed

No real WhatsApp messages were sent and no paired session was used. Engine delivery coverage (GOWS/NOWEB/WEBJS/WPP) is not claimed. This is a proposed opt-in compatibility feature, not a claim that all engines currently fail on Argentine numbers. Before marking ready, capture redacted lookup results for both forms of an authorized Argentine test number and verify controlled delivery with the app disabled/enabled.

patron:PLUS

ropu and others added 3 commits September 7, 2026 17:44
Co-Authored-By: GPT-6 <noreply@example.com>
Resolve the original phone first and try its mobile-prefix variant only after confirmed absence. Keep caches and concurrent lookups isolated by input phone.

Co-Authored-By: GPT-6 <noreply@example.com>
Co-Authored-By: GPT-6 <noreply@example.com>
Avoid retaining unused expired destinations without creating background timers tied to discarded plugins.

Co-Authored-By: GPT-6 <noreply@example.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant