Skip to content

setStickerKeywords

Returns: TrueOfficial docs ↗

Use this method to change search keywords assigned to a regular or custom emoji sticker. The sticker must belong to a sticker set created by the bot. Returns True on success.

Parameters

stickerStringRequired
File identifier of the sticker
keywordsString[]Optional
A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters

Returns

On success, True is returned.

GramIO Usage

ts
// Add search keywords to a sticker
await 
bot
.
api
.
setStickerKeywords
({
sticker
: "CAACAgIAAxkBAAIBcWZ...",
keywords
: ["happy", "smile", "funny", "laugh"],
});
ts
// Remove all keywords from a sticker (pass empty array or omit)
await 
bot
.
api
.
setStickerKeywords
({
sticker
: "CAACAgIAAxkBAAIBcWZ...",
keywords
: [],
});
ts
// Omitting keywords also clears them
await 
bot
.
api
.
setStickerKeywords
({
sticker
: "CAACAgIAAxkBAAIBcWZ...",
});
ts
// Update keywords for every sticker in a set
const 
set
= await
bot
.
api
.
getStickerSet
({
name
: "my_pack_by_mybot" });
const
keywordMap
:
Record
<string, string[]> = {
happy
: ["happy", "smile", "joy"],
sad
: ["sad", "cry", "upset"],
}; for (const
sticker
of
set
.
stickers
) {
const
emoji
=
sticker
.
emoji
?? "";
const
keywords
=
keywordMap
[
emoji
] ?? [];
await
bot
.
api
.
setStickerKeywords
({
sticker
:
sticker
.
file_id
,
keywords
,
}); }

Errors

CodeErrorCause
400Bad Request: STICKER_ID_INVALIDThe sticker file_id is invalid or the sticker doesn't belong to a set created by this bot
400Bad Request: keywords list is too longMore than 20 keywords provided — trim the list
400Bad Request: total keywords length is too longSum of all keyword string lengths exceeds 64 characters — use shorter keywords
429Too Many Requests: retry after NRate limit hit — check retry_after, use auto-retry plugin

TIP

Use GramIO's auto-retry plugin to handle 429 errors automatically.

Tips & Gotchas

  • Total character budget is 64, not per-keyword. All keywords combined (including any separators) must fit within 64 characters. With 20 keywords that's an average of 3 characters each — keep keywords short.
  • Keywords improve discoverability in inline mode. When users search for stickers in the inline sticker picker by typing words, keywords are matched. Good keywords significantly improve how often your stickers appear.
  • keywords is optional — omitting clears all keywords. Passing keywords: [] or omitting the field entirely removes all keywords from the sticker. This is intentional — useful for resetting.
  • Only works on bot-created sticker sets. Like other sticker modification methods, you can only update stickers in sets created by your bot.
  • Use English keywords for widest reach. Telegram's sticker search is used globally — English keywords reach the most users, even for localized sticker packs.

See Also