Guides
Sandbox testing
Personas, modes, OTP scenarios, audience rules, forced failures and chaos to test every path of your integration.
With Meta, what happens after POST /messages depends on a phone you don't control. In Mimicr, it depends on the sandbox rules. All of them are Mimicr's own decisions, not behaviour documented by Meta.
What decides a message's fate
For every accepted message, Mimicr applies, in this order:
- Platform rules, in any mode: a number without WhatsApp fails with
131026; a free-form message outside the 24-hour window fails with131047; marketing to someone who stopped promotions fails with131050. - The
sentstatus, 0.25 to 0.7 seconds later. - In
manualmode (or with themanualpersona), nothing else: you drive the rest. - Persona failures (e.g.
131049for marketing to the saturated persona). - Delivery, read and, in
automode, the persona's reply.
Numbers that are not test numbers join the simulated audience and follow the audience rules.
Modes
| Mode | Delivery and read | Customer replies |
|---|---|---|
manual | Only through the control API | Only through the control API |
mixed (default) | Automatic, from the persona | Only through the control API |
auto | Automatic | Automatic (quick reply, text, opt-out) |
curl --request PUT \
--url https://api.mimicr.dev/v1/whatsapp/docs/settings \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "mode": "auto" }'Personas
| Persona | Delivery | Read | Reply (auto mode) | Failure |
|---|---|---|---|---|
manual | Never | Never | Only through the control API | — |
fast_responder | 1 to 3 s | 5 to 20 s later | 1st quick reply on 30% of marketing messages | — |
otp_receiver | 1 to 2 s | 10 s later | None | — |
support | 1 s | Up to 0.5 s later | None | — |
marketing_saturated | 2 s | 30 s later | None | Marketing: 131049 |
opt_out | 1 s | 15 s later | Taps "Stop promotions" on the 1st offer (user_preferences) | Marketing after that: 131050 |
no_whatsapp | — | — | — | Everything: 131026 |
Create or update a number with POST /v1/whatsapp/{slug}/contacts and tune any rule with PUT /v1/whatsapp/{slug}/contacts/{wa_id}:
curl --request PUT \
--url https://api.mimicr.dev/v1/whatsapp/docs/contacts/5511987654321 \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "rules": { "delivery_ms": [200, 800], "read_ms": null, "reply": { "kind": "text", "probability": 1, "categories": [], "text": "Quero comprar" } } }'rules.reply.kind is none, first_quick_reply, stop_promotions or text; failures is a list of { "categories": ["marketing"], "code": 131049 }. Brazilian numbers with and without the ninth digit are the same contact.
OTP scenarios
They apply to AUTHENTICATION templates (otp_scenario in /settings):
| Scenario | Effect |
|---|---|
happy (default) | Follows the persona |
delayed | delivered at 45 s and read at 55 s |
no_whatsapp | failed with 131026 |
missing_template | The send answers 132001 right away |
burst | The send answers 131056 right away |
Read the last code a number received, as the phone would:
curl --url https://api.mimicr.dev/v1/whatsapp/docs/contacts/5521998761234/otp/latest \ --header 'Authorization: Bearer mk_...'
{ "wa_id": "5521998761234", "template": "codigo_acesso", "code": "482913", "status": "accepted", "sent_at": 1793914192, "expires_at": 1793914792 }Simulated audience (campaigns)
Messages to numbers that are not test numbers create audience contacts. Without a rule, they stay at sent. A rule sets the delivery, read, reply (1st quick reply) and opt-out percentages, per template or for any message:
curl --request POST \
--url https://api.mimicr.dev/v1/whatsapp/docs/audience-rules \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "name": "Campanha 01", "templates": ["promo_outubro"], "delivered_pct": 95, "read_pct": 70, "reply_pct": 15, "opt_out_pct": 1, "seed": "ci-01" }'With seed, the draw is deterministic per number. Undelivered messages fail with 131026, 131049 or 131056. Replies and opt-outs only happen in auto mode and on marketing templates. A template can only be in one rule (409).
Forcing outcomes
| To test | Do |
|---|---|
| A specific status | POST /v1/whatsapp/{slug}/messages/{wamid}/status with {"status": "failed", "error_code": 131026} (sent, delivered, read, played, failed) |
| Closed 24-hour window | POST /v1/whatsapp/{slug}/clock/advance with {"hours": 25} |
Deregistered number (133010) | PUT /v1/whatsapp/{slug}/phone-numbers/{id} with {"registered": false} |
| Paused or disabled template | POST /v1/whatsapp/{slug}/templates/{id}/review with {"action": "pause"} or disable |
| Marketing opt-out | POST /v1/whatsapp/{slug}/contacts/{wa_id}/preferences with {"value": "stop"} |
| Disabled account | POST /v1/whatsapp/{slug}/webhooks/emit with {"field": "account_update", "event": "DISABLED_UPDATE"} |
Chaos
curl --request PUT \
--url https://api.mimicr.dev/v1/whatsapp/docs/settings \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "chaos": { "duplicate_webhooks": true, "out_of_order_statuses": true }, "throughput_mps": 5 }'| Key | Default | Effect |
|---|---|---|
duplicate_webhooks | false | 1% of webhooks arrive twice |
out_of_order_statuses | false | 10% of messages get read before delivered |
webhook_latency | false | Up to 30 s of delay on each webhook |
retry_with_backoff | true | Failed deliveries are retried (see Delivery statuses) |
throughput_limit | true | Above throughput_mps messages per second, 130429 |
messaging_limit (TIER_250 to TIER_UNLIMITED) changes the tier the number reports and clock_speed speeds up retries.