ClearWebhooksQueue#
The method is aimed for clearing the incoming notifications queue. A notification is stored in the queue for 24 hours and will be sent after the webhookUrl is configured on the authorized instance. The notification sending rate depends on the response speed to requests of the GREEN-API webhook server or on the speed of reading notifications by the HTTP API methods.
The method can be executed on the instance no more than once per minute. If the method is requested earlier, you will receive a description of the reason reason: "Too many requests" and the remaining time until the successful execution of the method leftTime in seconds.
Request#
To clear the notifications queue, you have to execute a request at:
DELETE {{apiUrl}}/waInstance{{idInstance}}/clearWebhooksQueue/{{apiTokenInstance}}
For idInstance, apiTokenInstance and apiUrl request parameters, refer to Before you start section.
Response#
Response parameters#
| Parameter | Type | Description |
|---|---|---|
isCleared | boolean | Notifications queue clearing flag |
reason | string | Error description: |
| "Too many requests" - the method is not ready to execute (method execution is available no more than once per minute) | ||
leftTime | int | The remaining time before the next request to clear the queue is allowed to be executed (the field is present in the response only if isCleared: false) |
Response body example#
Successful execution of the method#
status code 200
{
"isCleared": true,
"reason": ""
}
The method executed successfully, but the time between requests has not yet expired#
status code 200
{
"isCleared": false,
"reason": "Too many requests",
"leftTime": 46
}
The method executed successfully, but the system was unable to process the request#
status code 200
{
"isCleared": false,
"reason": "Error description"
}
ClearWebhooksQueue errors#
For a list of errors common to all methods, refer to Common errors section
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/clearWebhooksQueue/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("DELETE", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location --request DELETE '{{apiUrl}}/waInstance{{idInstance}}/clearWebhooksQueue/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/clearWebhooksQueue/")
.append({{apiTokenInstance}});
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.DELETE, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/clearWebhooksQueue/")
.append({{apiTokenInstance}});
var response = Unirest.delete(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub ClearWebhooksQueue()
Dim url As String
Dim http As Object
Dim response As String
' The idInstance and apiTokenInstance values are available in your account, double brackets must be removed
url = "{{apiUrl}}/waInstance{{idInstance}}/clearWebhooksQueue/{{apiTokenInstance}}"
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "DELETE", url, False
http.Send
response = http.responseText
Debug.Print response
' Outputting the answer to the desired cell
' Range("A1").Value = response
Set http = Nothing
End Sub