whatsapp-web.js icon indicating copy to clipboard operation
whatsapp-web.js copied to clipboard

Dont send img to group

Open scadaway opened this issue 1 year ago • 1 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

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

scadaway avatar Apr 26 '23 13:04 scadaway

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...

HiramNeto avatar Apr 27 '23 22:04 HiramNeto