wppconnect-team / wppconnect

WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination
https://wppconnect.io
Other
1.92k stars 339 forks source link

sendMessage Error: wid error: invalid wid #2136

Open vitorvk2 opened 7 months ago

vitorvk2 commented 7 months ago

Discussed in https://github.com/wppconnect-team/wppconnect/discussions/2132

Originally posted by **vitorvk2** April 5, 2024 Olá, pessoal. Versões: ``` wppconnect-team/wppconnect: "1.30.1" wppconnect/wa-j": "3.1.0" whatsappVersion: '2.3000.1012412383-alpha' ``` Após encaminhar algumas mensagens estou recebendo o seguinte erro: `messageFormat: 'wid error: invalid wid',` Verificando mais a fundo, vi que o erro começou a acontecer sozinho. Isso aparece apenas nas mensagens do que contem no chatId um '+', exemplo: `chatId: '+559891511313@c.us'` O engraçado é que o chatId é preenchido e retornado automaticamente pela Lib. Podem ajudar na análise? Segue um exemplo do objeto retornado: ``` anyMessageQueueName webhook onAnyMessage { id: 'true_+559891511313@c.us_3EB02F561FDDBF2CC6B967', viewed: false, body: 'seria mais uma tosse alérgica? ', type: 'chat', subtype: null, t: 1712188792, from: '559888631023@c.us', to: '559891511313@c.us', ack: 0, isNewMsg: true, star: false, kicNotified: false, isFromTemplate: false, pollInvalidated: false, isSentCagPollCreation: false, latestEditMsgKey: null, latestEditSenderTimestampMs: null, mentionedJidList: [], groupMentions: [], isEventCanceled: false, eventInvalidated: false, urlText: null, urlNumber: null, isVcardOverMmsDocument: false, isForwarded: false, hasReaction: false, productHeaderImageRejected: false, lastPlaybackProgress: 0, isDynamicReplyButtonsMsg: false, isCarouselCard: false, parentMsgId: null, isMdHistoryMsg: false, stickerSentTs: 0, isAvatar: false, lastUpdateFromServerTs: 0, invokedBotWid: null, bizBotType: null, botResponseTargetId: null, botPluginType: null, botPluginReferenceIndex: null, botPluginSearchProvider: null, botPluginSearchUrl: null, botPluginMaybeParent: false, botReelPluginThumbnailCdnUrl: null, botMsgBodyType: null, requiresDirectConnection: null, bizContentPlaceholderType: null, hostedBizEncStateMismatch: false, senderOrRecipientAccountTypeHosted: false, placeholderCreatedWhenAccountIsHosted: false, chatId: '+559891511313@c.us', fromMe: true, sender: { id: '559888631023@c.us', type: 'in', isBusiness: false, isEnterprise: false, isSmb: false, isContactSyncCompleted: 0, textStatusLastUpdateTime: -1, formattedName: 'Você', isMe: true, isMyContact: true, isPSA: false, isUser: true, isWAContact: true, profilePicThumbObj: null, msgs: null }, timestamp: 1712188792, content: 'seria mais uma tosse alérgica? ', isGroupMsg: false, mediaData: {}, } Successfully added message DEU ERRO - sendMessage Error: wid error: invalid wid at /usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:107:31 at step (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:49:23) at Object.next (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:30:53) at fulfilled (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/api/helpers/evaluate-and-return.js:21:58) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) JS Stack: Error: wid error: invalid wid at h (https://static.whatsapp.net/rsrc.php/v3/yH/r/xhAcgB6kDqz.js?_nc_x=Ij3Wp8lg5Kz:70:191) at new a (https://static.whatsapp.net/rsrc.php/v3i94h4/yf/l/makehaste_jhash/52iUjPF8dQ7.js?_nc_x=Ij3Wp8lg5Kz:212:1448) at k (https://static.whatsapp.net/rsrc.php/v3i94h4/yf/l/makehaste_jhash/52iUjPF8dQ7.js?_nc_x=Ij3Wp8lg5Kz:216:873) at Object.a [as createWidFromWidLike] (https://static.whatsapp.net/rsrc.php/v3i94h4/yf/l/makehaste_jhash/52iUjPF8dQ7.js?_nc_x=Ij3Wp8lg5Kz:216:1710) at a.from (https://static.whatsapp.net/rsrc.php/v3i94h4/yf/l/makehaste_jhash/52iUjPF8dQ7.js?_nc_x=Ij3Wp8lg5Kz:233:3575) at a.fromString (https://static.whatsapp.net/rsrc.php/v3i94h4/yf/l/makehaste_jhash/52iUjPF8dQ7.js?_nc_x=Ij3Wp8lg5Kz:233:3399) at /usr/src/app/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:143757 at Array.map () at t.getMessageById (/usr/src/app/node_modules/@wppconnect/wa-js/dist/wppconnect-wa.js:2:143740) at Object.e (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/lib/wapi/wapi.js:1:29646) at e.next () at Q (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/lib/wapi/wapi.js:1:29305) at a (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/lib/wapi/wapi.js:1:29892) at /usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/lib/wapi/wapi.js:1:29951 at new Promise () at Object.Z (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/lib/wapi/wapi.js:1:29832) at Object.X [as getMessageById] (/usr/src/app/node_modules/@wppconnect-team/wppconnect/dist/lib/wapi/wapi.js:1:29411) at pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:64:71 at step (pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:47:27) at Object.next (pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:28:57) at pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:22:75 at new Promise () at __awaiter (pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:18:16) at pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:56:56 at pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:68:36 at new Promise () at anonymous (pptr:evaluate;%2Fusr%2Fsrc%2Fapp%2Fnode_modules%2F%40wppconnect-team%2Fwppconnect%2Fdist%2Fapi%2Fhelpers%2Fevaluate-and-return.js%3A99%3A56:54:14) Function: function (_a) { return __awaiter(_this, [_a], void 0, function (_b) { var _c, _d, _e, _f; var messageId = _b.messageId; return __generator(this, function (_g) { switch (_g.label) { case 0: _d = (_c = JSON).parse; _f = (_e = JSON).stringify; return [4 /*yield*/, WAPI.getMessageById(messageId)]; case 1: return [2 /*return*/, _d.apply(_c, [_f.apply(_e, [_g.sent()])])]; } }); }); } { messageFormat: 'wid error: invalid wid', messageParams: [], taalOpcodes: [ 2 ] } ```
jhowbhz commented 7 months ago

