Skip to main content

Delete a message

This endpoint will let you delete a message from 2Chat and from WhatsApp if the message was sent up to 60 hours ago.

Parameters

These are path parameters that should go in the URL you use to invoke the endpoint.

ParameterDescriptionExample
Session KeyThe session key the message belongs toWW-WPN66037eca-9ad1-4c96-9eff-526a90a48c77-5215511112222@c.us
Message UUIDThe UUID of the message you want information fromMSG205dec10-523d-4ab3-b739-fd56e7cdeba2

Deleting a message you sent in a conversation

Assuming you want to delete a message you sent that has MSG205dec10-523d-4ab3-b739-fd56e7cdeba2 as UUID, and is part of the conversation with session key WW-WPN66037eca-9ad1-4c96-9eff-526a90a48c77-5215511112222@c.us. To delete it, you must make a DELETE request to:

https://api.p.2chat.io/open/whatsapp/message/WW-WPN66037eca-9ad1-4c96-9eff-526a90a48c77-5215511112222@c.us/MSG205dec10-523d-4ab3-b739-fd56e7cdeba2.

caution

WhatsApp will only let you delete messages up to 60 hours after you sent them

Deleting a message sent into a WhatsApp group

Deleting messages sent to a group depends on the configuration of the group and whether you are an administrator in such group, and/or if you are the author of the message.

  • Administrators can delete any message including the ones they didn't send.
  • Normal participants (non-administrators) can only delete messages they send.
caution

If you are not an administrator in the group and you are trying to delete a message sent by someone else, 2Chat will let you process it locally and delete it from our database, but WhatsApp will silently accept the request but not delete the message from the conversation as you don't have the permissions to do so.

Invocation

curl --location --request DELETE 'https://api.p.2chat.io/open/whatsapp/message/WW-WPN66037eca-9ad1-4c96-9eff-526a90a48c77-5215511112222@c.us/MSG205dec10-523d-4ab3-b739-fd56e7cdeba2' \
--header 'X-User-API-Key: your_api_key_here' \
--data-raw ''

Response

{
"success": true,
"message_uuid": "MSG205dec10-523d-4ab3-b739-fd56e7cdeba2",
"whatsapp_message_id": "3EB0AFC0D8DFCFAB08A4FB"
}