whatsapp-api icon indicating copy to clipboard operation
whatsapp-api copied to clipboard

Add ability to send stickers

Open AKhateeb opened this issue 1 year ago • 7 comments

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)

AKhateeb avatar May 13 '24 19:05 AKhateeb

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!

chrishubert avatar May 17 '24 08:05 chrishubert

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

AKhateeb avatar May 22 '24 15:05 AKhateeb

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

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

manoedinata avatar Jun 13 '24 10:06 manoedinata

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 :(

AKhateeb avatar Jun 24 '24 06:06 AKhateeb

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.

manoedinata avatar Jun 24 '24 12:06 manoedinata

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
    }
}

AKhateeb avatar Jun 30 '24 11:06 AKhateeb

Good to know!

manoedinata avatar Jul 01 '24 10:07 manoedinata