Guides
Quickstart
Create a sandbox, receive a message from a test customer, reply through the Graph API and watch the status webhook arrive.
In a few minutes you create a sandbox, set up the callback, make a test customer write, reply through the Graph API and follow the webhooks.
Prerequisites
- A Mimicr organization and a write API key (
mk_…), created in the organization settings, "API keys" tab. - A public HTTPS URL that receives webhooks and answers the
hub.challengehandshake (see Webhooks). - curl, or Node 18+ for the CLI.
1. Create a sandbox
An organization can have several WhatsApp sandboxes; each one is a Meta app with its WABA, number, tokens and app secret. Create it in the console (https://app.mimicr.dev) or with the control API:
curl --request POST \
--url https://api.mimicr.dev/v1/whatsapp \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "name": "Docs", "business_name": "Loja Aurora" }'{
"slug": "docs",
"business_name": "Loja Aurora",
"graph_base": "https://whatsapp.mimicr.dev",
"app_id": "109310356550101",
"app_secret": "<app_secret>",
"verify_token": "meu-token-de-verificacao",
"callback_url": null,
"access_tokens": [{ "token": "EAAsim…", "label": "Token do sistema", "waba_id": "313255174969123" }],
"wabas": [{ "id": "313255174969123", "name": "Loja Aurora", "default": true }],
"phone_numbers": [{ "id": "424361664134261", "display_phone_number": "+55 55 3270-4202", "verified_name": "Loja Aurora", "waba_id": "313255174969123" }],
"clock": { "now": 1793914015, "offset_seconds": 0 }
}Keep the slug, the token, phone_numbers[0].id (your phone-number-id) and the app secret. Later, GET /v1/whatsapp/{slug} returns the same object. With the CLI: npx mimicr sandbox create Docs and npx mimicr status whatsapp.
With "examples": true the sandbox comes with six test customers and approved sample templates. Without it, only the hello_world template exists.
2. Set up the callback
Mimicr runs Meta's handshake: a GET with hub.mode=subscribe, hub.verify_token and hub.challenge. The callback is only saved if your app echoes the hub.challenge with status 200.
curl --request PUT \
--url https://api.mimicr.dev/v1/whatsapp/docs/webhooks/callback \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "url": "https://seu-servidor.example.com/webhooks/whatsapp", "verify_token": "meu-token-de-verificacao" }'{ "success": true, "status": 200, "challenge": "1389737617", "body": "1389737617", "duration_ms": 6 }3. Create a test customer and make them write
curl --request POST \
--url https://api.mimicr.dev/v1/whatsapp/docs/contacts \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "wa_id": "5511987654321", "profile_name": "Ana Ribeiro", "persona": "fast_responder" }'
curl --request POST \
--url https://api.mimicr.dev/v1/whatsapp/docs/contacts/5511987654321/reply \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "type": "text", "text": "Oi, quero saber do meu pedido" }'Your callback receives the signed messages webhook, with the message wamid in messages[0].id (see Incoming messages). The 24-hour customer service window is open.
4. Reply through the Graph API
curl --request POST \
--url https://whatsapp.mimicr.dev/v24.0/424361664134261/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "5511987654321",
"type": "text",
"text": { "preview_url": false, "body": "Seu pedido #1042 saiu para entrega." }
}'{
"messaging_product": "whatsapp",
"contacts": [{ "input": "5511987654321", "wa_id": "5511987654321" }],
"messages": [{ "id": "wamid.HBgNNTUxMTk4NzY1NDMyMRUCABEYEkEzRERCRDI2Q0RBNTA0NUZGRgA=" }]
}5. Wait for the status webhook
The fast_responder persona delivers in 1 to 3 seconds and reads 5 to 20 seconds later. Wait for the delivered webhook with the control API:
npx mimicr wait whatsapp:docs webhook field=messages wamid=<wamid>
{
"matched": "webhook",
"webhook": {
"field": "messages",
"label": "status delivered · Ana Ribeiro",
"status": "success",
"attempts": 1,
"last_status_code": 200,
"body": { "object": "whatsapp_business_account", "entry": [{ "id": "313255174969123", "changes": [{ "field": "messages", "value": { "statuses": [{ "status": "delivered", "recipient_id": "5511987654321" }] } }] }] }
}
}wait also waits for what your app sent: npx mimicr wait whatsapp:docs message wa_id=5511987654321 direction=outbound.
Next steps
- Sandbox testing: personas, modes, OTP and failures.
- Templates: create, approve and send outside the 24-hour window.
- Verify the signature before processing webhooks.