For the complete documentation index, see llms.txt. This page is also available as Markdown.

Sandbox

Learn how to get started with 360Dialog Sandbox API

We provide a developer-friendly test environment for anyone who wants to explore the usage of our WhatsApp API. You can test sending messages and templates in the test environment.

Sandbox Base Path: https://waba-sandbox.360dialog.io/

Each test account has its own API key and one fixed recipient, either your phone number or your business-scoped user ID. You can only send test messages to that recipient. If you want to message more than one number, set up a WhatsApp Business Account instead of using the sandbox.

Limitations

What you can do with the sandbox

  • You can use the sandbox API key to send freeform messages and templates to your own phone number (or your own business-scoped user ID if your phone number was not shared).

  • A maximum of 25 messages can be sent with the sandbox. Every request that reaches the messaging API counts towards this limit, even if the message itself is rejected. Once the limit is reached, requests fail with HTTP 429.

  • Your phone number acts like a user and can send and receive messages.

  • The number can be a landline number, as long it is able to use WhatsApp.

  • You can change your webhook URL at any time.

  • Each Sandbox API key is linked to one fixed recipient (either your phone number or your business-scoped user ID) and you can only send test messages to that recipient. If you wish to send messages to more than just your recipient, then we recommend setting up a WhatsApp Business Account to use instead of the sandbox.

What you can't do with the sandbox

  • The Sandbox is a test environment only. Messages and templates can be sent only to your own phone number, or to your own business-scoped user ID if your phone number was not shared.

  • You can send only predefined templates available in the sandbox: disclaimer, first_welcome_messsage, and interactive_template_sandbox. (Note: Template inventory requires confirmation with the Partner APIs team).

  • Uploading and retrieving media files using the media ID.

How to get started with sandbox

1

Get an API Key

You can get an API key by sending a message on WhatsApp to phone number +551146733492 with the content START (START must be in all UPPERCASE). You can quickly send the message by:

You will later receive a response containing your API key. This API key needs to be used when making API requests.

If your phone number is not shared

If your phone number is not shared when sending the START message, WhatsApp will trigger a contact-request message template (request_contact_info_en) on your device prompting you to share your contact info.

If your phone number is not shared or is delayed, you will receive an API key after a timeout (within 5 minutes). The exact message you receive will be:

Your new api-key is: "<API_KEY>". Your business-scoped user id is: "<BSUID>". Because your phone number was not shared, send messages using the "recipient" field set to your business-scoped user id instead of "to".

Business-scoped user ID (BSUID): an identifier WhatsApp assigns to a user for one specific business. WhatsApp sends it instead of the phone number when the user's number is not shared with the business.

Accounts created in this manner are identified by BSUID only, do not have a registered phone number associated, and must use the recipient field instead of to when sending API requests.

2

Set the Sandbox Webhook URL

POST https://waba-sandbox.360dialog.io/v1/configs/webhook

Setting a webhook URL is necessary for receiving messages (and message status updates). Any message you send to +551146733492 will be forwarded to the webhook URL you set.

You can use an external service (such as requestbin.com or webhook.site) to create a temporary webhook URL. You can also use an external service such as ngrok to tunnel a port from localhost to a temporary public URL.

The API key you received in the previous step needs to be passed in the D360-API-KEY header.

Request Example

Headers

Name
Value

Content-Type

application/json

D360-API-KEY

Your API key

Request Body

Name
Type
Value

url

string

Your webhook URL

3

Send a Message to the Sandbox

Send a message to the number +551146733492 again. You will receive an Inbound Message event on your webhook. This webhook event contains the phone number that sent the message, along with the message's contents. An example of it can be seen below.

The webhook is not just used for receiving messages; it is also used for receiving status updates on your outbound messages. After you send a message via the API, you will receive a webhook event when the message is sent/delivered to your recipient, and when your recipient has read the message.

4

Inbound Message Event

Message Status Event

If your phone number is not shared, webhook events identify you by your business-scoped user ID instead of your phone number:

  • Inbound messages carry from_user_id (and contacts[].user_id) instead of from / wa_id.

  • Status events carry recipient_user_id instead of recipient_id.

5

Respond using the Sandbox API

Send response message

POST https://waba-sandbox.360dialog.io/v1/messages

You can send a response message (or a message template) to the phone WhatsApp number with the above request URL and the body parameters as described below.

Request Example

Headers

Name
Value

Content-Type

application/json

D360-API-KEY

Your API key

Request Body

Name
Description
Key

recipient_type

string

Set to individual

to

number

Set to your phone number

type

string

Set to text

text

object

Contains a body string field, which is where your message should go (e.g. "body": "Hello world")

messaging_product

string

Mandatory payload that should be set to whatsapp

Example Request Payload

Response (201 Created)

Error Reference

Status

Meaning

401

Missing or invalid D360-API-KEY header.

403

The to or recipient value does not match the recipient your API key is tied to, or the request contains neither field.

429

You've reached the sandbox's 25-message limit.

502

The message could not be delivered to the messaging API. Try again later.

504

Timeout while delivering the message. Try again later.

6

Send a Template Message (optional)

POST https://waba-sandbox.360dialog.io/v1/messages

There are 3 templates available to test in the sandbox. There is no possibility to add or edit templates; you must use one of the predefined templates listed below. Available templates are:

  • disclaimer Using this template will just send a regular text message, which can’t be edited.

  • first_welcome_messsage This is an example of a template with a personalization possibility (you can personalize the receiver's name).

  • interactive_template_sandbox This template contains 2 buttons for which you can pass customer URLs.

Request Example

Headers

Name
Value

Content-Type

application/json

D360-API-KEY

Your API key

Request Body

If the request is valid, you will receive an HTTP 201 success response.

Example Request Payload

first_welcome_messsage

Note that this example covers first_welcome_messsage with personalization. In the case of the disclaimer template, the payload is similar but with an empty components array (it holds personalization parameters which are not used in disclaimer).

If you would like to quickly give the other two templates a try, you can use the JSON body snippets below:

Note for Business-Scoped User ID (BSUID) Accounts:

If your test account is identified by a business-scoped user ID, replace "to": "<YOUR_PHONE_NUMBER>" with "recipient": "<YOUR_BUSINESS_SCOPED_USER_ID>" in every template payload and API example shown on this page.

Last updated

Was this helpful?