pedroslopez / whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app
https://wwebjs.dev
Apache License 2.0
15.53k stars 3.7k forks source link

Dont send img to group #2172

Closed scadaway closed 11 months ago

scadaway commented 1 year ago

Is there an existing issue for this?

Describe the bug

I have been using the library for 6 months to send images to my groups and it has worked correctly. Since 2 days ago, my bot simply stopped posting images in the groups Sending texts has no problem. The problem occurs only when sending images. I have not modified my code in the last months. The problem just happened. The logs do not indicate any problem. Shows that the script was executed correctly.

Expected behavior

I make a call to a nodejs service, which executes a method to which I send the path of the image. and the method using the library does the sending.

Steps to Reproduce the Bug or Issue

  1. call client.sendMessage
  2. put chat id and img path
  3. no error
  4. no piture sent

Relevant Code

app.post('/send_group_media', (req, res) => { console.log(req.body); console.log("send group"); console.log("send group con imagen")

    const media = MessageMedia.fromFilePath(req.body.img);
    console.log(media);
    client.sendMessage(req.body.chat_id, media)
    .then(result => res.status(200).send(result))
    .catch(err => res.status(500).send(err));

})

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

No, I am not using Multi Device

Environment

ubuntu 18 whatsapp-web.js version 1.19.4 node 19.5.0

Additional context

No response

HiramNeto commented 1 year ago

I have just tried and it is working as expected... If I were you I would check the part of your code where you define the media const (const media = MessageMedia.fromFilePath(req.body.img);), because everything else is more or less the same as I do...