Delete sent WhatsApp messages after sending

How to delete a sent message via WhatsApp API

First you need to know the id of the message you want to put a reaction on. By using a webhook, you'll know exactly about all incoming messages and can target which messages to react to.

This is an example of a webhook for an incoming text message:

{
  "statuses": [
    {
      "id": "yqIwVdaioxo-wLkSiXIF.g", // ID message
      "recipient_id": "123456789@s.whatsapp.net",
      "status": "delivered", // "status": "read",
      "timestamp": "1697533459"
    }
  ],
  "event": {
    "type": "statuses",
    "event": "post"
  },
  "channel_id": "Your Channel ID"
}

You can also get the message id without using webhook by using the get message method:

Now, knowing the ID of the message, you can delete it! Use a separate method for this, which requires you to specify the message ID:

Messages you’ve sent that are deleted for everyone will be replaced with: “You deleted this message”

Last updated