WABA integration
A short step-by-step guide to sending and receiving messages with the 360dialog WhatsApp API.

Since 360dialog takes care of deploying all the necessary infrastructure, as Partner you just have to start using API. The API is not tied to a specific programming language and and can be adapted to any purpose.
For any outgoing actions (like messages sending), you need to use requests to an appropriate endpoints.
  • All these actions are available via different request types that use a combination of 360dialog base URL and an endpoint suffix. E.g. it’s needed to use a POST request to the resource https://waba.360dialog.io/v1/messages/ to send a message.
  • The body of the request to the API will determine what exactly you want to send (text, image, etc.).
  • You need to use an API key received from the client in authorization purposes.
  • A business cannot send a freely composed message first. If business starts a conversation with a user, it should use a template message. Please do not forget about Opt-In requirements.
  • Tip: we can recommend to use Postman as first step instrument to test WABA opportunities.
To receive any information that is not a response to your request to the API (e.g. incoming messages from users) you need to set a webhook address.
  • It should be unique for every WABA number
  • It should return an HTTPS 200 OK response immediately (before any other processing begins)

The default base URL for the 360dialog WhatsApp API is https://waba.360dialog.io
If you want to send a message using the /v1/messages/ endpoint, you must append the endpoint to your base URL then make the POST request. Below is an example of a full POST request to the resource: https://waba.360dialog.io/v1/messages/

In order to communicate with the 360dialog WhatsApp API, you need your D360-API-KEY, which is used for authentication. Each registered WhatsApp phone number (channel) has its own D360-API-KEY.

In this case, you can manage the API Key directly via API. Please note that each channel has its own API key.
For each request you will need the Partner API Authorization Token.
get
https://hub.360dialog.io/api/v2
/partners/{partner_id}/channels/{channel_id}/api_keys
Get the API key for a specific channel.
post
https://hub.360dialog.io/api/v2
/partners/{partner_id}/channels/{channel_id}/api_keys
Create a new API key for a specific channel.
delete
https://hub.360dialog.io/api/v2
/partners/{partner_id}/channels/{channel_id}/api_keys
Delete the API key for a specific channel.

In this case, for security reasons, only the client can retrieve their API key inside their 360 Client Hub. 360 Partner Hub users do not have access to this.
Once all of the steps from the setup process are successfully completed, the client will be able to generate an API Key.

Each endpoint described later in the docs has to be accessed with HTTP Request +SSL and either with API Key based authorization.
When making POST requests, JSON data specified in the docs has to be sent as POST data payload.
Every request to the needs to be authorized using an API Key authentication. Adding D360-API-KEY in the header with your unique API Key as a value will grant access.

curl \
-H "D360-API-KEY: {{your-api-key}}" \
-X POST \
https://{{base-url}}/v1/messages \
-H "Accept: application/json"
...

  • In order to look up the phone number assigned to a D360-API-KEY, use the /phone_number endpoint.
  • Store and manage your D360-API-KEY securely and use it only for server-2-server authentication.
  • Ensure that you always use the corresponding D360-API-KEY when you deal with multiple configurations. A mismatch could lead to inconsistent data.

If you only want to test sending messages, you can skip this step and continue with 3. Check Contact Availability
To receive notifications for in and outbound messages, you have to set a webhook URL, that we use as a destination for all notifications belonging to you WhatsApp phone number.

If you got a valid wa_id, you can start sending messages.
Use the messages node/messagesto send text messages, media, documents, and message templates to your customers.
You can send messages by making a POST call to the /messages node regardless of message type. The content of the JSON message body differs for each type of message (text, image, etc.).

POST /v1/messages
{
"recipient_type": "individual",
"to": "whatsapp-id",
"type": "text",
"text": {
"body": "your-message-content"
}
}
If this wa_id did not sent a message to your WhatsApp Business Account within the last 24 hours, you can only reach this number with a template message.

In case you have set a webhook URL as described in step 2. Set Webhook URL, you will have received a Outbound Message Status Notification for your test message by now.
You must configure a callback (webhook URL) to receive messages.
Webhooks can be used for:
  • Inbound Message Notifications: Use it to get a notification you when you have received a message.
  • Message Status Notifications: Monitor the status of sent messages.
If a webhook event isn't delivered for any reason (e.g., the client is offline) or if the webhook request returns a HTTP status code other than 200, we retry the webhook delivery. We continue retrying delivery with increasing delays up to a certain timeout (typically 24 hours, though this may vary), or until the delivery succeeds.

To deploy a live webhook that can receive webhook events from the WhatsApp Business API, your code must have the following:
  • HTTPS support
  • A valid SSL certificate

Send a POST request to the /v1/configs/webhook endpoint to set the resource.
POST /v1/configs/webhook
{
"url": "{{your-callback-url}}"
}

If the callback URL needs to be authorized by user, USER and PASS should be provided in the header Authorization that contains Basic base64(USER:PASS).
Request body example for USER=testuser and PASS=testpass
{
"url": "{{your-callback-url}}",
"headers": {
"Authorization": "Basic {{token}}"
}
}

For security reasons you will not be able to access any of the below endpoints. If you need to access any of the below resources, please create a support ticket and, depending on the nature of the request, we will provide some options for you.
Copy link
On this page
Getting started
Base URL
Prerequisites & Basic Setup
1. Retrieve API Key
get
Get the API key for a specific channel.
post
Create a new API key for a specific channel.
delete
Delete the API key for a specific channel.
2. Get authorization with the API Key
2. Set Webhook URL
Send & Receive Messages
3. Send a message
4. Receive a message
Blacklisted Endpoints