Test mode
A test key (sk_test_…) gives you the whole API with WhatsApp replaced by a simulator. Requests are validated exactly as in live mode, so what passes here passes there, but nothing is sent, nothing lands in your inbox and nothing is billed.
What is simulated#
- Sending.
POST /messagesreturnsaccepted, then the message moves tosent(~1s),delivered(~3s) andread(~8s), firing the samemessage.*events a live message would. - Webhooks. Test-mode endpoints receive test events only; live endpoints never see them. Every event carries
"livemode": false. - Inbound messages.
POST /test/inbound_messagesplays a customer writing to you: it firesmessage.receivedand opens the simulated 24-hour window for that number.
Templates, numbers and other configuration are read from your real workspace (read-only), so the template you test with is the one you will send.
Magic numbers#
The recipient decides what happens:
| Send to | Outcome |
|---|---|
+966500000001 | Sent → delivered → read |
+966500000002 | Sent → delivered (never read) |
+966500000003 | Fails with 131026 (undeliverable) |
+966500000004 | Free-form messages are refused with window_closed, until you simulate an inbound message from it |
+966500000005 | Stays at sent |
| any other valid number | Sent → delivered → read |
Driving the simulator#
Force a status right now (for example, to test your failure handling):
curl -X POST https://api.saei.automize.sa/v1/test/messages/msg_test_01j9.../status \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "failed", "error_code": "131026" }'Simulate a customer replying, then answer inside the window:
curl -X POST https://api.saei.automize.sa/v1/test/inbound_messages \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "from": "+966500000004", "text": { "body": "Where is my order?" } }'What test mode does not cover#
Each reference page says how its endpoint behaves in test mode. In short:
| With a test key | Endpoints |
|---|---|
| Simulated | Sending WhatsApp messages of every type, read receipts, the simulator helpers |
| Your real configuration, read-only | Numbers, templates, tags, custom fields, flows, members, usage |
| Shared with live keys | The media library (an upload is a file, not a send) and your test webhook endpoints |
test_mode_unsupported | Anything on real customers or that sends for real: contacts, conversations, campaigns, template and tag changes, starting flows, Instagram and Messenger |
For end-to-end staging of the last row, use a separate workspace with its own live key.