# Formatting messages in Telegram

### Markdown markup

To apply the correct text formatting for this block, strictly follow the steps below. The markup tools are located under the message input field.

<figure><img src="/files/rYu3YJjR5oFupsS2bPeG" alt="" width="375"><figcaption></figcaption></figure>

* Put the required text in the response field.

If you use variables in the text, then you don't need to specify them at this stage. Otherwise, the syntax of the variables will be violated and the #{} characters will also be escaped, and the variable will not appear in the text.

* Turn on "Markdown in Telegram". This way, escape characters will be added to your text.

Select the text \*\* or \_ \_, etc.

If any of the listed characters occur in this block.: '\_', '\*', '\[', ']', '(', ')', '\~', "', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!' — they need to be escaped by adding a backslash in front of them. \\

Otherwise, the message will not be sent at all. It doesn't matter which part of the text you mark up.

Example: hello\\. Glad \*to\* see you\\!

Special symbols:

* **Bold text** — put asterisks on both sides: \*here is the text\*
* **Italics** — underlining: \_text\_
* **Underlined text** — two lower underscores on both sides: \_\_text\_\_
* **The crossed**—out text is a tilde on both sides of the text: \~text\~
* **Link in the text:** \[text in square brackets]\(link in parentheses)&#x20;
* \[inline URL]\(<http://www.example.com> /)
* **Mentioning the user TG:** \[text in square brackets] (link to the user in parentheses). You can use #{platform\_id} after the equals sign in the link.&#x20;
* \[inline mention of a user]\(tg://user?id=123456789)
* **Text in the form of a code** — put a reverse apostrophe on both sides of the text: \`inline fixed-width code\`
* **Hidden text or spoiler** - use || on both sides of the text
* Then place the desired text using special characters.

Example:

<figure><img src="/files/MlgOZlmxsJQbgQPLwTOf" alt="" width="375"><figcaption></figcaption></figure>

The result:

<figure><img src="/files/IG4eKPMOEseuRdzAF0Jy" alt="" width="375"><figcaption></figcaption></figure>

**To use special characters literally (e.g., \`, \*, \_, \~), you must escape them with a backslash (\\). This prevents them from being interpreted as formatting commands.**

**Example:** To display an asterisk (\*), write `\*`.

txt = tg\_escape(s), where s is the string with the source text.

To write text with line breaks to a variable, specify the value as follows:

your variable = "Text of the first line" + "\n" + "Text of the second line" + "\n" +"Third line"

A line arrives in txt with the slashes already inserted in the right places at the output.

Example:

<figure><img src="/files/J4l8VxIAPL5cgXowyeJ2" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/qFjBc65Bt78xvaLyJfx1" alt=""><figcaption></figcaption></figure>

Then mark up the desired text.

**Here is an example with a long text:**

<figure><img src="/files/zf7GohsoNRljiUc5nmup" alt="" width="364"><figcaption></figcaption></figure>

To do this, use the calculator to:

**Step 1. Paste your text into the message field:**

<figure><img src="/files/WXEv0j5x3ayIVhCRnluD" alt="" width="375"><figcaption></figcaption></figure>

**Step 2. Enable the "Markdown markup" button:**

<figure><img src="/files/iDO5OmlyjNY9pqA2UMwT" alt="" width="375"><figcaption></figcaption></figure>

When the markup button is turned on, special characters are escaped.

**Step 3. Arrange special characters for formatting the message in the text:**

<figure><img src="/files/y995ftzOHVHkeVGXYJCP" alt="" width="375"><figcaption></figcaption></figure>

* **"There is no closing symbol"** - This often means a special character (like a bracket `}` or quote `"`) was not properly escaped.

**Common Error Example:**

If a message fails to send and you see an error in the "Clients" section, it is likely due to incorrect character escaping. The error message will typically point to the specific character that is missing a backslash (`\`).

<br>

<figure><img src="/files/g9XJT71fRDu8Z87bD3rT" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/jdnuaOLpUtXXN79YsTCe" alt="" width="375"><figcaption></figcaption></figure>

* Character escaping is missing:

<figure><img src="/files/Nfxk6aIfg98JCTA6wUDn" alt="" width="375"><figcaption></figcaption></figure>

Formatting text in the block editor for Telegram: markdown

### HTML markup

To make the HTML markup work, don't forget to click on the HTML button under the text field for the message:

<figure><img src="/files/v7emwVhvyRmKOgI5sBoM" alt="" width="375"><figcaption></figcaption></figure>

* \<a href="<https://google.com> ">link\</a> - embeds a link in a specific word.

Example:

<figure><img src="/files/TWHLSx4n5RScCRvpx9Fo" alt="" width="563"><figcaption></figcaption></figure>

* \<u>underlined\</u> - underlined font

Example:

<figure><img src="/files/rsW0bMb6dJ6txQhtRzNC" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/qSfSlQbVoRlgBaIadVSP" alt="" width="375"><figcaption></figcaption></figure>

* \<ins>underlined\</ins> - underlined font

Example:

<figure><img src="/files/DyegkOEB6rpIj7OeIq2b" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/82mI4r6oBhfUnz44KRuP" alt="" width="375"><figcaption></figcaption></figure>

* \<em>italic\</em> - italic font

Example:

<figure><img src="/files/FptG3SkAFFnhSPWFdvoO" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/V5Tai6FAJlKpkAZWvijN" alt="" width="375"><figcaption></figcaption></figure>

* \<i>italic\</i> - italic font

Example:

<figure><img src="/files/ElkHpLqYxQkcw0GuXaK6" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/MKO1DRsczkSU3qQXaGsD" alt="" width="375"><figcaption></figcaption></figure>

* \<strong>strong\</strong> - bold font

<figure><img src="/files/3rVnxFO9ZtS0wYjTngvI" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/XAVoc3RjC6dDcMHYOiNH" alt="" width="375"><figcaption></figcaption></figure>

* \<strike>strike\</strike> - strike through font

<figure><img src="/files/mENzC9lQOIbMr0tE43Pt" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/5OyU9lHurtLg9quSH0IV" alt="" width="375"><figcaption></figcaption></figure>

* \<span class="tg-spoiler">hidden\</span> - hidden font

Example:

<figure><img src="/files/5h9a93pDtL8cSrJFAJHx" alt="" width="375"><figcaption></figcaption></figure>

* \<code>Prerfomatted\</code> - formatted font

Example:

<figure><img src="/files/UeqQ7l8w0PpxxEm7GMpt" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/hD8CYtD5sMUFZnImmBPG" alt="" width="375"><figcaption></figcaption></figure>

* \<pre>Preformatted\</pre> - formatted font

Example:

<figure><img src="/files/Zju06CKMU7ezN8rXoNJy" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/9qpNRIrOWh7lBofrOwcm" alt="" width="351"><figcaption></figcaption></figure>

### How to enable protected mode for content

To protect the content from distribution, you can enable protected mode for messages. To do this, turn on "Protect content" in the "Message" section:

<figure><img src="/files/n9CUqCIFi42LBpvEc8cS" alt="" width="375"><figcaption></figcaption></figure>

Secure messages cannot be forwarded, and you cannot take a screenshot on your phone.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mavibot.ai/chatbot/builder/telegram_messages.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
