Skip to content

[WebJs] - Inconsistent message ID format for group messages sent via API #1464

@rafaheringer

Description

@rafaheringer

Describe the bug

Apparently, there’s an inconsistency in how message IDs are handled in a very specific scenario involving sending messages to groups.
Events triggered through the Webhook for any group message — regardless of type — contain the following ID pattern:

(...)
"id": {
    "_serialized": "[email protected][email protected]"
  },
(...)

However, when checking the payload returned by the SendMessage method of the WAHA API, we receive the following pattern.
Notice that it does not contain the last fragment, which would normally be the sender’s ID:

(...)
"id": {
    "fromMe": true,
    "remote": "[email protected]",
    "id": "3EB091474C1CE5341E8F3F",
    "_serialized": "[email protected]_3EB091474C1CE5341E8F3F"
  },
(...)

In this situation, all subsequent ACK events from group participants triggered via Webhook contain the full ID — meaning the last fragment with the sender’s ID is appended. However, this ID is invalid.
We can easily confirm this by trying to fetch the message via the API.
See the following message.ack event payload. Note the serialized ID containing the sender fragment:

{
    "id": "evt_01k6zvfrkz58gdm8d5tbjq8abd",
    "timestamp": 1759858123392,
    "event": "message.ack",
    "session": "773e604b-73b3-467a-a190-9a9a453920d4",
    "metadata": {},
    "me": {
        "id": "[email protected]",
        "pushName": "Rafael Heringer"
    },
    "payload": {
        "id": "[email protected][email protected]",
        "from": "[email protected]",
        "to": "[email protected]",
        "participant": "171567317258406@lid",
        "fromMe": false,
        "ack": 1,
(...)

If I try to look up this ID via the messages endpoint:
GET /api/{session}/chats/[email protected]/messages/[email protected][email protected]

{
  "message": "Message not found",
  "error": "Not Found",
  "statusCode": 404
}

But if I manually remove the last fragment:
GET /api/{session}/chats/[email protected]/messages/[email protected]_3EB091474C1CE5341E8F3F

{
  "id": "[email protected]_3EB091474C1CE5341E8F3F",
  "timestamp": 1759858122,
  "from": "[email protected]",
  "fromMe": true,
(...)

Version

{
    "version": "2025.9.1",
    "engine": "WEBJS",
    "tier": "PLUS",
    "browser": "/usr/bin/google-chrome-stable"
  }

Steps

To Reproduce Steps to reproduce the behavior:

  1. With WAHA running, send a simple new message to a WhatsApp group using the /api/sendText route.
  2. Take note of the response payload, especially the id property.
  3. Inspect message.ack events and compare their id property.

Expected behavior

The ID returned in ACK events should match the actual message ID stored and returned by WAHA.
In this scenario, where the message was sent via the API, the ID should be returned without the last fragment.
Alternatively, WAHA could normalize the API response so that IDs always include the last fragment consistently.

I’m not entirely sure how this behaves for other event types (e.g., message.reaction, etc.).

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions