add support for group topics tg notifications
Build and Push Docker Images / Build and Push Docker Images (push) Failing after 8s

This commit is contained in:
2026-08-02 06:40:11 +05:00
parent 2db0369d7c
commit 6cdf042f49
3 changed files with 13 additions and 0 deletions
+4
View File
@@ -8,6 +8,8 @@ api_url = str(config("SMS_API_URL", cast=str, default=""))
api_key = str(config("SMS_API_KEY", cast=str, default=""))
bot_token = str(config("TG_BOT_TOKEN", cast=str, default=""))
chat_id = str(config("TG_CHAT_ID", cast=str, default=""))
# Optional forum topic to post into. If empty, messages go to the group's General topic.
topic_id = str(config("TG_TOPIC_ID", cast=str, default=""))
def format_mobile(mobile: str) -> str:
@@ -88,6 +90,8 @@ def send_telegram_markdown(message: str):
try:
url = f"https://api.telegram.org/bot{bot_token}/sendMessage"
payload = {"chat_id": chat_id, "text": message, "parse_mode": "MarkdownV2"}
if topic_id:
payload["message_thread_id"] = topic_id
response = requests.post(url, data=payload)
response.raise_for_status()