waha icon indicating copy to clipboard operation
waha copied to clipboard

[Feature Request] Validate WhatsApp number existence during message sending

Open WilliamSantos96 opened this issue 6 months ago • 13 comments

Is your feature request related to a problem? Please describe. I'm always frustrated when sending a message to an invalid or non-existent WhatsApp number returns HTTP 201 with ack: 1 (SERVER), giving a false sense of success. The message is silently never delivered, with no error or warning in the response — making it very hard to detect and handle the failure in integrated systems.

Describe the solution you'd like Add an optional checkNumberExists parameter to the send endpoints (sendText, sendImage, etc.). When set to true, WAHA internally runs the existing check-exists logic before processing the send. If the number is not registered on WhatsApp, the request should fail immediately with a clear error instead of a silent false positive:

POST /api/{session}/sendText
{
  "chatId": "[email protected]",
  "text": "Hello!",
  "checkNumberExists": true
}

Expected error response:

HTTP 422 Unprocessable Entity
{
  "error": "PHONE_NOT_ON_WHATSAPP",
  "message": "The number 55000000000000 is not registered on WhatsApp."
}

Optionally, allow this to be enabled globally at the session level so every send request is validated by default:

{
  "name": "my-session",
  "config": {
    "send": {
      "checkNumberExists": true
    }
  }
}

The default value should remain false to preserve full backward compatibility.

Describe alternatives you've considered The current workaround is to call GET /api/{session}/contacts/check-exists before every send request. This works, but it doubles the number of API calls, adds latency, increases integration complexity, and is easy to forget — especially when WAHA is consumed by third-party tools like Chatwoot or n8n that don't implement this guard themselves.

Additional context This behavior is not a WAHA bug — it is inherited from WhatsApp's own architecture. Meta's Cloud API also does not reject sends upfront for invalid numbers; the failure is only reported asynchronously via webhook (documented as error 131026 - Message Undeliverable). Because the validation cannot happen at the WhatsApp protocol level, it must be handled at the WAHA layer.

The check-exists endpoint already proves this check is technically feasible. This request simply integrates that existing mechanism into the send flow as an opt-in option.

patron:PLUS

WilliamSantos96 avatar May 19 '26 12:05 WilliamSantos96

+1

patron:PLUS

ecocentauro-git avatar May 19 '26 12:05 ecocentauro-git

+1

patron:PRO

bergpinheiro avatar May 19 '26 12:05 bergpinheiro

+1

m-thalo avatar May 19 '26 12:05 m-thalo

+1

patron:PRO

mxyzt avatar May 19 '26 12:05 mxyzt

+1

Jaya-Braga avatar May 19 '26 13:05 Jaya-Braga

+1

suporte181 avatar May 19 '26 16:05 suporte181

+1

rafaeldf avatar May 19 '26 19:05 rafaeldf

+1

+1

patron:PLUS

schadecks avatar May 20 '26 00:05 schadecks

+1

patron:PLUS

dv336699 avatar May 26 '26 07:05 dv336699

+1

patron:PRO

devlikepro avatar May 26 '26 09:05 devlikepro

+1

patron:PLUS

rafwell avatar May 26 '26 13:05 rafwell

+1

nucleotriuno avatar May 29 '26 16:05 nucleotriuno