Can We Send a Media With the text Caption in Message ?
We usually Send Images or Video with a written message in Whatsapp, is It possible To Send That using this API ? As Far As I can Read from the API Documentation, Only Sending Separately is made possible in it. Can you please confirm if its Possible to send both together or not?
Already discussed here https://github.com/chrishubert/whatsapp-api/issues/111
@avoylenko there is an issue the implementation:
if (options?.media) {
const media = options.media
media.filename = null
media.filesize = null
options.media = new MessageMedia(media.mimetype, media.data, media.filename, media.filesize)
}
messageOut = await client.sendMessage(chatId, content, options)
On file: https://github.com/avoylenko/whatsapp-api/blob/master/src/controllers/clientController.js#L78
As we can see here, it forces the filename to be null. It should follow the proper filename "or null", and if "null" maybe we should add an empty value instead (like media.filename = media?.filename || '';)
Don't know why the decision to force it to be null, and seems like it comes from your original implementation https://github.com/avoylenko/whatsapp-api/commit/d3baebd150cd255bf69b6719e6021041ab04526f
So I believe we should open a PR to fix this? (or not sure if this is okay?)
@asfo Seems like my initial commit was changed by SonarQube.
Fix is available in forked project: https://github.com/avoylenko/wwebjs-api
Also feel free to open PR here, @chrishubert might approve it someday.