We are sunsetting On-Premises API. Refer to our On-Premises API Sunset document for details, and to learn how to migrate to our next-generation Cloud API.

Health

/v1/health

Use the health node to check the status of your WhatsApp Business API client.

Before You Start

The health node supports Bearer token and API keys authentication.

API Keys

If you wish to monitor the health, metrics, and stats nodes from an orchestrator, Bearer tokens are not the best option for ongoing checks as they expire every 7 days. To mediate this, you can use an API key, which can be set using the WA_API_KEY environment variable in the waweb environment section in the .yml file of your installation setup.
services:
...
  waweb:
  ...
    environment:
    ...
    WA_API_KEY: your-api-key-token
The API key you set must have a minimum of 12 characters and a maximum of 128 characters. The Webapp must be restarted whenever you change the API key.

Contraints

The API key you set must have a minimum of 12 characters and a maximum of 128 characters.

Retrieving

Make a GET call to this node to retrieve the status of your WhatsApp Business API client.

Example

Request:

GET /v1/health
{
  Authorization: Bearer your-auth-token | Apikey your-api-key-token
}

The response provides the status of the health of the gateway to the WhatsApp server. If the Authorization header is not present or invalid, a 401 error code is returned.

Single instance

{
    "health": {
       "gateway_status": "connected | connecting | disconnected | uninitialized | unregistered"
    }
}

High Availability/Multiconnect

{
    "health": {
      "your-hostname1:your-container-id1": {
          "gateway_status": "connected | connecting | disconnected | uninitialized | unregistered",
          "role": "primary_master | secondary_master | coreapp"
      },
      "your-hostname2:your-container-id2": {
          "gateway_status": "connected | connecting | disconnected | uninitialized | unregistered",
          "role": "primary_master | secondary_master | coreapp"
      },
    }
}

In High Availability mode, only one Coreapp will be connected to the WhatsApp server, all other nodes including the primary Master will have a gateway_status of disconnected. In Multiconnect mode with X shards, X Coreapps will be connected to the WhatsApp server, and the primary Master will also connect to the WhatsApp server.

Parameters

NameDescription

health

type: Object

Contains the fields that describe the health of the WhatsApp Business API client.

gateway_status

type: String

Status of the connection between the Coreapp and WhatsApp servers.


Supported values:

  • connected, connecting — The health is good.
  • uninitialized — The application could be in the process of upgrading or initializing the database schema. Try again in a few minutes and contact WhatsApp Support if you continue to see this status.
  • unregistered — You need to register your WhatsApp Business API client. See the Registration documentation for more information.
  • disconnected — The Coreapp is not connected to the WhatsApp servers.

role

type: String

Role of the container in High Availability/Multiconnect setups. See the Availability and Scaling documentation for more information on these setups.


Supported values: primary_master, secondary_master, coreapp