Guides
Getting started

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:

  1. Platform rules, in any mode: a number without WhatsApp fails with 131026; a free-form message outside the 24-hour window fails with 131047; marketing to someone who stopped promotions fails with 131050.
  2. The sent status, 0.25 to 0.7 seconds later.
  3. In manual mode (or with the manual persona), nothing else: you drive the rest.
  4. Persona failures (e.g. 131049 for marketing to the saturated persona).
  5. Delivery, read and, in auto mode, the persona's reply.

Numbers that are not test numbers join the simulated audience and follow the audience rules.

Modes

ModeDelivery and readCustomer replies
manualOnly through the control APIOnly through the control API
mixed (default)Automatic, from the personaOnly through the control API
autoAutomaticAutomatic (quick reply, text, opt-out)
bash
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

PersonaDeliveryReadReply (auto mode)Failure
manualNeverNeverOnly through the control API—
fast_responder1 to 3 s5 to 20 s later1st quick reply on 30% of marketing messages—
otp_receiver1 to 2 s10 s laterNone—
support1 sUp to 0.5 s laterNone—
marketing_saturated2 s30 s laterNoneMarketing: 131049
opt_out1 s15 s laterTaps "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}:

bash
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):

ScenarioEffect
happy (default)Follows the persona
delayeddelivered at 45 s and read at 55 s
no_whatsappfailed with 131026
missing_templateThe send answers 132001 right away
burstThe send answers 131056 right away

Read the last code a number received, as the phone would:

bash
curl --url https://api.mimicr.dev/v1/whatsapp/docs/contacts/5521998761234/otp/latest \
  --header 'Authorization: Bearer mk_...'
json
{ "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:

bash
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 testDo
A specific statusPOST /v1/whatsapp/{slug}/messages/{wamid}/status with {"status": "failed", "error_code": 131026} (sent, delivered, read, played, failed)
Closed 24-hour windowPOST /v1/whatsapp/{slug}/clock/advance with {"hours": 25}
Deregistered number (133010)PUT /v1/whatsapp/{slug}/phone-numbers/{id} with {"registered": false}
Paused or disabled templatePOST /v1/whatsapp/{slug}/templates/{id}/review with {"action": "pause"} or disable
Marketing opt-outPOST /v1/whatsapp/{slug}/contacts/{wa_id}/preferences with {"value": "stop"}
Disabled accountPOST /v1/whatsapp/{slug}/webhooks/emit with {"field": "account_update", "event": "DISABLED_UPDATE"}

Chaos

bash
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 }'
KeyDefaultEffect
duplicate_webhooksfalse1% of webhooks arrive twice
out_of_order_statusesfalse10% of messages get read before delivered
webhook_latencyfalseUp to 30 s of delay on each webhook
retry_with_backofftrueFailed deliveries are retried (see Delivery statuses)
throughput_limittrueAbove 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.