WhatsApp-Web.js stop sending files. Any image, document, audio, any file at all has not been sent any longer. WhatsApp Web may change the way to send files.
Text is sending normally.
Steps to reproduce the behavior:
High priority problem!
Same problem here.
It's look like an Intermittent problem. I tried to send 10 images. The first was sent, but the others 4 was not. Them, the 5 has been sent. Some times the send image works, some times don't. It's necessary to verify what has changed. It's not sending images, documents, audios any longer. Now only send text is working.
Same problem..
hmm, I'm not sure, because I can still send media
"wa_version":"2.20.198.15" => Working fine!
"wa_version":"2.20.201.13" => Causing problems.
The WhatsApp Web changed version from 2.20.198.15 to 2.20.201.13. In the new version, has problems. Right now, it's look like they downgrade the version, and in the old version is sending normally.
i use "wa_version":"2.20.201.23"
Sorry, the version I get was from APP in phone. It has nothing to do with the problem. Right now, I read the QR again and got backup do work fine. The problem was with the json session keys. Kill the session file to be recreated again.
A new version of WhatsApp Web was released last night that seems to have introduced a new change with this functionality.
Some users on Discord reported fixing the issue by just setting a filename when sending media. (media.filename=“name”). Please try this out and let me know if it fixes the issue for you. If this is it, I’ll probably just automatically assign a filename if it’s not specified.
Pedro, I send files using the path.
//Send Image
(async () => {
try
{
if(send_from_file)
{
const b64data = FS.readFileSync(DOCS_PATH+"/"+send_from_file, {encoding: 'base64'});
const mimetype = MIME.getType(DOCS_PATH+"/"+send_from_file);
const filename = PATH.basename(DOCS_PATH+"/"+send_from_file);
send_media = new MessageMedia(mimetype, b64data, filename);
}
else
{
send_media = new MessageMedia(send_mimetype, send_data, send_filename);
}
const is_reg_user = await CLIENT.isRegisteredUser(send_to);
if(is_reg_user)
{
const sent_msg = await CLIENT.sendMessage(send_to, send_media, {"caption":send_caption});
var sent_msg_id = sent_msg.id.id;
var sent_msg_mediakey = sent_msg.mediaKey;
var sent_msg_ack = sent_msg.ack;
var sent_msg_timestamp = sent_msg.timestamp;
var _TXT = "[SEND_IMAGE SENT]:\n" +
" token => "+token+"\n" +
" number => "+send_to+"\n" +
" sent_msg_id => "+sent_msg_id+"\n" +
" sent_msg_ack => "+sent_msg_ack+"\n" +
"sent_msg_timestamp => "+sent_msg_timestamp+"\n" +
" sent_msg_mediakey => "+sent_msg_mediakey+"\n" +
"\n";
console_log(_TXT);
log_info(_TXT);
}
else
{
var _TXT = "[SEND_IMAGE - ERRO]:\n" +
" token => "+token+"\n" +
"number => "+send_to+"\n" +
"status => 0\n" +
" msg => Not a registered user\n" +
"\n";
console_log(_TXT);
log_info(_TXT);
}
}
catch(err)
{
var _TXT = "[SEND_IMAGE - ERRO2]:\n" +
" token => "+token+"\n" +
"number => "+send_to+"\n" +
"status => 0\n" +
" msg => ERROR: "+JSON.stringify(err)+"\n" +
"\n";
console_log(_TXT);
log_info(_TXT);
}
})();
The filename is aways passed out to the client.
The error returns in the [SEND_IMAGE - ERRO2], error in the catch(err).
Where are you suggesting to include the filename? injected.js ?
It has something to do with messageMedia structure. The structure has changed. Can you see how the new structure looks like now?
Only return ERROR: {}. nothing more.
I believe I found the issue. Please test #391 if you can @rlgomide
ok, a moment plase...
@pedroslopez I test the #391 and now is sending just fine! Sending images, documents and audios normally. You nailled it!!
i thought whatsapp itself will be made a major change on their site
Thanks for reporting and testing! The fix has now been released as of v1.10.0.
i thought whatsapp itself will be made a major change on their site
WhatsApp made an internal change that impacted this functionality. A patch was needed in the library for sending media to continue working.
Most helpful comment
I believe I found the issue. Please test #391 if you can @rlgomide