Skip to content

setStickerPositionInSet

Returns: TrueOfficial docs ↗

Use this method to move a sticker in a set created by the bot to a specific position. Returns True on success.

Parameters

stickerStringRequired
File identifier of the sticker
positionIntegerRequired
New sticker position in the set, zero-based

Returns

On success, True is returned.

GramIO Usage

ts
// Move a sticker to the front of the set (position 0)
await 
bot
.
api
.
setStickerPositionInSet
({
sticker
: "CAACAgIAAxkBAAIBcWZ...",
position
: 0,
});
ts
// Move a sticker to a specific position (e.g. 4th slot, zero-based index 3)
await 
bot
.
api
.
setStickerPositionInSet
({
sticker
: "CAACAgIAAxkBAAIBcWZ...",
position
: 3,
});
ts
// Reorder all stickers in a set alphabetically by their emoji
const 
set
= await
bot
.
api
.
getStickerSet
({
name
: "my_pack_by_mybot" });
const
sorted
= [...
set
.
stickers
].
sort
((
a
,
b
) =>
(
a
.
emoji
?? "").
localeCompare
(
b
.
emoji
?? "")
); for (let
i
= 0;
i
<
sorted
.
length
;
i
++) {
await
bot
.
api
.
setStickerPositionInSet
({
sticker
:
sorted
[
i
].
file_id
,
position
:
i
,
}); }

Errors

CodeErrorCause
400Bad Request: STICKER_ID_INVALIDThe sticker file_id is invalid or doesn't belong to a set created by this bot
400Bad Request: position is out of boundsposition is greater than or equal to the number of stickers in the set — use zero-based indexing within range
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

  • Position is zero-based. The first position in the set is 0, not 1. Moving a sticker to position 0 makes it the first sticker shown in the sticker picker.
  • The first sticker is used as the set's cover image. If no explicit thumbnail is set, Telegram uses the sticker at position 0 as the set's preview image. Use this to control which sticker represents your pack.
  • Reordering multiple stickers requires sequential calls. There's no bulk reorder API — if you're sorting an entire set, you must call setStickerPositionInSet for each sticker, and order matters (moving one sticker shifts others).
  • Fetch the latest set state before reordering. After each setStickerPositionInSet call the set's order changes, so when reordering multiple stickers, work from a fresh snapshot from getStickerSet and process in a calculated sequence.
  • Only works on bot-created sets. You cannot reorder stickers in sets created by other bots or via BotFather.

See Also