Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Widget Works Modification

* [WIDGET-WORKS] Silence "Parent message not found" warnings during history sync to prevent CPU overload and subsequent 401 disconnects.
* [WIDGET-WORKS] Patch Baileys to filter sender's own devices from senderKeyJids in LID group messages (fixes "not-acceptable" error preventing group message sends).
* [WIDGET-WORKS] Fix `PrismaClientValidationError` in `messages.update` (missing `Message` relation) by guarding `messageUpdate.create` calls.
* [WIDGET-WORKS] Guard `messages.update` cache cleanup with a derived key and optional `MESSAGE_UPDATE_CACHE_DELETE_DISABLED` flag to prevent cache.delete crash-loops.
* [WIDGET-WORKS] Save messages before Chatwoot sync in `/message/sendText` to avoid missing `chatwootMessageId` and log async sync failures.
Expand Down
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM node:20-alpine AS builder

RUN apk update && \
apk add --no-cache git ffmpeg wget curl bash openssl
apk add --no-cache git ffmpeg wget curl bash openssl patch

LABEL version="2.3.2" description="Api to control whatsapp features through http requests."
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
Expand All @@ -15,6 +15,10 @@ COPY ./tsup.config.ts ./

RUN npm ci --silent

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

COPY ./src ./src
COPY ./public ./public
COPY ./prisma ./prisma
Expand Down
22 changes: 22 additions & 0 deletions patches/baileys+6.7.19+lid-group-send.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/node_modules/baileys/lib/Socket/messages-send.js b/node_modules/baileys/lib/Socket/messages-send.js
index 1234567..abcdefg 100644
--- a/node_modules/baileys/lib/Socket/messages-send.js
+++ b/node_modules/baileys/lib/Socket/messages-send.js
@@ -360,8 +360,14 @@ export const makeMessagesSocket = (config) => {
meId
});
const senderKeyJids = [];
- // ensure a connection is established with every device
+ // [WIDGET-WORKS] Filter sender's own devices from senderKeyJids (LID group send fix)
+ // Same pattern as non-group path (line ~396) - fixes "not-acceptable" error
+ const { user: meUser } = jidDecode(meId);
+ const meLid = authState.creds?.me?.lid?.split(':')[0]?.split('@')[0];
+ // ensure a connection is established with every device
for (const { user, device } of devices) {
+ // [WIDGET-WORKS] Skip sender's own devices
+ if (user === meUser || user === meLid) {
+ continue;
+ }
const jid = jidEncode(user, groupData?.addressingMode === 'lid' ? 'lid' : 's.whatsapp.net', device);
if (!senderKeyMap[jid] || !!participant) {
senderKeyJids.push(jid);