GramJS

messages.SendReaction

React to message

Example

const { Api, TelegramClient } = require("telegram");
const { StringSession } = require("telegram/sessions");

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result = await client.invoke(
    new Api.messages.SendReaction({
      peer: "username",
      msgId: 43,
      big: true,
      reaction: "some string here",
    })
  );
  console.log(result); // prints the result
})();
import { Api, TelegramClient } from "telegram";
import { StringSession } from "telegram/sessions";

const session = new StringSession(""); // You should put your string session here
const client = new TelegramClient(session, apiId, apiHash, {});

(async function run() {
  await client.connect(); // This assumes you have already authenticated with .start()

  const result: Api.Updates = await client.invoke(
    new Api.messages.SendReaction({
      peer: "username",
      msgId: 43,
      big: true,
      reaction: "some string here",
    })
  );
  console.log(result); // prints the result
})();

Parameters

NameTypeDescription
flags#Flags, see TL conditional fields
bigflags.1?trueWhether a bigger and longer reaction should be shown
peerInputPeerPeer
msgIdintMessage ID to react to
reactionflags.0?stringReaction (a UTF8 emoji)

Result

Updates

Possible errors

CodeTypeDescription
400CHANNEL_PRIVATEYou haven't joined this channel/supergroup.
400MESSAGE_ID_INVALIDThe provided message id is invalid.
400MESSAGE_NOT_MODIFIEDThe provided message data is identical to the previous message data, the message wasn't modified.
400PEER_ID_INVALIDThe provided peer id is invalid.
400REACTION_EMPTYEmpty reaction provided.
400REACTION_INVALIDThe specified reaction is invalid.

Can bots use this method?

No