Message entities are Telegram's structured, non-visual way of marking up a message. Instead of embedding formatting characters in the text itself, the Bot API describes each styled span β bold, italic, a link, a mention, and similar β as its own entry naming the formatting type and the offset and length of the text it covers. It is an alternative to inline markup formats like MarkdownV2: when you send text using MarkdownV2 syntax, Telegram parses that syntax and converts it into entities before storing and delivering the message, so the plain text and its formatting end up represented separately rather than interleaved.
An inline markup language like MarkdownV2 keeps formatting and content in the same string β a bold word is wrapped in asterisks right where it appears. A message entity instead describes formatting as coordinates into the underlying plain text: which formatting applies, and where it starts and how long it runs, counted in UTF-16 code units rather than characters β which matters for anything containing emoji, since those count as two units rather than one. The text a client displays never contains markup characters at all; the formatting lives entirely in the accompanying list of spans.
Separating structure from content avoids a whole class of escaping problems: a plain-text span can contain any character, including ones that would otherwise need escaping in an inline syntax, because nothing in the text itself is being interpreted as a formatting instruction. It also makes formatting easy to strip or ignore β a client with no rich-text support can just read the plain text and skip the entity list β where stripping inline markup would require parsing it first.
MarkdownV2 is one input format Telegram accepts and converts, not a competing representation. Send a message with MarkdownV2 formatting and Telegram parses the asterisks, underscores and brackets in the text, then stores the result as plain text plus entities. Autogram's posts go out this way β generated content is escaped and formatted as MarkdownV2 on the way out, and Telegram performs the conversion into entities on its side. Reading a message back exposes only the entity form; the original MarkdownV2 syntax the sender typed is not preserved anywhere.
Automate your Telegram publishing with AI content, quality scoring, and smart scheduling.