Text formatting

TrueConfAbout 4 min

Text formatting

TrueConf Chatbot Connector supports basic text formatting: bold, italic, underline, strikethrough, quotes, and inline links. TrueConf clients display them accordingly.

The API supports three message formatting types (parameter parseMode):

  • text — plain text. All characters will be preserved and displayed;
  • markdown — basic Markdown formatting is supported. Special characters are converted into formatted text (bold, italics, links, etc.);
  • html — HTML tags will be interpreted and displayed as formatted text.

Supported Syntax

StyleMarkdownHTML
Bold**text**<b>text</b>
Italictext / text<i>text</i>
Underlined 5.5.6+__text__text
Strikethrough~~text~~text
Link[text](https://url)<a href="https://url">text</a>
Line break\n<br>
Quote reply 5.5.6+>text\n\nresponse

response
Mention (mention) 5.5.3+[John](trueconf:john_doe@d.com)<a href="trueconf:john_doe@d.com">John</a>

at the same time:

  • Starting from TrueConf Server version 5.5.6+, the syntax __bold__ is no longer supported for bold text. Use it only for underlining text.

  • To create a line break in markdown format, use the control character \n. In html format, all \n characters are replaced with a single space . To insert a line break, use the <br> tag.

  • A quoted reply is displayed in the client application only if the message is a response to another message. For this, the payload must include the replyMessageId parameter. The quote should be at the beginning of the message; if placed within the text, it will not be displayed.

  • All unsupported HTML tags and their attributes are removed. To display an HTML tag as text, it must be escaped. For example, <i style="position: fixed; top:0">Hacked</i> will be converted to Hacked;

  • If a user is part of a group chat or channel with notifications disabled, they will still receive a notification with the @ symbol when mentioned.

Formatting examples

Examples of formatting for each mode:

markdown
**bold text**  
*italic text* / _italic text_  
__underlined text__  
~~strikethrough text~~  
[website](https://example.com)  
[mention](trueconf:mention@example.com)  
first line\nsecond line\n\nafter the empty line  
>quoted text\n\nresponse to the quote

Query examples

An example of sending a formatted message in each of the modes:

markdown
{
  "type": 1,
  "id": 1,
  "method": "sendMessage",
  "payload": {
    "chatId": "c8c3eee8-9ad0-4638-9692-ad16391a4256",
    "replyMessageId": "3d968a21-543c-4fb2-9d8e-e31e3fbb35eb",
    "content": {
      "text": ">corporate\n\n**Dear _colleagues_!** Please find __details__ at the link: [website](https://example.com). For any questions, contact [management](trueconf:ceo@example.com)!",
      "parseMode": "markdown"
    }
  }
}
/docs/chatbot-connector/media/formatting_example/en.webp