Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending animated GIFs with sendPhoto (Telegram bot)

I'm trying to send an animated GIF with sendPhoto (Telegram's Bot API) with this request:

https://api.telegram.org/bot<token>/sendPhoto?chat_id=<chat_id>&photo=http://i.giphy.com/13IC4LVeP5NGNi.gif

That method works, as in, I get ok:true back, but the image in the chat window is a still snapshot of the moving GIF.

How can I get the animated GIF to show? Is there another method I should use?

like image 643
m52go Avatar asked Dec 15 '16 18:12

m52go


People also ask

How do you share GIFs on Telegram?

Type @gif in the message field and hit Space on your keyboard. This will bring up a pop-up menu of GIFs, and the message field will now read "Search GIFs." This way, you can quickly search and send GIFs in a chat by using the message field as a search box.

Can you add GIFs to Telegram?

Sending GIFs To make sending your favorite animations easier, we've added a dedicated GIF tab to the sticker panel. Tap on GIFs in chats (long tap on iOS) and 'Save' to add them to the panel. Then send them to any chat in one tap.

Can Telegram bot send files?

Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.

Can Telegram bot send pictures?

Pass a file_id as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a local photo by passing a file path. (Optional). Photo caption (may also be used when re-sending photos by file_id), 0-1024 characters.


2 Answers

You should use the sendAnimation method for sending a GIF or H.264/MPEG-4 AVC video without sound.
Just use the animation parameter for your GIF file.


sendPhoto is only used for static images.

like image 143
Maak Avatar answered Oct 29 '22 00:10

Maak


use sendVideo method!

https://api.telegram.org/bot<token>/sendVideo?chat_id=<chat_id>&video=http://i.giphy.com/13IC4LVeP5NGNi.gif

this will work

like image 27
frismic Avatar answered Oct 29 '22 00:10

frismic