That will have new mimetype "image/webp" and new message type:
OUTWARD_TYPES.STICKER || (e.mimetype = "image/webp")
MSG_TYPE: {
NOTIFICATION: "notification",
NOTIFICATION_TEMPLATE: "notification_template",
GROUP_NOTIFICATION: "group_notification",
GP2: "gp2",
BROADCAST_NOTIFICATION: "broadcast_notification",
E2E_NOTIFICATION: "e2e_notification",
CALL_LOG: "call_log",
PROTOCOL: "protocol",
CHAT: "chat",
LOCATION: "location",
PAYMENT: "payment",
VCARD: "vcard",
CIPHERTEXT: "ciphertext",
MULTI_VCARD: "multi_vcard",
REVOKED: "revoked",
IMAGE: "image",
VIDEO: "video",
AUDIO: "audio",
PTT: "ptt",
STICKER: "sticker",
DOCUMENT: "document",
UNKNOWN: "unknown"
}
Hi,
Any idea how to send stickers to others users?
How to select and send the stickers?
Any example will be appreciate
Regards
hi marcelocecin,
Also I 'm follow this project but I've not found how to send an sticker, only I found the new message's type.
I know that the image must be PNG 512x512 with transparent background and the image must be converted to webp format (similar to telegram stickers)
Do you know if the webp image could be send using send media function?
Regards
Stickers must be either in PNG or the WebP format. Currently, animated WebP, animated PNG, or animated stickers of any kind are not supported. See the section Converting to WebP below for information on how to create WebP files.
Buddy, I have no idea of what you mean with all those random links that only makes sense to you, are you just trying to advertise another repo?
hey @lfdelphino this repo already implemented the stickers class at whalesong/managers/message.py
After a long series of trial and errors, I've successfully been able to send a custom sticker from Whatsapp Web. The caveat is that you need to know some of the custom sticker's info (like clientUrl, filehash, etc). It's a huge hack and is not guaranteed to work in the future. (@marcelocecin 's repo helped a bit).
window.WAPI.sendSticker = function ({sticker, chatid, quotedMsgId}, done) {
var idUser = new window.Store.UserConstructor(chatid, { intentionallyUsePrivateConstructor: true });
// create new chat
return Store.Chat.find(idUser).then(async (chat) => {
//var mediaBlob = window.WAPI.base64ImageToFile(sticker.data, 'file.webp');
// Since Whatsapp Web doesn't really support sending custom stickers, we have to trick it by using one
// of the built-in sticker objects and changing some of the properties before we send it.
let prIdx = Store.StickerPack.pageWithIndex(0);
await Store.StickerPack.fetchAt(0);
if (Store.StickerPack._models.length == 0) {
console.log('Could not fetch any sticker packs.');
if (done !== undefined) done(false);
return;
}
await Store.StickerPack._pageFetchPromises[prIdx];
await Store.StickerPack._models[0].stickers.fetch();
if (Store.StickerPack._models[0].stickers._models.length == 0) {
console.log('Could not fetch any stickers in the first pack.');
if (done !== undefined) done(false);
return;
}
let stick = Store.StickerPack._models[0].stickers._models[0];
stick.__x_clientUrl = sticker.url;
stick.__x_filehash = sticker.filehash;
stick.__x_uploadhash = sticker.uploadhash;
stick.__x_mediaKey = sticker.mediaKey;
//stick.__x__mediaObject.filehash = sticker.filehash;
//stick.__x__mediaObject.mediaBlob._blob = mediaBlob;
//stick.__x__mediaObject.size = mediaBlob.size;
await stick.initialize();
stick.sendToChat(chat);
if (done !== undefined) done(true);
});
}
Not sure why the formatting is screwing up there. Here's my repo: https://github.com/gfaraj/super-bot
Not sure why the formatting is screwing up there.
Really? Can't believe you can code but not to diferentiate "quote" button and "code" button :-)
window.WAPI.sendSticker = function({
sticker,
chatid,
quotedMsgId
}, done) {
var idUser = new window.Store.UserConstructor(chatid, {
intentionallyUsePrivateConstructor: true
});
// create new chat
return Store.Chat.find(idUser).then(async (chat) => {
//var mediaBlob = window.WAPI.base64ImageToFile(sticker.data, 'file.webp');
// Since Whatsapp Web doesn't really support sending custom stickers, we have to trick it by using one
// of the built-in sticker objects and changing some of the properties before we send it.
let prIdx = Store.StickerPack.pageWithIndex(0);
await Store.StickerPack.fetchAt(0);
if (Store.StickerPack._models.length == 0) {
console.log('Could not fetch any sticker packs.');
if (done !== undefined) done(false);
return;
}
await Store.StickerPack._pageFetchPromises[prIdx];
await Store.StickerPack._models[0].stickers.fetch();
if (Store.StickerPack._models[0].stickers._models.length == 0) {
console.log('Could not fetch any stickers in the first pack.');
if (done !== undefined) done(false);
return;
}
let stick = Store.StickerPack._models[0].stickers._models[0];
stick.__x_clientUrl = sticker.url;
stick.__x_filehash = sticker.filehash;
stick.__x_uploadhash = sticker.uploadhash;
stick.__x_mediaKey = sticker.mediaKey;
//stick.__x__mediaObject.filehash = sticker.filehash;
//stick.__x__mediaObject.mediaBlob._blob = mediaBlob;
//stick.__x__mediaObject.size = mediaBlob.size;
await stick.initialize();
stick.sendToChat(chat);
if (done !== undefined) done(true);
});
}
Most helpful comment
Not sure why the formatting is screwing up there. Here's my repo: https://github.com/gfaraj/super-bot