setCustomEmojiStickerSetThumbnail
Returns: TrueOfficial docs ↗
Use this method to set the thumbnail of a custom emoji sticker set. Returns True on success.
Parameters
nameStringRequiredSticker set name
custom_emoji_idStringOptionalCustom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
Returns
On success, True is returned.
GramIO Usage
ts
// Set a specific emoji as the sticker set thumbnail
await bot.api.setCustomEmojiStickerSetThumbnail({
name: "my_emoji_set_by_mybot",
custom_emoji_id: "5368324170671202286",
});ts
// Drop the thumbnail — the first sticker in the set is used automatically
await bot.api.setCustomEmojiStickerSetThumbnail({
name: "my_emoji_set_by_mybot",
custom_emoji_id: "",
});ts
// Update thumbnail after adding a new emoji to the set
async function updateStickerSetThumbnail(setName: string, thumbnailEmojiId: string) {
await bot.api.setCustomEmojiStickerSetThumbnail({
name: setName,
custom_emoji_id: thumbnailEmojiId,
});
}Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: STICKERSET_INVALID | No sticker set with this name exists, or it belongs to another bot |
| 400 | Bad Request: STICKER_ID_INVALID | custom_emoji_id does not refer to a sticker in this set — verify it belongs to the set |
| 400 | Bad Request: not a custom emoji sticker set | The sticker set is a regular image/animated set, not a custom emoji set — method only works for custom emoji sets |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after and back off |
TIP
Use GramIO's auto-retry plugin to handle 429 errors automatically.
Tips & Gotchas
- This method only works for custom emoji sticker sets. It does not apply to regular image, animated (.TGS), or video (.WEBM) sticker sets — use
setStickerSetThumbnailfor those. - Pass an empty string to clear the thumbnail. When
custom_emoji_idis"", Telegram automatically uses the first sticker in the set as the display thumbnail. - The emoji must be part of the set. The
custom_emoji_idmust reference an emoji that is already in the sticker set — you cannot use an emoji from a different set. - Sticker set name convention. Custom emoji set names created via the bot typically end in
_by_<botusername>. UsegetStickerSetto look up the exact name. - Bot must own the sticker set. Only the bot that created the sticker set can modify its thumbnail.
See Also
setStickerSetThumbnail— set thumbnail for regular/animated/video sticker setsgetStickerSet— retrieve sticker set info and list of stickerssetStickerSetTitle— change the display title of a sticker setStickerSet— sticker set object type