Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add chat_id to telegram notifier #978

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config.yaml.default
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ notifications:
pushover_api_key: xx

# TELEGRAM
# use this URL to find the telegram_chat_id of the telegram group or leave empty to send to everyone
# https://api.telegram.org/<telegram_bot_token>/getUpdates
notify_telegram: false
telegram_token: xxxxx
telegram_chat_id: -1087228824

# TWILIO
notify_twilio: false
Expand Down
8 changes: 6 additions & 2 deletions plotmanager/library/utilities/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ def _send_notifications(title, body, settings):
import pushover
client = pushover.Client(settings.get('pushover_user_key'), api_token=settings.get('pushover_api_key'))
client.send_message(body, title=title)

if settings.get('notify_telegram') is True:
import telegram_notifier
notifier = telegram_notifier.TelegramNotifier(settings.get('telegram_token'), parse_mode="HTML")
notifier = telegram_notifier.TelegramNotifier(
token=settings.get('telegram_token'),
parse_mode="HTML",
chat_id=settings.get('telegram_chat_id')
)
notifier.send(body)

if settings.get('notify_ifttt') is True:
Expand Down