Creio que voce está passando o numero com o +, tenta passar o numero direto. 5531999999999

se for um sendText('553199999', .....)

tipo assim

vitorvk2 commented 7 months ago

Obrigado por responder! Estou passando o número de telefone corretamente sem o '+'. É alguma coisa no wppconnect ou wpp, isto porque quando o chatId é retornado com o '+' sempre gera problema no envio de mensagens mesmo colocando o número corretamente.

renandecarlo commented 7 months ago

@vitorvk2 Da uma olhada se não é o "9" extra faltando no número. Tem número que registrou no wpp antes, e depois foi migrado pro "9", aí o wppconnect ou o wpp em si dá uma bugada na hora de identificar. Acho que todos precisam do "9" agora.

vitorvk2 commented 7 months ago

Agradeço pela resposta! Enquanto o número estava com problemas eu efetuei testes, um deles foi tentar encaminhar mensagem sem o '9' e com o '9'. Em ambos os casos não deu certo...

vitorvk2 commented 7 months ago

Já houve uma situação, inclusive, onde ao encaminhar mensagens para contatos que possuem o '9' também dar esse problema. Em meus testes percebi que isso é mais frequente depois que você acaba de conectar o celular via QRCode, mas não identifiquei o padrão porque é só alguns contatos onde isso ocorre.

tubedude commented 3 months ago

Eu tive esse problema quanto tentava pegar as mensagens api/{session}/all-messages-in-chat/{phone} de um grupo, mas passava erroneamente "isGroup": false.

devactivity-app[bot] commented 3 months ago

@tubedude, ⭐3 XP earned, 🏆First Comment Added completed! Contribute more to raise your XP/Level, complete challenges for extra achievements! [Sign up for personal dashboard]

icon