Skip to content

DeleteNotification#

Test Postman Apidog

The method is aimed for deleting an incoming notification from the notification queue. To specify what notification to delete, use receiptId parameter. After receiving and processing an incoming notification, you need to delete the notification from the queue. This requires you to run this method. After calling the method, the notification will be considered received and processed and will be permanently deleted from the queue. Therefore, the next call of ReceiveNotification method will return the next notification from the queue in the order in which notifications come to the queue.

Incoming notifications are stored in the queue for 24 hours.

Notifications are sent from the queue in FIFO order

Request#

To delete an incoming notification from the queue, you have to execute a request at:

DELETE
{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/{{receiptId}}

Note that you have to use a request of DELETE type

For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

Request parameters#

Parameter Type Mandatory Description
receiptId integer Yes Receipt Id for deleting an incoming notification received by ReceiveNotification method

Response#

Response parameters#

Parameter Type Description
result boolean Incoming notification deleting result: true - incoming notification successfully deleted from the queue; false - notification is not deleted - possible, if the notification was deleted earlier or receiptId doesn't correspond to the value previously received by ReceiveNotification method

Response body example#

{
    "result": true
}

DeleteNotification errors#

For a list of errors common to all methods, refer to Common errors section

HTTP code Error Id Description
400 Parameter idInstance not an integer The idInstance parameter is not set or contains non-numeric characters
400 Parameter apiTokenInstance not define The apiTokenInstance parameter is not set
400 Message cannot be received because custom webhook url is set. Go to cabinet, clear webhook url for instance: ХХХХХХХХХХ and wait for about 1 minute for another attempt The webhookUrl field is not empty. Please clear the URL for instance XXXXXXXXXXX and wait about 1 minute before you start requesting notifications
500 Internal Server Error
Parameter receiptId must be a Number!
The specified receiptId is not a number
500 Internal Server Error
Cannot read properties of undefined (reading 'findUnAckedMessage')
The message you tried to delete was not found

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/1234567"

payload = {}
headers= {}

response = requests.request("DELETE", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
curl --location --request DELETE '{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/1234567'
var receiptId = 1;
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();

requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/deleteNotification/")
    .append({{apiTokenInstance}})
    .append("/").append(receiptId);

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.DELETE, null, String.class);
System.out.println(response);
var receiptId = 1;
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/deleteNotification/")
    .append({{apiTokenInstance}})
    .append("/").append(receiptId);;

var response = Unirest.delete(requestUrl.toString())
    .asString();

System.out.println(response);
Sub DeleteNotification()
    Dim url As String
    Dim http As Object
    Dim response As String

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/deleteNotification/{{apiTokenInstance}}/12345"

    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

You can see the example of notifications receipt code on NodeJS in the file ReceiveNotifications