Skip to content

Conversation

@wahyuwidgetworks
Copy link

Problem

Instances cannot send messages to LID-addressed groups. WhatsApp rejects with not-acceptable error. Root Cause: Baileys v6.7.19 includes sender's own devices in senderKeyJids when sending group messages, but WhatsApp's server rejects sender keys being sent to the sender itself.

Evidence

{
"senderKeyJids": [
"219232478433331:30@s.whatsapp.net", // Admin ✅
"22033668821180@s.whatsapp.net", // SENDER ❌
"22033668821180:87@s.whatsapp.net", // SENDER devices ❌
"22033668821180:95@s.whatsapp.net", // SENDER devices ❌
"22033668821180:98@s.whatsapp.net" // SENDER devices ❌
]
}

Solution

Patch Baileys to filter sender's own devices from senderKeyJids, following the same pattern used for non-group messages (lines ~396). Changes:

  • patches/baileys+6.7.19+lid-group-send.patch - Patch file
  • Dockerfile - Apply patch after npm ci
  • node_modules/baileys/lib/Socket/messages-send.js:363-380 - Filter logic

Testing Plan

✅ Deploy to staging
✅ Send message to LID group from Prospek
✅ Verify message received in WhatsApp
✅ Check logs: senderKeyJids should NOT include sender's LID
✅ Deploy to production

Upstream Status

Baileys v6.7.19 includes sender's own devices in senderKeyJids when
sending to LID-addressed groups, causing WhatsApp to reject with
'not-acceptable' error.

This patch filters sender's own devices from the senderKeyJids list
before sending group messages, following the same pattern Baileys
uses for non-group messages (meJids vs otherJids filtering).

Changes:
- Add Baileys patch in patches/baileys+6.7.19+lid-group-send.patch
- Update Dockerfile to apply patch after npm ci
- Extract meUser from meId and meLid from authState.creds
- Skip sender's own devices in senderKeyJids loop

Fixes: #issue-number
Related: WhiskeySockets/Baileys#1690, EvolutionAPI#1768
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Dockerfile Outdated
Comment on lines 18 to 20
# [WIDGET-WORKS] Apply Baileys patch for LID group send fix
COPY ./patches ./patches
RUN patch -p0 < patches/baileys+6.7.19+lid-group-send.patch || echo "Patch already applied or failed"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Ensure patch command exists before applying Baileys fix

In the Docker build (node:20-alpine) we add RUN patch -p0 < patches/baileys+6.7.19+lid-group-send.patch || echo "Patch already applied or failed", but the base layer only installs git/ffmpeg/wget/curl/bash/openssl and does not provide the patch binary. On Alpine, patch is not present by default, so this step will simply print an error and continue because of the || echo, leaving the Baileys LID group fix unapplied. Images built from this Dockerfile will still fail to send to LID groups despite the new patch.

Useful? React with 👍 / 👎.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codex fixed, please rereview

…tion

Alpine Linux does not include 'patch' by default. Without this,
the Baileys LID group send patch would silently fail during build,
leaving the fix unapplied in production images.

Changes:
- Add 'patch' to apk install list
- Remove '|| echo' fallback to fail fast on patch errors
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Dockerfile Outdated

# [WIDGET-WORKS] Apply Baileys patch for LID group send fix
COPY ./patches ./patches
RUN patch -p0 < patches/baileys+6.7.19+lid-group-send.patch

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Docker patch command uses wrong strip level

The new patch step invokes patch -p0 < patches/baileys+6.7.19+lid-group-send.patch, but the patch file itself uses the standard a/... and b/... prefixes (--- a/node_modules/..., +++ b/node_modules/..., see lines 1-4 in the added patch). With -p0, patch looks for a file named a/node_modules/baileys/lib/Socket/messages-send.js, which does not exist in the image, so every Docker build will fail when applying the patch. The command needs to strip the leading path component (e.g., -p1) or the patch paths must drop the a//b/ prefixes.

Useful? React with 👍 / 👎.

@wahyuwidgetworks
Copy link
Author

@codex please review again

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wahyuwidgetworks wahyuwidgetworks merged commit b555f45 into production-v2.3.2 Dec 11, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants