Client Documentation
Get StartedStatus Page
  • 360Dialog
    • Why you should use 360dialog as Business Solution Provider (BSP)
    • Prices, plans and payment options
  • client hub
    • 360Dialog Client Hub
    • Numbers
      • Manage your WABA
        • Account Statuses
    • Activity
    • Funds
      • Month Closing Invoice (MCI)
    • Payment Management
    • API Keys
    • Template Message Management
    • Partner Change
    • Cancellation
    • Downgrade
  • WhatsApp Marketing
    • Best practices to maintain Account Health and prevent being blocked
    • Driving users to your WhatsApp account
      • WhatsApp Channels
    • Business Search
    • Linking a WABA to a Facebook Page /EN
      • Vinculando uma conta WABA à uma página do Facebook /PT
      • Cómo vincular un WABA a una página de Facebook /ES
    • Linking a WABA to Google Message Ads
    • Ads that Click to WhatsApp (CTWA) /EN
      • Anúncios de Clique para o WhatsApp (CTWA) /PT
        • Como usar o WhatsApp para marketing e vendas? /PT
      • Anuncios que Click to WhatsApp (CTWA) /ES
        • ¿Cómo usar WhatsApp para marketing y ventas? /ES
    • Conversions API (CAPI)
    • Create Ads lookalike audience based on WhatsApp events
    • MM Lite API Beta
      • Onboarding
      • Sending Messages
  • waba basics
    • WhatsApp Business Platform
    • WhatsApp Accounts structure
    • WABA for Government Agencies
    • WABA Policy Enforcement
    • Architecture and Security
    • The Basics (Overview)
    • Webhook Events and Notifications
    • Messaging API
      • Messaging Health Status
      • Step to Step to move to Cloud API
        • [will be deprecated] WABA Integration (On-Premise)
    • Migrating Phone Numbers
      • Migrate number from Meta or alternate BSP to 360dialog Cloud API
      • Migrate a phone number to a new WABA
      • Migrate to alternate BSP
  • waba management
    • Creating new WABA
      • Using a new phone number
      • WhatsApp Coexistence
        • Coexistence Onboarding
        • Coexistence Webhooks
    • Display Name Guidelines
    • Meta Business Verification
    • Official Business Account (OBA) or blue badge
    • WABA Profile Info
    • Capacity, Quality Rating, and Messaging Limits
      • Accelerated Onboarding
    • Hosting type Change
  • waba Messaging
    • Sandbox (Test API Key)
    • Receiving messages
    • Before sending a message
      • Checklist for Message Broadcasts and Campaigns
    • Conversations
    • Messaging
    • Conversational Components
    • Media Messages
      • Upload, retrieve or delete media
    • Template Messages
      • Template Elements
      • Sending Template Messages
      • Authentication Templates
        • Zero-Tap Authentication Templates
        • One-Tap Autofill Authentication Templates
        • Copy Code Authentication Templates
      • Catalog Templates
      • Product Card Carousel Templates
      • Single-Product Message Templates
      • Coupon Code Templates
      • Limited-Time Offer Templates
      • Multi-Product Templates
    • Interactive Messages
      • Single and Multi Product Messages
      • Location Request Message
    • Flows
    • Products & Catalogs
    • Contacts and Location Messages
    • Payments (India Only)
      • Receive WhatsApp Payments via Payments Gateway
      • Receive WhatsApp Payments via Payment Links
      • Order Details Template Message
    • Payments (Singapore only)
      • Receive WhatsApp Payments via Stripe
  • Partners
    • Partner Documentation
  • Support
    • Help and Support
      • Opening Hours & Response Time
      • Status Pages
      • Meta Support
      • Common Issues
    • Error Messages
    • Imprint & Data Privacy
    • FAQ
Powered by GitBook
On this page
  • Introduction
  • Limitations
  • 1. Get a Test API Key
  • 2. Set your Sandbox Webhook URL
  • Set Webhook URL
  • 3. Send a Message to the Sandbox
  • 4. Respond using the Sandbox API
  • Send response message
  • 5. Send a Template Message (optional)
  • Send Template Message
  • Get new Sandbox API Key
  • Code Examples For Developers
  • Python
  • PHP
  • CURL

Was this helpful?

  1. waba Messaging

Sandbox (Test API Key)

The document explains how to use our WhatsApp Sandbox Environment.

PreviousHosting type ChangeNextReceiving messages

Last updated 1 year ago

Was this helpful?

Introduction

We provide a developer-friendly test environment, for anyone that wants to explore the usage of our WhatsApp API. The WhatsApp API allows for direct-like access to the WhatsApp Business API. In the test environment, you can test sending messages and templates.

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

Because of security reasons, in the sandbox environment, each phone number has its own Test API-KEY, and you are able to test sending messages/templates only to your phone number.

Limitations

What you can do in the Sandbox

  1. You can use the Test API-KEY to send text messages and text templates to your own phone number.

  2. An unlimited amount of messages can be sent with the sandbox.

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

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

  5. You can switch the endpoint at any time. If you don't have one yet you can use a free service like to set up an endpoint.

  6. Each Sandbox API Key is linked to one phone number and you can only send test messages to that phone number. If you wish to test messages with more than 1 number then it is advised to set up a test WhatsApp Business Account (Staging WABA) to use instead of the Sandbox.

What you can't do with the Sandbox

  1. The Sandbox is a test environment only. You will not be able to use it to send messages to your clients. You can only send messages to your own phone number.

  2. Templates messages can be sent a maximum of 10 times. You can choose between 2 predefined templates.

  3. Messages and Templates can be sent only to your own phone number.

  4. We will only forward and trigger an API when your given number is involved.

  5. We do not yet provide response information when you use the WhatsApp API.

  6. You only have access to the WhatsApp API.

  7. Our Sandbox is available to test via the API, but any automated tests would have to be configured from your end.

  8. The Sandbox number is hosted in the Cloud API, therefore, On-premise payloads won't work. If you require assistance, please reach out to our Support Team

1. Get a Test API Key

To get a test API-KEY you can:

  • Send a WhatsApp message from your phone to the phone number 4930609859535 with the contentSTART(STARTmust be in all UPPERCASE)

  • Use this QR code:

2. Set your Sandbox Webhook URL

Set Webhook URL

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

Inbound messages sent by you to your WhatsApp Phone Number will be sent to your Webhook. You can use an external service (such as requestbin.com) to test webhook responses, or you can create your own webhook server for tests. In the case you want to test with localhost, you may use an external service (such as ngrok). Use the API-KEY as authorization, with the value D360-API-KEY.

Headers

Name
Type
Description

D360-API-KEY

string

1234567_sandbox

Request Body

Name
Type
Description

url

string

Your webhook URL

{
    "url": "https://your-webhook-url"
}

3. Send a Message to the Sandbox

Now, send another message (any message) from your device to the Sandbox number: 4930609859535.You will receive the Inbound Message Notification on your webhook 😀

4. 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 your phone WhatsApp number with the above request URL and the body parameters as described below. Use the API-KEY as authorization, with the value D360-API-KEY.

Headers

Name
Type
Description

D360-API-KEY

string

1234567_sandbox

Request Body

Name
Type
Description

recipient_type

string

individual

to

number

Your number

type

string

text (default)

text

object

contains body field

{
    "messages": [
        {
            "id": "message_id"
        }
    ],
    "meta": {
        "api_status": "stable",
        "version": "2.31.5"
    }
}

Example Request Payload

{
    "messaging_product": "whatsapp",
    "recipient_type": "individual",
    "to": "your-number",
    "type": "text",
    "text": {
        "body": "Hello, dear customer!"
    }
}

5. Send a Template Message (optional)

There are 3 templates available to test in the Sandbox. There is no possibility to add or edit a Sandbox templates, you must use the predefined templates. 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.

Send Template Message

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

Headers

Name
Type
Description

D360-API-KEY

string

Sandbox API KEY

Request Body

Name
Type
Description

to

number

Your number

type

string

Message type

namespace

string

Template namespace

language

string

Template language

policy

string

Delivery policy

code

string

Language code

name

string

Template name

{
    "messages": [
        {
            "id": "message_id"
        }
    ],
    "meta": {
        "api_status": "stable",
        "version": "2.35.4"
    }
}

Example Request Payload

first_welcome_messsage

{
  "to": "1234567890",
  "messaging_product": "whatsapp",
  "type": "template",
  "template": {
    "name": "first_welcome_messsage",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "body",
        "parameters": [
          {
            "type": "text",
            "text": "Placeholder 1"
          }
        ]
      }
    ]
  }
}

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

disclaimer

{
  "to": "1234567890",
  "messaging_product": "whatsapp",
  "type": "template",
  "template": {
    "name": "disclaimer",
    "language": {
      "code": "en"
    },
    "components": []
  }
}

interactive_template_sandbox

{
  "to": "1234567890",
  "messaging_product": "whatsapp",
  "type": "template",
  "template": {
    "name": "interactive_template_sandbox",
    "language": {
      "code": "en"
    },
    "components": [
      {
        "type": "button",
        "sub_type": "quick_reply",
        "index": 0,
        "parameters": [
          {
            "type": "payload",
            "payload": "aGlzIHRoaXMgaXMgY29vZHNhc2phZHdpcXdlMGZoIGFTIEZISUQgV1FEV0RT"
          }
        ]
      },
      {
        "type": "button",
        "sub_type": "quick_reply",
        "index": 1,
        "parameters": [
          {
            "type": "payload",
            "payload": "aGlzIHRoaXMgaXMgY29vZHNhc2phZHdpcXdlMGZoIGFTIEZISUQgV1FEV0RT"
          }
        ]
      }
    ]
  }
}

Get new Sandbox API Key

You may recreate / get a new Sandbox API Key at any time by re-sending a WhatsApp message with content START to number 4930609859535. When you create a new API Key for your WhatsApp Number any existing Sandbox Keys associated with your number will be revoked.

Code Examples For Developers

Python

Creating an API key

Send a WhatsApp message START to the number 4930609859535. In the following examples, we assume your phone number is 49YOURNUMBER. Save the D360-API-KEY (in the examples it is described as YOUR_API_KEY).

Setting your Callback URL (optional)

#!/usr/bin/env python3
# coding: utf-8
import requests

url = "https://waba-sandbox.360dialog.io/v1/configs/webhook"

payload = '''
    {
        "url": "https://your-webhook-adress"
    }
'''

headers = {
    'D360-Api-Key': "YOUR_API_KEY",
    'Content-Type': "application/json",
}

response = requests.post(url, data=payload, headers=headers)

print(response.status_code)
print(response.json())

For example, when you send a message with content abcd you will receive a message:

{
    "contacts": [
        {
            "profile": {
                "name": "Your name"
            },
            "wa_id": "49YOURNUMBER"
        }
    ],
    "messages": [
        {
            "from": "49YOURNUMBER",
            "id": "ABGGSHggVwIvAhANFj5aqzEi_lbauSkLYDCO",
            "text": {
                "body": "abcd"
            },
            "timestamp": "1591955533",
            "type": "text"
        }
    ]
}

Test sending messages

#!/usr/bin/env python3
# coding: utf-8
import requests

url = "https://waba-sandbox.360dialog.io/v1/messages"

payload = '''
    {
        "to": "49YOURNUMBER",
        "type": "text",
        "text": {
            "body": "Any message you want..."
        }
    }
'''

headers = {
    'D360-Api-Key': "YOUR_API_KEY",
    'Content-Type': "application/json",
}

response = requests.post(url, data=payload, headers=headers)

print(response.status_code)
print(response.json())

In your webhook, you will receive messages about status updates. For example:

{
    "statuses": [
        {
            "id": "gBGGSHggVwIvAgk4hwKJv9PdlG4",
            "recipient_id": "49YOURNUMBER",
            "status": "read",
            "timestamp": "1591955668"
        }
    ]
}

Test sending templates

#!/usr/bin/env python3
# coding: utf-8
import requests

url = "https://waba-sandbox.360dialog.io/v1/messages"

payload = '''
    {
        "to": "49YOURNUMBER",
        "type": "template",
        "template": {
            "namespace": "c8ae5f90_307a_ca4c_b8f6_d1e2a2573574",
            "language": {
                "policy": "deterministic",
                "code": "de"
            },
            "name": "first_welcome_messsage",
            "components": [{
                    "type": "body",
                    "parameters": [{
                            "type": "text",
                            "text": "YOUR NAME"
                        }
                    ]
                }
            ]
        }
    }
'''

headers = {
    'D360-Api-Key': "YOUR_API_KEY",
    'Content-Type': "application/json",
}

response = requests.post(url, data=payload, headers=headers)

print(response.status_code)
print(response.json())

Similarly to sending text messages, you will receive webhook calls with status updates.

PHP

Creating an API key

Send a WhatsApp message START to the number 4930609859535. In the following examples, we assume your phone number is 49YOURNUMBER. Save API Key (in examples will be YOUR_API_KEY).

Setting your webhook (optional)

Then set your webhook:

<?php

$url = "https://waba-sandbox.360dialog.io/v1/configs/webhook";

$payload = <<<'PAYLOAD'
    {
        "url": "https://your-webhook-adress"
    }
PAYLOAD;

$headers = [
    "Content-Type: application/json",
    "D360-Api-Key: YOUR_API_KEY",
];

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_HTTPHEADER => $headers,
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "curl error: " . $err;
} else {
    echo $response;
}

For example, when you send a message with content abcd you will receive a message:

{
    "contacts": [
        {
            "profile": {
                "name": "Your name"
            },
            "wa_id": "49YOURNUMBER"
        }
    ],
    "messages": [
        {
            "from": "49YOURNUMBER",
            "id": "ABGGSHggVwIvAhANFj5aqzEi_lbauSkLYDCO",
            "text": {
                "body": "abcd"
            },
            "timestamp": "1591955533",
            "type": "text"
        }
    ]
}

Test sending messages

<?php

$url = "https://waba-sandbox.360dialog.io/v1/messages";

$payload = <<<'PAYLOAD'
    {
        "to": "49YOURNUMBER",
        "type": "text",
        "text": {
        	"body": "Any message you want..."
        }
    }
