Skip to content

Guidance on supporting interoperability with the Cloud API Coexistence. #1686

Description

@noeroelama

Describe the bug

When running a Baileys client on the same WhatsApp number that is also active with the WhatsApp Business Cloud API (coexistence setup), the Baileys client fails to decrypt incoming messages. Messages appear on the recipient's end as "Waiting for this message...", and the Baileys client logs show a messageStubType: 2 with "Message absent from node". This indicates a session or decryption failure, likely because the Cloud API is interfering with the E2EE session required by the Baileys client.

To Reproduce

Steps to reproduce the behavior:

  1. Take a WhatsApp number and connect it to the WhatsApp Business Cloud API.
  2. In parallel, connect a Baileys client (latest version) to the same WhatsApp number, using multi-device credentials.
  3. From a third, separate WhatsApp account, send a message to the number being used by both the Cloud API and Baileys.
  4. Observe the messages.upsert event logs on the Baileys client. The client will receive a message stub indicating it cannot be decrypted.

Expected behavior

The Baileys client should be able to receive and correctly decrypt the incoming message, showing the full message content, just as it would if the Cloud API Coexistence were not active on the same number.

Logs

Here is a comparison of the messages.upsert payload received by Baileys in two scenarios:

1. With Cloud API Coexistence (Resulting in an error):
The payload is missing the critical messageContextInfo and deviceListMetadata.

{
  "messages": [
    {
      "key": {
        "remoteJid": "62819XXXXXX@s.whatsapp.net",
        "fromMe": false,
        "id": "C3A2496BA6A89422A58BC8E1A5387C8B"
      },
      "message": {
        "conversation": "Desune"
      },
      "messageTimestamp": "1754719518"
    }
  ],
  "type": "notify"
}

Note: This is often preceded or followed by a messageStubType: 2 ("Message absent from node") error.

2. Without Cloud API Coexistence (Working correctly):
The payload contains the complete messageContextInfo required for decryption.

{
  "messages": [
    {
      "key": {
        "remoteJid": "xxxxxxxxxx@lid",
        "fromMe": false,
        "id": "C24C4F9CE8041DC2028269E0614BF8DF",
        "senderPn": "62819XXXXXX@s.whatsapp.net"
      },
      "messageTimestamp": 1754719439,
      "pushName": "{pushNameHere}",
      "message": {
        "conversation": "Desune",
        "messageContextInfo": {
          "deviceListMetadata": {
            "senderKeyHash": "isIxc8iz67qe8w==",
            "senderTimestamp": "1754708809",
            "recipientKeyHash": "WwDVBFrO5JCjcw==",
            "recipientTimestamp": "1754191425"
          },
          "deviceListMetadataVersion": 2
        }
      }
    }
  ],
  "type": "notify"
}

Environment (please complete the following information):

  • Is this on a server? Yes.
  • Do you have multiple clients on the same IP? [Yes]
  • Are you using a proxy? [No]
  • Baileys Version: 6.7.18
  • Node.js Version: v22.14.0

Additional context

The core issue appears to be that when the WhatsApp Cloud API Coexistence is active, it strips the low-level deviceListMetadata from the message payload that is forwarded to other connected devices (like Baileys). Without this metadata, the Baileys client cannot participate in the end-to-end encryption chain and fails to decrypt the message. This confirms that running Baileys and the Cloud API Coexistence on the same number is architecturally incompatible. Is there any known workaround from the library's side to handle this specific coexistence scenario?

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions