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
831 stars 254 forks source link

Send GIFs doesn't work #222

Closed allburov closed 8 months ago

allburov commented 9 months ago

From Marcelo Sales (Patreon)


Hi this is an amazing tool thanks so much ! i am trying to send animated gifs , i can sendImg png , jpeg , etc just fine , but the gifs don't play on the client , it like it is sending just the first frame. Could you help me plz? Best example code

def send_image(chat_id,url):
    url = "[cdn.discordapp.com/attachments/1059887401889181699/1162905229793185933/hi_gif.gif](https://cdn.discordapp.com/attachments/1059887401889181699/1162905229793185933/hi_gif.gif)"
    pprint(url)
    response = [requests.post](http://requests.post/)(
        "[localhost:3000/api/sendImage](http://localhost:3000/api/sendImage)",
        json={
            "session": "default",
            "chatId": chat_id,
            "file": {
                    "mimetype": "image/gif",
                    "url": url,
                    "filename": "filename.gif"
                  },
            "caption": ""
        },
    )
    print(response)
    response.raise_for_status()

cdn.discordapp.com/attachments/1059887401889181699/1162905229793185933/hi_gif.gif

allburov commented 9 months ago

hi_gif

allburov commented 8 months ago

Might be related to video issue https://github.com/devlikeapro/whatsapp-http-api/issues/226

allburov commented 8 months ago

You must convert GIF to video on your side and send it with the new POST /api/sendVideo endpoint. It's basically how official WhatsApp clients do it.

https://waha.devlike.pro/docs/how-to/send-messages/#send-video-imagesversionspluspng