1

I'm trying to send the custom_emoji through Telegram API using MessageEntity object.

Here is how I've tried to do it:

const message = ''
ctx.sendMessage({
  text: message,
  entities: [{
    type: 'custom_emoji',
    length: message.length,
    offset: 0,
    custom_emoji_id: '5389102131527556772'
  }]
})

p.s. I'm using Telegraf TS, but it doesn't matter since it's just a basic function

chakzefir
  • 138
  • 1
  • 9
  • 1
    We encountered the same problem. We think that its now available rn because you [can not buy premium for bots](https://telegram.org/faq_premium#:~:text=Q%3A%20Can%20I%20buy%20a%20premium%20subscription%20for%20my%20bots,becomes%20available%20in%20the%20future) – Leon Nov 18 '22 at 12:03

1 Answers1

0

Telegram finally published more detailed doc covering this moment: https://core.telegram.org/bots/api#markdownv2-style

Custom emoji entities can only be used by bots that purchased additional usernames on Fragment.

MarkdownV2 style

![](tg://emoji?id=5368324170671202286)

HTML style

<tg-emoji emoji-id="5368324170671202286"></tg-emoji>

The documentation is a bit vague. So will explain how I get it:

  1. You need to make one time purchase with 5k TON, to allow your bot to attach custom usernames.
  2. Attach one of the usernames you own through fragment.com
  3. Sending custom emoji should be available from now on More details you can find on Fragment FAQ

p.s. Custom emoji id could be found in web.telegram.org through inspector: customEmojiId in Telegram Web version

chakzefir
  • 138
  • 1
  • 9
  • Can you write me full code using sendMessage() ? – DotNetStar A Aug 09 '23 at 18:10
  • Could you please tell me more explanations? If i purchase username on Fragment via my telegram, the bot which was created by my telegram will use custom emoji? So.. the bot owner's telegram username should be one of the listing of Fragment to use custom emoji? – DotNetStar A Aug 09 '23 at 20:33
  • The documentation is a bit vague. So will explain how I get it: 1. You need to make one time purchase with 5k TON, to allow your bot to attach custom usernames. 2. Attach one of the usernames you own through fragment.com 3. Sending custom emoji should be available from now on More details you can find on https://fragment.com/about#q-can-i-assign-my-upgraded-username-to-a-different-bot I am about to test this workflow so I can share results afterwards with wider audience – chakzefir Aug 15 '23 at 14:14