Health

/v1/health

Check the status of your WhatsApp Business API client with the health node. This node samples the health of the gateway to the WhatsApp server and sends back a JSON response.

Request

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

Authorization

The health node supports Bearer token authenication similar to other WhatsApp Business API nodes. However, if you wish to monitor the health status from an orchestrator, Bearer tokens are not the best option for ongoing health 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.

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

services:
...
  waweb:
  ...
    environment:
    ...
    WA_API_KEY: your-api-key-token

The Webapp must be restarted whenever you change the API key.

Response

The response will provide 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 will be 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"
      },
    }
}

Note: 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. To learn more about High Availability/Multiconnect mode, refer to the Availability and Scaling guide.

Parameters

NameDescriptionType

health

The health object contains the fields that describe the health of the WhatsApp Business API Client.

Object

gateway_status

Status of the connection between the Coreapp and WhatsApp servers.
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.

String

role

Role of the container in High Availability/Multiconnect setups
Values: primary_master, secondary_master, coreapp
See the Availability and Scaling documentation for more information on these setups.

String