testMode: true). A request for any
other number returns 400 Bad Request and sends nothing.
Before you start
- Your team has Test numbers access. See What is Sandbox?.
- The project has a Test number. Use its session name in each request.
- You have a project key, or a team key, with the
sandbox:writescope. Listing fixtures needssandbox:read. Client tokens can’t trigger test events.
Trigger an event
Send the fixture name asevent and the Test number as session:
202 Accepted:
message.received receive the event with the same
envelope and signature headers as any other event. Look it up by eventId with
GET /platform/projects/{projectId}/events/{eventId}; see Event history. Test events carry
source: "test" and environment: "development", so you can tell them apart
from events produced by WhatsApp activity.
With the TypeScript SDK:
Fixtures
Each fixture name is the event type it produces.
List the fixtures and their overrides with
GET /messaging/testing/{projectId}/events/fixtures.
A fixture rejects an override it doesn’t list with 400 Bad Request.
Without overrides, each fixture uses these values:
message.received: a text message from+15550100001. SetmediaTypetoimage,video,audio,document, orstickerto send media metadata instead, with an optionalcaptionfor images, videos, and documents. Generated media events contain no downloadable file.message.ack:ackStatusisdelivered. Alsoread,played, orerror.message.failed:failureReasonissend_failed.session.status:DISCONNECTEDwithSTREAM_ERROR.template.status:APPROVED. SettemplateStatustoREJECTEDand an optionalreasonto test a rejection.bansafe.enforcement:enforcementKindiscap_warning. Alsocap_reached,timelock, ortemporary_ban.bansafe.risk_changed:riskLevelishigh.
What test events don’t change
A test event reaches your webhooks and the events API only. It doesn’t change the Test number: asession.status event doesn’t disconnect it, a
bansafe.enforcement event doesn’t restrict it, and call events don’t ring
Calls clients. Test events don’t count toward campaign reply metrics.
Contact and message IDs in generated events are random. They don’t refer to a
conversation, so you can’t reply to them.
Send a simulated message between Test numbers
To test a full round trip, including replies, send a real simulated message from another connected Test number in the same project. SetfromSession on a
message.received request:
"delivery": "simulated" and "eventId": null. The
message.received event arrives shortly after as ordinary Test number
activity, with source: "runtime", and you can reply to it. Both Test numbers
must be connected. fromSession accepts only the text override.
Limits
Each project can trigger 30 test events per minute. Further requests return429 Too Many Requests with a Retry-After header that gives the seconds to
wait. Every trigger is recorded in your team’s audit log
as testing.event.trigger.
Retry safely
Send anIdempotency-Key header, up to 255 printable ASCII characters, to make
a trigger safe to retry. A repeated request with the same key and body gets the
same eventId, so your event history and webhooks receive the event once. A
different body with the same key creates a separate event.