WhatsApp numbers
Sender validation
Learn how Yanola checks that a from number is connected, enabled, and accessible to the calling Agent Project.
What this guide covers
- Use a Sender connected to the same Agent Project as the API key.
- Expect requests with unknown, disconnected, or cross-project numbers to fail.
- List Senders before sending when your application supports multiple numbers.
The from field identifies a Sender
Every send request requires from. Use the connected WhatsApp number in E.164 format, including the leading plus sign and country code. Yanola does not support from: "default" and does not require a provider phone-number ID.
The API key supplies the Agent Project boundary, so the same phone number cannot be borrowed from another project or account.
| Value | Result | Reason |
|---|---|---|
+15557654321 | Valid format | E.164 number with country code. |
15557654321 | Rejected | The leading plus sign is required. |
default | Rejected | V1 has no default-Sender behavior. |
provider-number-id | Rejected | Use the WhatsApp phone number, not a provider identifier. |
Select an API-eligible Sender
List Senders using the same API key that will perform the send. The response reflects the key environment, Agent Project, key restrictions, and effective platform controls.
import { WhatsAppClient } from "@yanola/whatsapp"
const apiKey = process.env.YANOLA_API_KEY
if (!apiKey) {
throw new Error("Missing YANOLA_API_KEY")
}
const yanola = new WhatsAppClient({ apiKey })
const { data: senders } = await yanola.senders.list()
const sender = senders.find((item) => item.apiEligible)
if (!sender) {
throw new Error("No API-eligible Sender is available")
}
console.log(sender.phoneNumber)A connected number can become inactive, require reconnection, or be disabled by an operational control. Do not assume an old list response remains valid indefinitely.
Validation performed before a send
- The key must have messages:write and an active Developer Platform entitlement.
- from and to must be valid E.164 phone numbers.
- The Sender must belong to the key's Yanola Account and Agent Project.
- If the key is restricted to selected Senders, the Sender must be in that set.
- The Sender must be active and the public API operation must not be disabled.
- Live Mode also requires usable stored provider credentials; Test Mode does not access provider credentials.
- Non-template Live Mode sends must pass the Customer Service Window check.
Sender errors
| Status and code | Meaning | Action |
|---|---|---|
400 invalid_message_request | from is missing or not valid E.164. | Correct the request before retrying. |
403 sender_access_denied | The Sender is unknown to the project, restricted from the key, pending, suspended, or otherwise unavailable. | Use an allowed active Sender or update key access in the dashboard. |
422 sender_reconnect_required | The connection is inactive, needs reconnection, or lacks usable Live Mode provider credentials. | Reconnect the number from the WhatsApp Numbers page. |
403 or 503 control error | An account, project, key, Sender, environment, or global control blocks public API use. | Inspect the error action and dashboard status before retrying. |
A missing number and a number owned by another Agent Project both return sender_access_denied. This prevents public API keys from probing whether another project has connected a number.
Customer Service Window
In Live Mode, a text, media, location, or contact-card send is allowed only when Yanola has evidence that the recipient sent an inbound message to the same Sender during the previous 24 hours. Activity with another Sender does not open this window.
When no active window is known, Yanola returns 422 service_window_required before queueing the message or making a provider call. The error is not retryable: repeating the same non-template request cannot create a window.
- Send an approved template that is appropriate for the business intent.
- After the customer replies, use non-template messages during the new 24-hour window.
- Do not catch the error and silently substitute unrelated template content.
{
"error": {
"type": "business_state_error",
"code": "service_window_required",
"message": "A text, media, location, or contact-card message requires an active Customer Service Window. Send an approved template instead.",
"requestId": "req_...",
"retryable": false,
"details": {
"from": "+15557654321",
"to": "+15551234567"
}
}
}Test Mode still validates the recipient and connected Sender but does not require stored inbound-window evidence. Template sends are also exempt because an approved template is the compliant way to start a conversation.