Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
Shortcut: /, ⌘K or Ctrl+K

Testing

Simulate WhatsApp conversations to test your integration without a real connection.

View as Markdown

A test connection is a simulated WhatsApp Connection in one of your projects. It behaves like a real linked-device Connection, so the same API methods, events, receipts and webhooks apply. It talks only to other test connections in the same project over a simulated WhatsApp network. It never reaches a real WhatsApp user or Meta.

Use test connections to develop and check an integration before you connect a real phone. To see the other side of a conversation, open a test connection in Polymorfa Inspector.

You can simulate:

  • Messages between test connections in the same project, including replies, media, groups and receipts.
  • Webhook events for inbound messages, receipts, failed sends, calls, connection changes, restrictions and template reviews.
  • The phone itself: its linked devices, a message sent from the phone, and unlinking a device.
  • Setup choices: the profile, account type, automatic echo replies, rejected sends and earlier chat history.

Use test connections for functional tests, not load tests. Each project holds a small number of them, and test events and phone actions share a limit of 30 per minute per project.

Create a test connection#

You create a test connection through a QuickLink: from the Console's Connections page, or with API Create quick link and a configuration.testing object. Opening the link and completing its simulated setup creates the account. The quickstart walks through both ways and sends a first message.

The POST /platform/connections/testing method is retired. It returns 410 resource_gone; use a QuickLink instead.

Limits #

LimitValue
Test connections per project5, or 50 when your team has the Simulation add-on
Test events and phone actions30 per minute per project, shared
Credits and billingNone: test connections use no credits and create no usage records

Removed test connections don't count toward the project limit. The limit is separate from the limit on real Connections, and test connections keep working when a project moves to production. Throughput, included data and call allowances follow the Connection tier; see Test connections.

Who can message whom #

A test connection can message only active, connected test connections in the same project. Test connections in another project of the same team, real Connections and phone numbers outside your project are not on the simulated network.

Sending a message to such a recipient returns 404 resource_not_found and creates no chat, contact or message. Group and channel activity reaches only the test connections in that group or channel.

How test connections differ from real Connections #

A test connection behaves like a linked-device Connection on every API method, with four intentional differences:

DifferenceWhat it means for your tests
No billing or usageTest connections use no credits and add nothing to Usage.
Same-project recipients onlyA phone number outside the project looks like a connection that is not on WhatsApp.
Relaxed BanSafeBanSafe doesn't score test connections or apply its daily sending allowance to them.
Simulated Meta Cloud APIOfficial API methods on a test connection are simulated and never reach Meta.

Some features are limited on test connections; see What test connections can't do.

Connection method and account type #

Every test connection uses the Linked Devices connection method. A test QuickLink doesn't offer the Meta Cloud API or Hybrid Link methods.

The accountType you choose changes how the account looks on the simulated network and in Inspector. It doesn't change the connection method:

Account typeWhat you can test
whatsapp_app, business_appThe account looks like the WhatsApp app or the WhatsApp Business app.
meta_cloudThe account looks like an Official API business. Inspector can't open it.
meta_coexistenceThe account looks like a Business app number that also uses the Official API.

A test connection with the meta_cloud or meta_coexistence account type still uses Linked Devices. Its Official API (Graph) sends travel the simulated network like any other send, and receipts come from the recipient test connection. You can't hold a message or choose why it fails. To test send errors, use the reject-send failure scenario or a message.failed test event.

Simulated setup scenarios #

Choose these values when you create the test connection's QuickLink, under configuration.testing.configuration. In the Console they appear under Configuration in the new test connection form.

FieldValuesResult
profile.name1 to 128 charactersThe account's display name.
profile.statusUp to 139 charactersThe account's profile status (about text).
accountTypewhatsapp_app, business_app, meta_cloud, meta_coexistenceThe configured account type: WhatsApp app, Business app, Official API or Business app with Official API.
primaryPlatformandroid, iosThe primary phone platform. Defaults to android; omit it for meta_cloud.
replyBehavioroff, echoWith echo, a text message from another test connection in the project is sent back to that sender.
failureScenarionone, reject-sendWith reject-send, sending a message, button message or list message from this test connection fails. Use it to test your send error handling.
historyFixtureIdA fixture IDLoads earlier chat history from an uploaded fixture.

configuration.testing.country sets the country of the generated phone number, as an ISO 3166-1 alpha-2 code. List up to three fields in configuration.testing.editable to let the person who opens the link change them before setup starts. An empty list keeps every value fixed.

JSON
{
  "projectId": "00000000-0000-4000-8000-000000000001",
  "configuration": {
    "testing": {
      "country": "BR",
      "configuration": {
        "profile": { "name": "Demo support" },
        "accountType": "business_app",
        "replyBehavior": "echo",
        "failureScenario": "none"
      },
      "editable": ["profile.name", "replyBehavior"]
    }
  }
}

A test QuickLink can't prefill a phone number, offer Meta Cloud API setup or turn on observation.

Test events #

A test event delivers a signed webhook event for a test connection without any WhatsApp activity. Each fixture name is the event type it produces.

FixtureSimulates
message.receivedAn inbound text or media message
message.ackA delivery, read or played receipt, or a receipt error
message.failedAn outbound send that failed
call.received, call.missed, call.endedAn incoming, unanswered or finished call
connection.statusA connection status change
connection.restriction_updatedA WhatsApp restriction starting or ending
template.statusA template approval or rejection

Trigger one with API Trigger test event, where connection is the test connection. List the fixtures with API List test event fixtures. Both work with the project's Test key. Test events reach your webhooks and event history only; they don't change the test connection. See Trigger test events for overrides and defaults.

Start testing#

See also#