Telegram, getting file_id for existing sticker
Asked Answered
I

2

22

I'm writing a Telegram bot and I want it to send a sticker.

It is said here, that to send a sticker that already exists on Telegram servers we can simply pass file_id. The thing is, I have absolutely no idea how to obtain file_id of any sticker. E.g. how do I send any sticker from Greater Minds pack? I suppose, this pack is on Telegram servers since they include it in every app.

Indeterminate answered 18/12, 2015 at 12:24 Comment(1)
I know that 5 years have passed, but ... @idstikerbot will do the jobHanging
V
40

To discover a sticker's file_id:

  1. Send the sticker from Telegram App to your bot.

  2. Use the bot's getUpdates method to receive the sticker. You should see the sticker's file_id in the message.

Your bot may use that file_id to send the same sticker to another user. Be careful; in the message there is a thumb field, which also has a file_id. Do not use that one to send the sticker. It won't work.

Another possibility, of which you may be aware, is that you can always download the sticker image to a disk file, then use that file as the sticker parameter for sendSticker method, equivalent to uploading the file.

Viviyan answered 19/12, 2015 at 1:42 Comment(0)
E
8

Go to @RawDataBot bot at http://t.me/RawDataBot. Then send/forward your sticker to that bot. There are various data being returned. You can look for the sticker parameter.

Example:

"sticker": {
            "width": 512,
            "height": 512,
            "emoji": "\ud83d\udc4d",
            "set_name": "GengMisi",
            "is_animated": false,
            "is_video": false,
            "thumb": {
                "file_id": "AAMCBQADGQEAARNXJ2JmLCEf98yfbH4IrxllIeSUBERZAAIeAAP2groPvWHPcxamOuYBAAdtAAMkBA",
                "file_unique_id": "AQADHgAD9oK6D3I",
                "file_size": 4562,
                "width": 128,
                "height": 128
            },
            "file_id": "CAACAgUAAxkBAAETVydiZiwhH_fMn2x-CK8ZZSHklAREWQACHgAD9oK6D71hz3MWpjrmJAQ",
            "file_unique_id": "AgADHgAD9oK6Dw",
            "file_size": 26966
        }
Exceptive answered 25/4, 2022 at 5:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.