Skip to content
View as Markdown

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 /messages returns accepted, then the message moves to sent (~1s), delivered (~3s) and read (~8s), firing the same message.* 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_messages plays a customer writing to you: it fires message.received and 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 toOutcome
+966500000001Sent → delivered → read
+966500000002Sent → delivered (never read)
+966500000003Fails with 131026 (undeliverable)
+966500000004Free-form messages are refused with window_closed, until you simulate an inbound message from it
+966500000005Stays at sent
any other valid numberSent → delivered → read

Driving the simulator#

Force a status right now (for example, to test your failure handling):

Shell
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:

Shell
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 keyEndpoints
SimulatedSending WhatsApp messages of every type, read receipts, the simulator helpers
Your real configuration, read-onlyNumbers, templates, tags, custom fields, flows, members, usage
Shared with live keysThe media library (an upload is a file, not a send) and your test webhook endpoints
test_mode_unsupportedAnything 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.