fix: cannot send message on new Whatsapp Business limited accounts (#2080)

* fix: cannot send message on new Whatsapp Business limited accounts

* chore: add woraround to resend the message on 475 errors

* fix: lint

* fix: add handler

* fix: lint

* Update src/Socket/messages-send.ts

---------

Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
This commit is contained in:
Cassio Santos
2025-11-19 10:18:19 -03:00
committed by GitHub
parent 0145e4c710
commit 5c456e514e
7 changed files with 67 additions and 3 deletions
+13
View File
@@ -929,6 +929,19 @@ export const makeMessagesSocket = (config: SocketConfig) => {
logger.debug({ jid }, 'adding device identity')
}
const contactTcTokenData =
!isGroup && !isRetryResend && !isStatus ? await authState.keys.get('contacts-tc-token', [destinationJid]) : {}
const tcTokenBuffer = contactTcTokenData[destinationJid]?.token
if (tcTokenBuffer) {
(stanza.content as BinaryNode[]).push({
tag: 'tctoken',
attrs: {},
content: tcTokenBuffer
})
}
if (additionalNodes && additionalNodes.length > 0) {
;(stanza.content as BinaryNode[]).push(...additionalNodes)
}