Skip to content

DeleteNotification#

Test Postman

The method is intended for deleting an incoming notification from the notification queue.
To specify which notification should be deleted, use the receiptId parameter.

The method uses limits on the request rate per second.

Request#

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

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

Note that the method uses a DELETE request

To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.

Request parameters#

Parameter Type Required Description
receiptId integer Yes Delivery identifier for deleting an incoming notification, received using the ReceiveNotification method

Response#

Response fields#

Field Type Description
result boolean Result of deleting the incoming notification:

- true - the incoming notification has been successfully deleted from the queue;
- false - the notification has not been deleted (the notification was deleted earlier or receiptId does not match the value previously received by the ReceiveNotification method)
reason string Reason for the unsuccessful execution of the method

Response body example#

{
    "result": true,
    "reason": ""
}

DeleteNotification errors#

For the list of errors common to all methods, see the Common errors section

HTTP code Error identifier Description
400 Parameter idInstance not an integer The idInstance parameter is not set or contains non-numeric characters
400 Parameter receiptId must be a Number! The specified receiptId is not a number
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: XXXXXXXXXX and wait for about 1 minute for another attempt The webhookUrl field is not empty. Clear the URL for instance XXXXXXXXXX and wait about 1 minute before you start requesting notifications.
500 Internal Server Error
Cannot read properties of undefined (reading 'findUnAckedMessage')
The message that was being deleted was not found

Code 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("/Instance").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