PAYLOAD;

$headers = [
    "Content-Type: application/json",
    "D360-Api-Key: YOUR_API_KEY",
];

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_HTTPHEADER => $headers,
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "curl error: " . $err;
} else {
    echo $response;
}

In your webhook, you will receive messages about status updates. For example:

{
    "statuses": [
        {
            "id": "gBGGSHggVwIvAgk4hwKJv9PdlG4",
            "recipient_id": "49YOURNUMBER",
            "status": "read",
            "timestamp": "1591955668"
        }
    ]
}

Test sending templates

<?php

$url = "https://waba-sandbox.360dialog.io/v1/messages";

$payload = <<<'PAYLOAD'
    {
        "to": "49YOURNUMBER",
        "type": "template",
        "template": {
            "language": {
                "policy": "deterministic",
                "code": "de"
            },
            "name": "first_welcome_messsage",
            "components": [{
                    "type": "body",
                    "parameters": [{
                            "type": "text",
                            "text": "YOUR NAME"
                        }
                    ]
                }
            ]
        }
    }
PAYLOAD;

$headers = [
    "Content-Type: application/json",
    "D360-Api-Key: YOUR_API_KEY",
];

$curl = curl_init();

curl_setopt_array($curl, [
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_HTTPHEADER => $headers,
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "curl error: " . $err;
} else {
    echo $response;
}

Similarly to sending text messages you will receive webhook calls with status updates.

CURL

Creating API Key

Send a WhatsApp message START to the number 4930609859535. In the following examples, we assume your phone number is 49YOURNUMBER. Save API Key (in the examples will be YOUR_API_KEY).

Setting your webhook (optional)

Then set your webhook:

curl --request POST \
  --url https://waba-sandbox.360dialog.io/v1/configs/webhook \
  --header 'Content-Type: application/json' \
  --header 'D360-Api-Key: YOUR_API_KEY' \
  --data '{"url": "https://your-webhook-adress"}'

For example, when you send a message with content abcd you will receive the message:

{
    "contacts": [
        {
            "profile": {
                "name": "Your name"
            },
            "wa_id": "49YOURNUMBER"
        }
    ],
    "messages": [
        {
            "from": "49YOURNUMBER",
            "id": "ABGGSHggVwIvAhANFj5aqzEi_lbauSkLYDCO",
            "text": {
                "body": "abcd"
            },
            "timestamp": "1591955533",
            "type": "text"
        }
    ]
}

Test sending messages

curl --request POST \
  --url https://waba-sandbox.360dialog.io/v1/messages \
  --header 'Content-Type: application/json' \
  --header 'D360-Api-Key: YOUR_API_KEY' \
  --data '{"to":"49YOURNUMBER","type":"text","text":{"body":"Any message you want..."}}'

In your webhook, you will receive messages about status updates. For example:

{
    "statuses": [
        {
            "id": "gBGGSHggVwIvAgk4hwKJv9PdlG4",
            "recipient_id": "49YOURNUMBER",
            "status": "read",
            "timestamp": "1591955668"
        }
    ]
}

Test sending templates

curl --request POST \
  --url https://waba-sandbox.360dialog.io/v1/messages \
  --header 'Content-Type: application/json' \
  --header 'D360-Api-Key: YOUR_API_KEY' \
  --data '{"to": "1234567890", "messaging_product": "whatsapp", "type": "template", "template": { "name": "first_welcome_messsage", "language": { "code": "en" }, "components": [ { "type": "body", "parameters": [ { "type": "text", "text": "Placeholder 1"}'

Similarly to sending text messages, you will receive webhooks with status updates.

Use this link:

As a response, you will receive your TestAPIKEY.This API-KEYis associated with your phone WhatsApp number. Now you are able to use the 360dialog WhatsApp API. You can set your own or .

Use an external service (such as ) to test webhook responses, or create your own webhook server for tests. In the case you want to test with localhost, you may use an external service (such as ).

Now you may send any messages to the number 4930609859535. You will receive all webhooks as described in the .

Use external service e.g. to test webhook answers. Or create your own webhook server for tests. In case if you want to test with localhost you may use e.g. external service.

Now you may send any messages to the number 4930609859535. You will receive all webhooks as described in the .

Use external service e.g. to test webhook answers, or create your own webhook server for tests. In the case you want to test with localhost you may use e.g. external service.

Now you may send any messages to the number 4930609859535. You will receive all webhooks as described in WhatsApp API

RequestBin
https://wa.me/4930609859535?text=START
Webhook
send an unlimited number of messages and limited (10) templates
requestbin.com
ngrok
WhatsApp API Webhooks Page
requestbin.com
ngrok.com
WhatsApp API Webhooks Page
requestbin.com
ngrok.com
https://developers.facebook.com/docs/whatsapp/api/webhooks