Skip to content

DeleteMessage#

Beta version

The functionality is in beta. Features may change and may also work unstably.

The method deletes a message from an Instagram Direct chat.

You can delete a message of the account itself: it disappears for both parties.

The method uses the limits on the number of requests per second.

Request#

To delete a message, you have to execute a request at:

POST
{{apiUrl}}/waInstance{{idInstance}}/deleteMessage/{{apiTokenInstance}}

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

Request parameters#

Parameter Type Mandatory Description
chatId string Yes Chat identifier - the numeric identifier of an account or of a group chat, or a username with the @ prefix
idMessage string Yes The message identifier

Request body example#

{
    "chatId": "49547665464",
    "idMessage": "32992354783594572492903878028689408"
}

Response#

Response parameters#

Field Type Description
idMessage string The identifier of the deletion event

The deleted message itself keeps the identifier passed in the request: in the journals it has the isDeleted flag. The identifier from the response arrives in the idMessage field of the deletedMessage notification.

Response body example#

{
    "idMessage": "32992354783594572492903939751251968"
}

DeleteMessage errors#

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

HTTP code Error ID Description
400 Bad Request
Validation failed
Validation error
400 Validation failed. Details:
'idMessage' is required
The message identifier is not passed
400 message '32992354783594572492903878028689408' not found The instance is authorized through a browser session: there is no such message in the chat
400 Deleting incoming messages not supported The message was sent by the contact
400 Message by id not found There is no such message in the specified chat
400 Message already was deleted The message has already been deleted

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/deleteMessage/{{apiTokenInstance}}"

payload = {
    "chatId": "49547665464",
    "idMessage": "32992354783594572492903878028689408"
}
headers = {'Content-Type': 'application/json'}

response = requests.post(url, json=payload, headers=headers)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/deleteMessage/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "49547665464",
    "idMessage": "32992354783594572492903878028689408"
}'