Skip to content

Receive webhooks via Webhook Endpoint#

Webhook Endpoint technology allows you to receive incoming webhooks directly to your server. This means that the Green API server will make a call to the method published on your server side. The advantage of this technology is the fastest possible receipt of incoming webhooks and high capacity, limited only by the rate of processing webhooks on your server side. The disadvantages include the implementation complexity.

The Green API server makes attempts to deliver webhooks at 1-minute interval. Therefore, set up your server so that it is always available to process incoming webhooks, or use Receive webhooks via HTTP API technology. The delivery of incoming webhooks is guaranteed within 24 hours.

Server setting#

To receive incoming webhooks using Webhook Endpoint technology, you will need to complete the below steps:

  • to publish the IP address on the internet
  • to implement the logic for processing incoming webhooks to the specified IP address
  • if required for the server, then set the Webhook URL Token

Public IP address#

To receive incoming webhooks, a public IP address (endpoint) is required, which will be accessible from the Internet. Thus, the Green API server will be able to make a call to your server at the specified address and transmit an incoming webhook.

Our public IP-addresses which we sent webhooks from#

You may specify the below IP addresses from which webhooks from us are received, in your server's security settings:

Incoming webhooks processing#

After receiving an incoming call to the IP address of your server, you will need to process the received webhook. You can see the example of incoming webhook processing code on NodeJS in file

Account setup#

Before receiving incoming webhooks, you need to set up your account. Account settings can be performed in software using SetSettings method, or online in your profile interface.

Setting by SetSettings {#SetSettings} method#

To set up receiving incoming webhooks using Webhook Endpoint technology, you need to specify your IP address or your domain name as the webhookUrl parameter, and, if necessary,webhookUrlToken to access your server. For example:

It is also required to specify what types of webhooks you need to receive. To enable incoming webhooks by type, as well as to specify webhookUrl andwebhookUrlToken parameters, use SetSettings method.

Example of SetSettings method request body#

    "webhookUrl": "",
    "webhookUrlToken": "dscnsdiuafkascndjhsalbcvatsvcbasn23rfregvfdg54tds",
    "outgoingWebhook": "yes",
    "stateWebhook": "yes",
    "incomingWebhook": "yes",
    "deviceWebhook": "no"

Setup in your profile#

You can also set up to receive incoming webhooks online. To do this, go to My Profile and select the required user account. If the account is authorized, the settings for receiving incoming webhooks will be displayed, see fig. Specify the webhookUrl parameter, as well as the switches by webhooks types and, if you need authorization on your webhook server, specify Webhook URL Token. If the account is not authorized and the webhooks settings are not displayed, refer to Before you start section.

Setup in your profile

Receive incoming webhooks#

After setting up the account, you can start receiving webhooks. You can see the example of incoming webhook processing code:

Debug incoming webhooks#

You can use any free service on the Internet to debug incoming webhooks, for example, Webhook.Site service. The service issues a unique address (URL), which is required to set as the webhookUrl parameter.

A detailed description of incoming webhooks format is given in Incoming webhooks format section.

Http request example that send by green-api:

curl --request POST 'your-webhook-url-address' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{"typeWebhook":"statusInstanceChanged","instanceData":{"idInstance":000001,"wid":"","typeInstance":"whatsapp"},"timestamp":1654553712,"statusInstance":"online"}'