[APP][Pro] Telegram

Frequently Asked Questions (FAQs) - Homey Pro Telegram Bot App

Q1: I’m encountering a “Bad Request: can’t parse entities” error with the message, “Character ‘(’ is reserved and must be escaped with the preceding ‘\’”. What should I do?

Answer

A: This error indicates an issue with parsing entities, specifically with characters like ‘(’. To resolve this, make sure you escape non-Markdown characters properly. If your variables or tokens, especially those from Homey Flows, contain special characters, switch to HTML or use the Better Logic Library (BLL) to escape them.

Q2: How can I escape non-Markdown characters in my variables?

Answer

A: If your variables contain special characters like . , * / & % $, and Telegram can’t differentiate them from Markdown special characters, you need to escape them. There are two recommended ways to address this issue:

  • Option 1: Use HTML Markdown: Convert your message to HTML format, where special characters won’t conflict with Markdown. Telegram supports HTML formatting.
  • Option 2: Utilize Better Logic Library (BLL): Implement a custom function for escaping special characters using BLL. Here’s an example function you can use:
function escapeRegex(string) {
   return string.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&');
}

Then, use it in your message like this: {[escapeRegex(variable)]}.

By following either of these options, you can ensure proper handling of special characters in your variables, resolving the parsing issue.

Q3: Why am I getting an error related to special characters in my variables, and how does the Better Logic Library (BLL) help?

Answer

A: The error occurs because Telegram can’t distinguish between Markdown special characters and non-Markdown characters in your variables. Since you are using special characters like . , * / & % $, you need to escape them. BLL provides a solution by offering a custom function, such as the provided escapeRegex function, to escape these characters. By incorporating this function into your flow, you ensure proper handling of variables with special characters, eliminating parsing errors.

Q4: How does markdown work (HTML vs. MarkdownV2)?

Answer

A: For detailed information on how markdown works, particularly the differences between HTML and MarkdownV2 in the context of the Homey Pro Telegram Bot App, please refer to the community discussion thread here.

Q5: How do I set up the Homey Pro Telegram Bot App?

Answer

A: Follow these steps to set up the Homey Pro Telegram Bot App:

  1. Install the app on your smart home hub.
  2. Create a Telegram bot by searching for “@Botfather” in the Telegram search bar and selecting the “@Botfather” bot.
  3. Start the “@Botfather” bot by clicking the “Start” button or by sending the /newbot command to create a new bot.
  4. Enter the token provided by Botfather in the app settings.
  5. Look for the option to set a password and configure a secure password of your choice.
  6. Start the bot by sending the /start command in Telegram, and follow the instructions. Each user must also send the bot the /start command. You can share the bot with others by searching for it in Telegram or by sharing the profile link.
  7. Enjoy controlling your smart home from Telegram!

Q6: How can I support the development of the Homey Pro Telegram Bot App?

Answer

A: There are two ways you can support the app:

  1. Contribute via GitHub: If you have coding skills or want to contribute in other ways, you can visit the GitHub repository at GitHub - spkesDE/com.spkes.telegramNotifications. Feel free to contribute by submitting bug reports, feature requests, or even code improvements.
  2. Make a Donation: If you prefer to support the developer financially, you can send a donation. Visit the community thread here to find information on how to make a donation. Your contributions help in the continuous improvement and maintenance of the Homey Pro Telegram Bot App.

Your support, whether through contributions on GitHub or donations, is highly appreciated and contributes to the ongoing development of the app.

Q7: How can I enable Markdown?

Answer

A: In the app settings is a option to enable MarkdownV2 or HTML Markdown.

1 Like