Skip to content

setChatStickerSet

Returns: TrueOfficial docs ↗

Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.

Parameters

chat_idIntegerStringRequired
Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
sticker_set_nameStringRequired
Name of the sticker set to be set as the group sticker set

Returns

On success, True is returned.

GramIO Usage

ts
// Set a sticker set for a supergroup
await 
bot
.
api
.
setChatStickerSet
({
chat_id
: -1001234567890,
sticker_set_name
: "my_sticker_pack_by_mybot",
});
ts
// Check can_set_sticker_set before calling to avoid errors
const 
chat
= await
bot
.
api
.
getChat
({
chat_id
: -1001234567890 });
if (
chat
.
can_set_sticker_set
) {
await
bot
.
api
.
setChatStickerSet
({
chat_id
: -1001234567890,
sticker_set_name
: "my_sticker_pack_by_mybot",
}); }
ts
// From a message context — set sticker set for the current chat
bot
.
command
("setstickers", async (
ctx
) => {
const
setName
=
ctx
.
text
?.
split
(" ")[1];
if (!
setName
) return
ctx
.
send
("Usage: /setstickers <sticker_set_name>");
await
ctx
.
setChatStickerSet
(
setName
);
await
ctx
.
send
(`Sticker set updated to: ${
setName
}`);
});
ts
// Remove the group sticker set entirely
await 
bot
.
api
.
deleteChatStickerSet
({
chat_id
: -1001234567890 });

Errors

CodeErrorCause
400Bad Request: chat not foundInvalid or inaccessible chat_id
400Bad Request: STICKERSET_INVALIDThe sticker set name doesn't exist or is not accessible
400Bad Request: method is available only for supergroupsCalled on a regular group, channel, or private chat — supergroups only
403Forbidden: not enough rights to change chat sticker setBot lacks the can_change_info admin right
403Forbidden: bot is not a member of the supergroup chatBot was removed from the supergroup

Tips & Gotchas

  • Check can_set_sticker_set first. Not all supergroups allow bots to set a sticker set — the getChat response includes can_set_sticker_set: true when the bot has this privilege. If it's false or absent, the call will fail.
  • Supergroups only. Regular groups, channels, and private chats all return method is available only for supergroups. A group must be a supergroup (usually 200+ members or explicitly upgraded) for this to work.
  • Sticker set name format. The name is the short name of the pack as seen in t.me/addstickers/<name> — typically ends with _by_<botusername> for bot-owned sets. Use getStickerSet to verify a set exists before assigning it.
  • Use deleteChatStickerSet to remove it. There is no "clear" option in setChatStickerSet — use the dedicated deleteChatStickerSet method to remove the group sticker set.
  • Context shorthand is ctx.setChatStickerSet(name). Available in MessageContext and other contexts with ChatControlMixin; chat_id is inferred automatically.

See Also