chrishubert / whatsapp-api

This project is a REST API wrapper for the whatsapp-web.js library, providing an easy-to-use interface to interact with the WhatsApp Web platform.
https://www.christophehubert.com
Other
585 stars 286 forks source link

Add ability to send stickers #215

Open AKhateeb opened 1 month ago

AKhateeb commented 1 month ago

I can see that we can easily send stickers using WhatsApp Web, I'd be grateful if you could add a method to send stickers (which is different from sending PNG image as sending PNGs has no transparency where sending stickers has)

chrishubert commented 1 month ago

You should be able to do it already by passing the option sendMediaAsSticker when you send your message. https://docs.wwebjs.dev/global.html#MessageSendOptions

Give it a try and let us know if it works!

AKhateeb commented 1 month ago

it didn't work, I've added this option to the payload of {{baseUrl}}/client/sendMessage/:sessionId let me know if I should another API endpoint to send stickers @chrishubert

manoedinata commented 3 weeks ago

Don't forget to use sendMediaAsSticker. Pass it in options.

Ref: https://docs.wwebjs.dev/global.html#MessageSendOptions

AKhateeb commented 2 weeks ago

I can see no options in that request {{baseUrl}}/client/sendMessage/:sessionId I'm using this repository as API, all retries failed, I didn't find anything helpful in the Swagger Documentation :(

manoedinata commented 1 week ago

I can see no options in that request {{baseUrl}}/client/sendMessage/:sessionId I'm using this repository as API, all retries failed, I didn't find anything helpful in the Swagger Documentation :(

You need to pass it, even if it's not mentioned in Swagger.

AKhateeb commented 1 week ago

Thanks it works now, I was confused by the attribute name, this is the request if anyone wants to know about it:

{
    "chatId": "*****@c.us",
    "contentType": "MessageMediaFromURL",
    "content": "https://**********/img.png",
    "options": {
        "sendMediaAsSticker": true
    }
}
manoedinata commented 6 days ago

Good to know!