Skip to content

setMessageReaction

Returns: TrueOfficial docs ↗

Use this method to change the chosen reactions on a message. Service messages of some types can't be reacted to. Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel. Bots can't use paid reactions. Returns True on success.

Parameters

chat_idIntegerStringRequired
Unique identifier for the target chat or username of the target channel (in the format @channelusername)
message_idIntegerRequired
Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
reactionReactionType[]Optional
A JSON-serialized list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators. Paid reactions can't be used by bots.
is_bigBooleanOptional
Pass True to set the reaction with a big animation

Returns

On success, True is returned.

GramIO Usage

ts
// React to the incoming message with a single emoji
bot
.
on
("message", (
ctx
) =>
ctx
.
react
("👍"));
ts
// Set multiple reactions (requires bot to have elevated rights or pre-existing reactions)
bot.on("message", (ctx) =>
  ctx.setReactions(["🔥", "❤️"])
);
ts
// React with big animation for emphasis
bot
.
on
("message", (
ctx
) =>
ctx
.
setReaction
("🎉", {
is_big
: true })
);
ts
// Remove all reactions from the message
bot
.
on
("message", (
ctx
) =>
ctx
.
clearReactions
());
ts
// Direct API call — react to a specific message
await 
bot
.
api
.
setMessageReaction
({
chat_id
: -1001234567890,
message_id
: 42,
reaction
: [{
type
: "emoji",
emoji
: "👍" }],
is_big
: false,
});

Errors

CodeErrorCause
400Bad Request: chat not foundInvalid or inaccessible chat_id
400Bad Request: message not foundmessage_id does not exist or was deleted
400Bad Request: can't react to this message typeService messages (pin, join, etc.) of certain types don't allow reactions
400Bad Request: REACTION_INVALIDEmoji string is not a valid Telegram reaction emoji — use only supported emoji strings
400Bad Request: CUSTOM_EMOJI_NOT_ALLOWEDCustom emoji reaction not permitted — admin must explicitly allow it, or it must already be on the message
400Bad Request: TOO_MANY_REACTIONSBots are limited to 1 reaction per message (non-premium) — pass a single-item array
403Forbidden: bot was blocked by the userUser blocked the bot
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

  • GramIO provides four context shorthands. Use ctx.react(emoji) for a single reaction, ctx.setReactions([...]) for multiple, ctx.setReaction(emoji) for an explicit single-item call, and ctx.clearReactions() to remove all reactions.
  • Bots are limited to 1 reaction per message. Passing more than one item in the reaction array will return a TOO_MANY_REACTIONS error unless the bot has premium capabilities. Use ctx.react() to stay within limits.
  • To remove all reactions, pass an empty array (or call ctx.clearReactions()). Passing reaction: [] explicitly clears the bot's reactions from the message.
  • Custom emoji reactions require explicit admin permission. A custom emoji can only be set if it is already present on the message or a chat administrator has allowed it via chat settings.
  • Paid reactions (ReactionTypePaid) cannot be used by bots. Only regular emoji and permitted custom emoji reactions are supported.
  • Service messages cannot be reacted to. Join/leave notices, pin notifications, and some other service messages are excluded.
  • Media group reactions apply to the first non-deleted message. If message_id points to a media group, the reaction is set on the first remaining message in the group.

See Also