Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can We Send a Media With the text Caption in Message ? #331

Open
vijaygopal97 opened this issue Apr 2, 2025 · 2 comments
Open

Can We Send a Media With the text Caption in Message ? #331

vijaygopal97 opened this issue Apr 2, 2025 · 2 comments

Comments

@vijaygopal97
Copy link

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?

@avoylenko
Copy link
Collaborator

Already discussed here #111

@asfo
Copy link

asfo commented Apr 8, 2025

@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 || '';)

Image

Don't know why the decision to force it to be null, and seems like it comes from your original implementation
avoylenko@d3baebd

So I believe we should open a PR to fix this? (or not sure if this is okay?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants