uploadStickerFile
Uploads a sticker file.
Returns: On success, returns File.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
user_id | Integer | Yes | User ID |
sticker | InputFile | Yes | Sticker file (InputFile or file_id) |
sticker_format | String | Yes | Sticker format: static, animated, video |
Example request
curl
curl -s "https://api.telegram.org/bot$TOKEN/uploadStickerFile" \
-F user_id=123456789 \
-F sticker_format=static \
-F sticker=@sticker.png
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/uploadStickerFile",
data={
"user_id": 123456789,
"sticker_format": "static"
},
files={"sticker": open("sticker.png", "rb")},
timeout=30,
)
print(resp.json())
JavaScript
import { readFile } from "node:fs/promises";
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const form = new FormData();
form.append("user_id", "123456789");
form.append("sticker_format", "static");
form.append("sticker", new Blob([await readFile("sticker.png")]), "sticker.png");
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/uploadStickerFile`, { method: "POST", body: form });
console.log(await res.json());
Step-by-step guide: How to Create a Telegram Bot: Step by Step with BotFather and Python
Related methods
getStickerSetReturns a sticker set.createNewStickerSetCreates a new sticker set.addStickerToSetAdds a sticker to a set.replaceStickerInSetReplaces a sticker in a set.setStickerPositionInSetMoves a sticker in a set.deleteStickerFromSetDeletes a sticker from a set.setStickerSetTitleSets sticker set title.setStickerSetThumbnailSets sticker set thumbnail.setCustomEmojiStickerSetThumbnailSets custom emoji sticker set thumbnail.deleteStickerSetDeletes a sticker set.setStickerEmojiListChanges sticker emoji list.setStickerKeywordsChanges sticker keywords.