Links

Partner API integration

The 360dialog Partner API allows to automate different processes of account management, usage statistics collection and let you know about status changing of your client’s accounts.
The basic principles of interaction with Partner API are the same as for WhatsApp API.

Getting Started

In order to get started with the Partner API you need two things: your 360 Partner Hub login credentials and your Partner ID.

Login Credentials

All requests to the API are secured by a Bearer Token, which can be obtained by providing a username (email) and a password. For this, you can either use a personal user account or set up a system user specifically for the API tasks. Make sure you have this information at hand when starting to work with the Partner API.
For more information on Authorization have a look at the API description and the token endpoint description.

Partner ID

For all endpoints except the /token endpoint you will need to provide your individual Partner ID. The easiest way to find your Partner ID is to log into the 360 Partner Hub on your browser and go to the "WhatsApp Accounts" section. Then check the URL in the address bar of your browser. The Partner ID follows after the /partner/ parameter and can easily be identified by its PA suffix, see the image below.
To understand more about the Partner ID and credentials, see the Architecture and Security doc.

Base URL

The default base URL for the 360 Partner API is https://hub.360dialog.io/api/v2
A Mock Server is available in https://stoplight.io/mocks/360dialog/360dialog-partner-api/24588693

Authorization

Endpoints of this API need to be accessed by providing a Bearer token in the Authorization header.
To retrieve this token, a call to the /token endpoint needs to be made including the username (email) and password of one of your partner users in the request body. You can either use a personal user account or set up a system user specifically for the API tasks. The response from the /token endpoint will include an access_token.
post
https://hub.360dialog.io/api/v2
/token
Request OAuth token for any Partner API request
After token is received, use this access token in your authorization header:
"Authorization": "Bearer <your-access-token>"

Passing Client Identifiers

When calling the Partner API endpoints you will be referencing clients by their 360dialog Client ID. As these clients are also your clients and you'll likely want to match their 360dialog Client ID with any identifier from your system, you can pass different query parameters to the submission forms.

Partner Payload

You can add a partner query parameter to the submission form URL. The value from this parameter will be stored as partner_payload on the 360dialog Client model.
Partner query parameter added to submission form URL
https://hub.360dialog.com/lp/whatsapp/?partner=yourSystemIdentifier
When calling the GET /partners/<your-partner-id>/clients endpoint you will be able to find the 360dialog Client ID as well as your identifier, that you've passed via the partner query parameter.
partner_payload on the client model
"partner_payload" : "yourSystemIdentifier",
The partner_payload will also be included in any webhook event that you receive.
Additionally you're able to PATCH existing clients with your partner_payloade.g. by matching them via e-mail or phone number.

Redirect URL

In your partner profile you have the option to define a deeplink_url, which is being used to redirect clients back to your application after they created their API key. This URL however is static.
In order to provide more personalization options for this redirect URL and support for query parameters, we made the redirect_url query parameter available on the submission form URL.
You can add a client specific URL as the redirect_url query parameter, which will be stored locally on the client's device and will be used for redirection after the API key is created.
Remember to URL encode your redirect URL when passing as a query parameter
Redirect URL query parameter added to submission form URL
// For URL https://yourapplication.com/setup?clientId=yourSystemIdentifier
https://hub.360dialog.com/lp/whatsapp/<your-partner-id>?redirect_url=https%3A%2F%2Fyourapplication.com%2Fsetup%3FclientId%3DyourSystemIdentifier
When the redirect_url is being used instead of the deeplink_url, we will also attach the 360dialog Client and Channel IDs as query parameters to your URL. This means by clicking the button the user will return to:
https://yourapplication.com/setup?clientId=yourSystemIdentifier&client=360ClientId&channel=360ChannelId
Please make sure to not use the reserved query parameter names client, channel and project in your redirect URL.
Local Storage
The redirect URL will be stored in the local storage of the client's device and is therefore not persistent or cross-device compatible.

Setting up your Webhook URL

To perform several actions and receive webhook events for notifications, you will need to set your Webhook URL, which is an API endpoint.
post
https://hub.360dialog.io/api/v2
/partners/{partner_id}/webhook_url
Set Partner Hub Webhook URL
After the Webhook URL is set, you will start receiving events about the accounts registered under your Partner Hub. See all events available today here.

Check your Webhook URL

You can check the Webhook URL used with this endpoint.
get
https://hub.360dialog.io/api/v2
/partners/{partner_id}/webhook_url
Set Partner Hub Webhook URL

Check Partner Hub information

You can use GET requests to check information regarding your 360 Partner Hub.
get
https://hub.360dialog.io/api/v2
/partners/{partner_id}
Get 360 Partner Hub information