waha icon indicating copy to clipboard operation
waha copied to clipboard

[Feature Request] - Disable media download on webhook so we can process/download it later using Get Message By Id

Open eaglenest-zz opened this issue 9 months ago • 4 comments

Im trying not do have the messages medias download right away on the webhooks and only just when im asking the message details directly.

I have this configuration in place: .env WAHA_DOWNLOAD_MEDIA=false

WHATSAPP_FILES_MIMETYPES=mimetype/ignore-all-media

WAHA_MEDIA_STORAGE=NONE or LOCAL (tried both) WHATSAPP_FILES_LIFETIME=180 WHATSAPP_FILES_FOLDER=/app/.media

docker-compose.yaml

  • '/mnt/waha/media:/app/.media'

With GOWS plus on 2025.3.1 version. I have a particular webhook session created to event "message.any"

All the messages on the webhook continue to enter and responding with Media.Url on the json response payload. Im confirming on disk, on the /mnt/waha/media to have a directory there with the session and the medias inside it.

I was expecting that Media.Url to come null/empty. I was expecting that on disk not to see the files. I was expecting that on disk the files would be deleted after 180 seconds and they werent.

Best regards,

eaglenest-zz avatar Mar 17 '25 15:03 eaglenest-zz

Ok, another test:

WAHA_DOWNLOAD_MEDIA=false WHATSAPP_FILES_MIMETYPES=mimetype/ignore-all-media removed.

With this: WAHA_MEDIA_STORAGE=LOCAL WHATSAPP_FILES_LIFETIME=180 WHATSAPP_FILES_FOLDER=/app/.media

the engine started to clean up the medias on the directories after the 180 seconds

eaglenest-zz avatar Mar 17 '25 16:03 eaglenest-zz

Hi!

Not do have the messages medias download right away on the webhooks and only just when im asking the message details directly.

I don't think there's a way right now to do that.

If you set WHATSAPP_FILES_MIMETYPES or WHATSAPP_DOWNLOAD_MEDIA I believe it'll never download the media, even if you request Get Message By Id with downloadMedia=True later.

try setting only WHATSAPP_DOWNLOAD_MEDIA=false (no WHATSAPP_FILES_MIMETYPES required)

Just tested it, works fine, in logs you can find

The message 'AAAAA' has 'image/jpeg' mimetype media, skip it.

the message.any payload will have hasMedia: true flag, but with no media.url in it

patron:PRO

devlikepro avatar Mar 18 '25 01:03 devlikepro

We wouldn't recommend postponing the media processing. But we could add the flag WAHA_EVENTS_NO_MEDIA for that case, why not. I've converted the issue to a feature request.


Let's see how many patron:PLUS and patron:PRO supporters needs the feature and prioritize it based on that. Hit +1 in the comments if you need it!

devlikepro avatar Mar 18 '25 02:03 devlikepro

+1

Khosravangroup avatar Apr 21 '25 14:04 Khosravangroup