Overview
This node provides utilities to work with Telegram MarkdownV2 formatting. It supports three main operations:
- Convert to Telegram MarkdownV2: Converts standard Markdown or HTML-formatted text into Telegram's MarkdownV2 format, which is a stricter subset of Markdown used by Telegram bots and messages.
- Escape Text for Telegram: Escapes special characters in plain text so that it can be safely used within Telegram MarkdownV2 without breaking formatting.
- Validate Telegram MarkdownV2: Checks if a given text is properly formatted according to Telegram MarkdownV2 rules, identifying errors, warnings, and suggestions.
Practical Use Cases
- Preparing user-generated content or bot messages to be sent via Telegram APIs while ensuring correct formatting.
- Sanitizing input text to prevent Telegram formatting errors.
- Validating existing Telegram MarkdownV2 content before sending to avoid message rejection or display issues.
Properties
| Name | Meaning |
|---|---|
| Input Text | The text input to process. For conversion, this is the markdown or HTML text; for escaping/validation, plain or formatted text. |
| Conversion Options | A collection of options controlling how conversion behaves: |
| - Preserve Line Breaks | Whether to keep line breaks (\n) in the output text (true/false). |
| - Convert HTML Tags | Whether to convert HTML tags (like <b>, <i>, <u>) to Telegram MarkdownV2 equivalents (true/false). |
| - Strict Mode | If enabled, conversion fails on unsupported markdown features (true/false). |
| - Auto Escape Special Characters | Automatically escape special characters that could break Telegram formatting (true/false). |
Output
The node outputs an array of JSON objects, each corresponding to one input item, containing fields depending on the selected operation:
Convert to Telegram MarkdownV2
{ "originalText": "<input text>", "telegramMarkdown": "<converted Telegram MarkdownV2 text>", "operation": "convertToTelegramMd", "processedBy": "TechFlecks Telegram Markdown Parser" }Escape Text for Telegram
{ "originalText": "<input text>", "escapedText": "<text with special characters escaped for Telegram MarkdownV2>", "operation": "escapeForTelegram", "processedBy": "TechFlecks Telegram Markdown Parser" }Validate Telegram MarkdownV2
{ "originalText": "<input text>", "isValid": true|false, "errors": [ "<list of error messages>" ], "warnings": [ "<list of warning messages>" ], "suggestions": [ "<list of suggestions>" ], "operation": "validateTelegramMd", "processedBy": "TechFlecks Telegram Markdown Parser" }
No binary data output is produced by this node.
Dependencies
- No external API calls or services are required.
- The node relies on internal logic bundled within its codebase.
- No special environment variables or credentials are needed.
Troubleshooting
Common Issues
Unescaped special characters causing Telegram formatting errors:
Users may input text containing characters like_,*,[,], etc., which need escaping to avoid breaking Telegram MarkdownV2. Use the "Escape Text for Telegram" operation or enable auto-escape during conversion.Unsupported Markdown features:
Telegram MarkdownV2 supports a limited set of markdown syntax. Using unsupported features may cause errors or incorrect rendering. Enabling strict mode will cause conversion to fail on such features, helping identify problematic input.Invalid URLs in links:
Links must start withhttp://,https://, ortg://to be valid in Telegram. Invalid URLs will trigger warnings during validation.
Error Messages
"Unknown operation: <operation>"
Occurs if an invalid operation name is provided. Ensure the operation parameter is one of the supported values: convertToTelegramMd, escapeForTelegram, validateTelegramMd.Validation errors such as
"Unmatched bold formatting"or"Found unescaped special characters"indicate formatting problems in the input text. Use the escape or conversion operations to fix these.If the node throws errors related to input data, verify that the "Input Text" property is correctly set and not empty when required.
Links and References
Telegram Bot API - MarkdownV2 Style
Official documentation describing Telegram MarkdownV2 formatting rules.Telegram MarkdownV2 Formatting Guide
Details on supported formatting options and escaping requirements.TechFlecks Telegram Markdown Parser GitHub (if available) (Not included in source, hypothetical)