devlikeapro / waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! Two engines: chromium-based WEBJS and pure-websocket NOWEB
https://waha.devlike.pro/
Apache License 2.0
916 stars 277 forks source link

[Feature Request] Support uploading Media to MongoDB storage #508

Open devlikepro opened 3 weeks ago

devlikepro commented 3 weeks ago

If we anyway uses mongodb to save session configuration and authentication, why not saving media there as well?

patron:PRO

HuangDaHui commented 3 weeks ago

Good idea, will the efficiency of requesting this interface be greatly improved? Because downloading media is really slow now /api/{session}/chats/{chatId}/messages/{messageId}?downloadMedia=true

devlikepro commented 3 weeks ago

Hi! We'll add optimization in the /api/{session}/chats/{chatId}/messages/{messageId}?downloadMedia=true in 2024.9.1 release, even without mongodb! Basicly it used to re-download all media, without checking file exists or not, now it won' redownload file if there's already in the filesystem Just make sure to setup the environment properly to save files between container restart https://waha.devlike.pro/docs/how-to/storages/#save-media-files-between-the-container-restarts

patron:PRO

HuangDaHui commented 1 week ago

/api/{session}/chats/{chatId}/messages/{messageId}?downloadMedia=true

Hi, I have configured mongodb and set the file cleanup time. Will the files in mongodb be deleted when the time is up? WHATSAPP_FILES_LIFETIME=10800

devlikepro commented 1 week ago

Hi! Mongodb doesn't save media files right now, only Local (files) and S3 can be used https://waha.devlike.pro/docs/how-to/storages/

Yes, when mongodb "media" storage is ready - you can configure WHATSAPP_FILES_LIFETIME so it'l remove after that time.

Btw, WHATSAPP_FILES_LIFETIME is not supported in S3, you need to take care of it yourself

patron:PRO

HuangDaHui commented 1 week ago

Hi! Mongodb doesn't save media files right now, only Local (files) and S3 can be used https://waha.devlike.pro/docs/how-to/storages/

Yes, when mongodb "media" storage is ready - you can configure WHATSAPP_FILES_LIFETIME so it'l remove after that time.

Btw, WHATSAPP_FILES_LIFETIME is not supported in S3, you need to take care of it yourself

patron:PRO

Okay, for now, I still use local, so I will keep cleaning up regularly. I look forward to you updating the mongodb file saving function.