Skip to content

chat.deleteMessage route doesnt really work #22

Open

Description

@Neup123

Welcome!

  • Yes, I have searched for similar issues on GitHub and found none.

What did you do?

used via n8n nodes in chat.deleteMessage with contact number as @lid as @s.whatsapp.net, and the message id, in group and in private.

What did you expect?

the message to be deleted

What did you observe instead of what you expected?

i recived 200 ok, and pending, but nothing has deleted.

Screenshots/Videos

No response

Which version of the API are you using?

last one

What is your environment?

Docker

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

i need you to check upstream and in baileys to see if it's there or somthing you can fix in this fork code

Activity

  1. Neup123 commented on Sep 19, 2026

    @Neup123
    OwnerAuthor

    Validated two concrete problems in the current delete path:

    1. After Baileys accepts the delete request, the local DB update searches using the protocol response message ID instead of the original message ID being deleted. That can return success while leaving the local message state unchanged.
    2. The API schema does not carry all alternate PN/LID and group-participant key fields needed to preserve the original WhatsApp key.

    The prepared isolated-branch fix preserves the full original key, looks up the original deleted message ID, scopes the lookup to the current instance, and adds regression coverage for direct LID and group-participant keys. This does not prove WhatsApp deleted the remote message until tested against a connected instance, so the issue should remain open until that live check passes. main is untouched.

  2. added a commit that references this issue on Sep 19, 2026
  3. Neup123 commented on Sep 21, 2026

    @Neup123
    OwnerAuthor

    The identified backend and n8n defects are fixed and released: deletion now carries the complete original message key and looks up the original deleted message ID within the current instance; n8n v4.3.0 exposes the corresponding fields. I am intentionally leaving this issue open because a real connected-WhatsApp remote deletion has not been performed during release review—doing that without an explicitly designated disposable message would be destructive. Please retest against v5.3.0 + n8n nodes v4.3.0 and report the resulting delete response/event.

  4. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    New v5.4.0 group/LID reproduction reported from n8n:

    • route: chat.deleteMessage
    • group message
    • request includes the group remoteJid, original message id, and participant: "...@lid"
    • HTTP response remains 200 / PENDING, but WhatsApp does not remove the message
    • instance context: chabad-info

    Source review confirms the remaining gap: the route forwards only the key fields supplied by the caller. For a group message, Baileys needs the exact original key, including the participant namespace metadata (participantAlt and addressingMode) when WhatsApp supplied them. The archive/database already stores that complete original key, but the delete path does not hydrate omitted fields from it before calling Baileys. Preserving supplied fields is therefore insufficient for n8n callers that only have participant: @lid + message ID.

    I am preparing an isolated instinct/group-delete-lid fix that resolves the stored original key by instance + message ID before sending the delete stanza, while keeping request validation and instance scoping. Main is untouched. Remote deletion still needs an explicitly designated disposable live message for destructive acceptance testing.

  5. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    Fix pushed for review:

    The delete path now looks up the authoritative stored message key using current instance + original message ID + matching group/chat JID, then hydrates missing protocol fields before calling Baileys. This restores , , , and the original value when n8n supplies only the group JID, message ID, and an participant. The requested message ID is retained so hydration cannot redirect the deletion to another message.

    Regression coverage reproduces the partial group/LID request and verifies the complete stored key is reconstructed. Passed: message-key test, ESLint, TypeScript, and diff checks. No merge or live destructive deletion was performed.

  6. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    Correction to the preceding comment: shell formatting removed five inline field names. The hydrated fields are participantAlt, addressingMode, remoteJidAlt, and the original fromMe value; the partial n8n request includes an @lid participant. No code or validation result changed.

  7. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    Released fix evidence:

    The feature branch was deleted after the true merge. No force-push or squash/rebase was used. A destructive live group deletion was not run; final remote acceptance still needs an explicitly designated disposable message on v5.4.1.

  8. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    Corrective implementation is now in PR #31, with the companion n8n change in Neup123/n8n-nodes-evolution-api#16. Live execution evidence showed the most recent test was an incoming direct message; WhatsApp cannot revoke another person's direct message for everyone. The new route auto-detects ownership from the archived original key, selects admin revoke for another participant's group message, validates admin permission when group metadata resolves it, and rejects impossible direct-message revokes clearly. It also waits for Baileys acknowledgement across direct and group event channels before changing local state or emitting MESSAGES_DELETE. The n8n node defaults to Auto Detect and treats bare PENDING as an error. This issue stays open until CI, merge, image publication, and a designated live group-message acceptance test are complete.

  9. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    v5.4.2 and n8n nodes v4.3.1 are now released. Reopening only for the final designated live WhatsApp group-message acceptance test; the code, CI, merge, and release work is complete. Please test a disposable group message with Message Ownership = Auto Detect. A successful node result must include serverAcknowledged: true and status SERVER_ACK or stronger.

  10. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    Live follow-up clarified the required behavior: automatic deletion must choose the strongest permitted scope. Incoming direct messages from another person cannot be revoked for everyone, so the automatic route/node must fall back to Baileys delete-for-me and report that scope explicitly. The existing deleteMessageForEveryone route will remain strict for API compatibility. Implementation will also carry the original timestamp required by Baileys app-state deletion and distinguish EVERYONE acknowledgement from ME app-state acceptance.

  11. Neup123 commented on Sep 22, 2026

    @Neup123
    OwnerAuthor

    Released in Evolution API v5.4.3 via #32.

    The single existing Delete Message endpoint now chooses the maximum permitted scope automatically:

    • own message → delete for everyone
    • another participant's group message while this account is an admin → delete for everyone
    • another participant's direct message → delete for this account
    • another participant's group message without admin permission → delete for this account
    • unconfirmed revoke attempt → fall back to delete for this account

    Responses now identify scope, target, serverAcknowledged, appStatePatchAccepted, and any fallbackReason.

    The GHCR image is published as both ghcr.io/neup123/evolution-api:v5.4.3 and :latest, with matching registry digests.

    Keeping this issue open until a disposable live message confirms the direct-message and group-admin paths after deployment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions