wa-automate-nodejs
wa-automate-nodejs copied to clipboard
sendImageAsSticker() for mediaMessage.type Document results in Axios error code 550.
Are you using the latest version of the library?
- [X] I have checked and am using the latest version of the library.
What type of session are you experiencing this issue on?
Multi-device and I have set multiDevice to true in my config OR am using the --multi-device flag
What type of host account are you experiencing this issue on?
Business account
Mode
EASY API/CLI
Current Behavior
When the mediaMessage.type is a Document, attempting it to send as a sticker results in a error.
Error: [messageHandler.js] > sendImageAsSticker Axios: IMAGE_PROCESSING_ERROR: Image to composite must have same dimensions or smaller
Expected Behavior
Send the Document as a sticker, like it did in the past.
Steps To Reproduce
if (mediaMessage.type == 'image' || mediaMessage.type == 'video' || mediaMessage.type == 'sticker' || mediaMessage.type === 'document') {
try {
const decryptedMedia = await decryptMedia(mediaMessage) // || await decryptMedia(mediaMessage.id)
await sleep(100)
if (decryptedMedia) {
if (mediaMessage.type === 'image' || mediaMessage.type === 'sticker' || mediaMessage.type === 'document') { // || mediaMessage.type === 'document') {
let result
try {
const currentDate = new Date();
const day = currentDate.getDate().toString().padStart(2, '0'); // Get the day and pad with leading zero if needed
const month = (currentDate.getMonth() + 1).toString().padStart(2, '0'); // Get the month (months are zero-based) and pad with leading zero if needed
const year = currentDate.getFullYear().toString().slice(-2); //
const decryptedMediaString = decryptedMedia.toString('base64')
await sleep(100)
const imageb64 = `data:${await mediaMessage.mimetype};base64,${decryptedMediaString}`;
await sleep(100)
console.log(`Case 'sticker' > sendImageAsSticker(): Attempting to send sticker.`)
await sleep(100)
try {
result = await client.sendImageAsSticker(from, imageb64, { author: `🤖 Ameca ${day}/${month}/${year}`, circle: true, cornerRadius: 5, discord: '234717932175884288', keepScale: true, pack: `📱 www.tva-community.chat`, removebg: false });
} catch (error) {
console.error(error.response.data);
console.error(`[messageHandler.js] > sendImageAsSticker Axios: ${error.response.data}`);
}
} catch (error) {
errorLog(`[messageHandler.js] > sendImageAsSticker ${error} `)
console.error(`[messageHandler.js] > sendImageAsSticker ${error}`);
await client.sendReplyWithMentions(from, `[ERROR] > sendImageAsSticker:\n\n ${error.message}\n\n*Developer Debug-info*:\n*result:* ${result}\n*error:* ${error}`)
}
### create() code OR full CLI command + CONFIG
_No response_
### DEBUG INFO
```markdown
{
"WA_VERSION": "2.3000.1015663422",
"WA_AUTOMATE_VERSION": "4.71.15 UPDATE AVAILABLE: 4.72.0",
"BROWSER_VERSION": "Chrome/127.0.6533.100",
"START_TS": 1723655398771,
"RAM_INFO": "Total: 68.62 GB | Free: 53.93 GB",
"PPTR_VERSION": "19.11.1",
"LATEST_VERSION": false,
"CLI": false,
"PATCH_HASH": "CACHED-9530e",
"LAUNCH_TIME_MS": 8106,
"ACC_TYPE": "BUSINESS",
"chats": 20,
"messages": 87,
"contacts": 4708,
"isBiz": true,
"isMd": true,
"INSTANCE_ID": "16f18093-1914-42f5-9924-c0ffbb4e329d"
}
Environment
- OS: Windows 10
- Node: 20.16.0
- npm: 10.8.2
Screenshots/Logs
No response
Anything else?
This code worked perfectly in the past?