netdata/netdata-cloud

[Feat]: Telegram notifications support groups with topics

Closed this issue · 4 comments

Problem

No option to send messages to the group topic.

Description

After the Telegram update, now all groups can enable topics in their group (similar to Discord). More details can be found here

Importance

really want

Value proposition

  1. We use it for our monitoring alerts to notify us.
  2. Over the past few years, Telegram has gained many cool new features that are much better than others.
  3. It allows us to organize discussions into specific topics, making it easier to follow conversations.

Proposed implementation

Basically, it's just a one-word addition to the message-sending process with message_thread_id=TOPIC_ID.

async def async_send_message(message):
    bot = Bot(token=TOKEN)
    try:
        await bot.send_message(chat_id=chat_id, **message_thread_id=TOPIC_ID**, text=message, parse_mode='HTML', disable_web_page_preview=True)
        logger.info("Telegram: Message sent successfully")
    except Exception as e:
        logger.error(f"Telegram: Error sending message: {e}")

def send_message(message):
    asyncio.run(async_send_message(message, disable_notification))

Here are some guides:
Telegram documentation
How to get topic ID for Telegram group chat
Send notifications to a specific topic in the Telegram chat"

thanks for contacting us @WavesFunnyNode,

To better understand the request, are you proposing that we accept the topic_id parameter as part of the Telegram integration configuration, in order to send messages to a user-specified topic?

@juacker That's right!

Hello @WavesFunnyNode I'm in the pleasant position to let you know that the optional Topic ID parameter is now available to our Cloud Telegram integration!

Screenshot 2024-06-13 at 4 43 07 PM

Our docs will be updated soon as well (link), but I thought it would make sense to give you an early heads up.
In the meantime you can check the PR's instructions on how to get your topic ID but I suppose you already know that 😎

Happy monitoring!

PS: Feel free to close this issue given that everything works as expected.

Thank you!