To delete messages received on WhatsApp, you need to perform these steps: open the application, tap "Settings", "Chat", "Chat history" and "Delete all chats". At this point you can return to the main screen.
Steps
Method 1 of 3: iOS

Step 1. Open WhatsApp

Step 2. Tap Settings
It is located at the bottom right.

Step 3. Tap Chat

Step 4. Tap Clear All Chats
This will remove the messages contained in all conversations on the device.
Use this option to keep your chat history and only delete messages, so they don't take up too much memory

Step 5. Tap Settings in the top left
At this point you will have deleted the messages from the device.
Method 2 of 3: Android

Step 1. Open WhatsApp

Step 2. Tap ⋮
It is located at the top right.

Step 3. Tap Settings

Step 4. Tap Chat

Step 5. Tap Chat History

Step 6. Tap Clear All Chats to remove messages contained in all device conversations
Select this option if you want to keep your chat history and only delete messages, so they don't take up too much memory space

Step 7. Tap the ← key
It is located in the upper left. At this point you will have deleted all WhatsApp messages from your Android device.
Method 3 of 3: Desktop

Step 1. Open WhatsApp

Step 2. Click on a chat

Step 3. Click on the v button
It is located at the top right.

Step 4. Click Clear Messages to remove the messages contained in the selected conversation

Step 5. Click Clear Chat to remove the selected conversation's messages from your computer

Step 6. Click Done
At this point you will have deleted all the messages of the conversation.