Closed tsapap closed 4 years ago
@stefano71 please fill out the template more thoroughly. I've just tested it and it is working ok so I will need more info for reproduction
I'm not getting any error messages. the wapi.sendimage function after I cleared the chrome cache doesn't work
@smashah I'm also getting the same problem, sendImage function is not working. After debugging the sendImage code then I've found out that this line is crashing
var mc = new Store.MediaCollection()
I've tried on both macosx and linux, tried also on sulla-hotfix 1.5.x and 1.6.10, all have the same behaviour.
this is the error message that has now occurred in the chrome console
error message WAPI.sendImage
error message WAPI.sendImage
Search for all occurrences of mediaCollection and replace:
var mc = new Store.MediaCollection();
to
var mc = new Store.MediaCollection(chat);
Can you all share you whatsapp version please.
In the console in the browser run window.Debug.VERSION
with this change it works Search for all occurrences of mediaCollection and replace: var mc = new Store.MediaCollection(); to var mc = new Store.MediaCollection(chat);
thanks
@stefano71 @nicolaubrasil As it seems to work for you, I'll implement this now
Should be live in v1.6.11
Closing this for now. Please reopen if it happens again
The problem really came back, with the last modification above.
I tried now and the image was not send.
@smashah Debug Info { WA_VERSION: '0.4.930', PAGE_UA: 'WhatsApp/0.4.613 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', SULLA_HOTFIX_VERSION: '1.7.24', BROWSER_VERSION: 'HeadlessChrome/79.0.3945.0' }
@haroldorodsilva @duzaq new version of WhatsApp :/
change this
{ id: "MediaCollection", conditions: (module) => (module.default && module.default.prototype && module.default.prototype.processFiles !== undefined) ? module.default : null },
mc.processFiles([mediaBlob], chat, 1).then(() => {
var media = mc.models[0];
media.sendToChat(chat, { caption: caption });
if (done !== undefined) done(true);
});
to this
{ id: "MediaCollection", conditions: (module) => (module.default && module.default.prototype && module.default.prototype.processAttachments) ? module.default : null },
if (Debug.VERSION === '0.4.613') {
mc.processAttachments([mediaBlob], chat, 1).then(() => {
var media = mc.models[0];
media.sendToChat(chat, {caption: caption});
if (done !== undefined) done(true);
});
} else {
mc.processAttachments([{file: mediaBlob}], chat, 1).then(() => {
var media = mc.models[0];
media.sendToChat(chat, {caption: caption});
if (done !== undefined) done(true);
});
}
send image not work
@gildastema @marcelocecin @haroldorodsilva @duzaq Fix is live in v.1.7.25
I've tested it here and it's working. Please report back ASAP if it is/is not working for you.
Thanks
I have the same problem too on mac while on windows it works could it depend on the user agent? it is strange that on chrome mac whatsapp web responds differently
@stefano71 did you try latest version 1.7.25? Also please share your debug info on both systems for context
i was wrong by clearing the chrome cache on windows i get the same mac error
VM1223:1442 Uncaught TypeError: Cannot read property 'createWid' of undefined
at Object.window.WAPI.sendImage (
has anyone solved it?
@stefano71 did you try latest version 1.7.25? Also please share your debug info on both systems for context
yes
@stefano71 this appears to be a seperate problem if it is still happnening then please make a new issue. Closing this for now.
with your wapi.js I can't send images i tried this and it works even if it also sends to wrong numbers.
please attach print with the error
unfortunately I get this error
VM2223:1458 Uncaught TypeError: Cannot read property 'createWid' of undefined
at Object.window.WAPI.sendImage (
@stefano71 please clear your console history
It works well only the control of sending the file on the wrong phone number is missing. unfortunately the file is also sent to non-existent numbers
now if the number is wrong the file is not sent please you can check if everything is correct
window.WAPI.sendImage = function(imgBase64, chatid, filename, caption, done) {
try {
//alert 'WhatsApp';
window.getContact = chatid => {
return Store.WapQuery.queryExist(chatid);
//alert 'WhatsApp';
};
window.getContact(chatid).then(contact => {
if (contact.status === 404) {
//alert 'WhatsApp Error';
done(true);
} else {
Store.Chat.find(contact.jid)
.then(chat => {
//chat.sendMessage(message);
//alert("1");
//var idUser = new window.Store.UserConstructor(chatid);
var idUser = new window.Store.UserConstructor(chatid, {
intentionallyUsePrivateConstructor: true
});
// create new chat
return Store.Chat.find(idUser).then(chat => {
var mediaBlob = window.WAPI.base64ImageToFile(imgBase64, filename);
var mc = new Store.MediaCollection(chat);
mc.processAttachments([{ file: mediaBlob }, 1], chat, 1).then(() => {
var media = mc.models[0];
media.sendToChat(chat, { caption: caption });
if (done !== undefined) done(true);
});
});
////alert 'WhatsApp';
return true;
})
.catch(reject => {
if (WAPI.sendMessage(chatid, message)) {
//alert("2");
} else {
//alert("3");
}
});
}
});
} catch (e) {
if (window.Store.Chat.length === 0) {
//alert 'WhatsApp';
return false};
firstChat = Store.Chat.models[0];
var originalID = firstChat.chatid;
firstChat.chatid =
typeof originalID === "string"
? chatid
: new window.Store.UserConstructor(chatid, {
intentionallyUsePrivateConstructor: true
});
if (done !== undefined) {
firstChat.sendMessage(message).then(function() {
firstChat.chatid = originalID;
done(true);
});
//alert 'WhatsApp';
return true;
} else {
//firstChat.sendMessage(message);
//firstChat.id = originalID;
//var idUser = new window.Store.UserConstructor(chatid);
var idUser = new window.Store.UserConstructor(chatid, {
intentionallyUsePrivateConstructor: true
});
// create new chat
return Store.Chat.find(idUser).then(chat => {
var mediaBlob = window.WAPI.base64ImageToFile(imgBase64, filename);
var mc = new Store.MediaCollection(chat);
mc.processAttachments([{ file: mediaBlob }, 1], chat, 1).then(() => {
var media = mc.models[0];
media.sendToChat(chat, { caption: caption });
if (done !== undefined) done(true);
});
});
//alert 'WhatsApp';
return true;
}
} if (done !== undefined) done(false); return false; };
Describe the bug Today 29-01-2020 I realized that Send Images no longer works Do you have any idea ?
To Reproduce Steps to reproduce the behavior:
Expected behavior A clear and concise description of what you expected to happen.
sulla-hotfix version Which sulla-hotfix version
Whatsapp version Go to console in the chromium/chrome instance and type
window.Debug.VERSION
Screenshots If applicable, add screenshots to help explain your problem. Use
headless: false
to get screenshotsHost (please complete the following information):
Additional context Add any other context about the problem here.