Skip to content

Receive webhooks via HTTP API#

You can get incoming webhooks (messages, statuses) via HTTP API requests in the similar way as the rest of the Green API methods are implemented. Herewith, the chronological order of the webhooks following is guaranteed in the sequence in which they were received FIFO. All incoming webhooks are stored in the queue and are expected to be received within 24 hours.

To get incoming webhooks, you have to sequentially call two methods ReceiveNotification and DeleteNotification. ReceiveNotification method receives an incoming webhook. DeleteNotification method confirms successful webhook receipt and processing. To learn more about the methods, refer to respective ReceiveNotification and DeleteNotification sections.

Incoming webhooks are stored for 24 hours.

Video instruction#

Instance setup#

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

Setup by SetSettings method#

To set up receiving incoming webhooks using HTTP API technology, you need to fill the setting blank the value as webhookUrl parameter. 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 parameter, use SetSettings method.

Example of SetSettings method request body#

{
    "webhookUrl": "",
    "outgoingWebhook": "yes",
    "stateWebhook": "yes",
    "incomingWebhook": "yes"
}

Setup in console#

You can also set up to receive incoming webhooks online. To do this, go to console and select the required user instance. If the instance 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. If the instance is not authorized and the webhooks settings are not displayed, refer to Before you start section.

Incoming webhooks settings

Receive incoming webhooks#

After setting up the instance, you can start receiving webhooks by ReceiveNotification and DeleteNotification methods. You can see the example of incoming webhook processing code on NodeJS in ReceiveNotifications file.

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