Skip to content

Receiving notifications via Webhook Endpoint#

The Webhook Endpoint technology allows incoming notifications to be received directly on your server.
This means that the GREEN-API server will call a method published on your server's side.

The advantages of this technology are the fastest possible receipt of incoming notifications and high throughput, limited only by the speed of notification processing on your server's side.
Its disadvantages include the complexity of implementation.

The GREEN-API server attempts to deliver notifications at 1-minute intervals. Therefore, for notifications to be received on time, your server must always be available to process incoming notifications.

Incoming notifications are stored in the queue for 24 hours.
The webhook sending rate is about 50 notifications per second (20 ms per webhook).

Server configuration#

To receive incoming notifications with the Webhook Endpoint technology, you need to perform the following steps:

  • publish an IP address on the Internet
  • implement the logic for processing incoming notifications at the specified IP address
  • if your server requires it, set a Webhook URL Token

Public IP address#

To receive incoming notifications, you need a public IP address (endpoint) that will be accessible from the Internet. This way the GREEN-API server will be able to call your server at the specified address and pass the incoming notification.

Our public IP addresses that notifications are sent from#

You can specify the following IP addresses, which notifications from us come from, in the security settings of your server:

51.250.2.220
93.77.180.129

Processing incoming notifications#

After receiving an incoming call at the IP address of your server, you will need to process the received notification.

Instance configuration#

Before receiving incoming notifications, you need to configure the instance. The instance can be configured programmatically using the SetSettings method, or interactively in the console interface.

Configuration using the SetSettings method#

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

https://84.211.100.201:3000/green-api/webhook/

You also need to specify which kinds of notifications you need to receive. To enable incoming notifications by kind, and also to specify the webhookUrl and webhookUrlToken parameters, use the SetSettings method.

Request body example for the SetSettings method#

{
    "webhookUrl": "https://84.211.100.201:3000/green-api/webhook/",
    "webhookUrlToken": "dscnsdiuafkascndjhsalbcvatsvcbasn23rfregvfdg54tds",
    "outgoingWebhook": "yes",
    "stateWebhook": "yes",
    "incomingWebhook": "yes",
    "deviceWebhook": "no"
}

Configuration in the console#

  1. Go to the console
  2. Select the instance whose settings you need to change
  3. Click the Change button on the instance panel
  4. Specify the value of the webhookUrl parameter

    If authorization is required on your webhook server, specify a Webhook URL Token.

  5. Turn on the toggles for the required kinds of notifications
  6. Click the Save changes button to apply the settings.

Receiving incoming notifications#

After configuring the instance, you can start receiving notifications.

Debugging incoming notifications#

To debug incoming notifications, you can use any free service, for example webhook.site.
The service provides a unique address (URL) that needs to be set as the value of the webhookUrl parameter.

A detailed description of the incoming notification format is presented in the Incoming notifications format section.