From 2be60206b4bb89be6bb895bbb9fe2853ee82627d Mon Sep 17 00:00:00 2001 From: yemexx1 Date: Fri, 8 Nov 2024 13:08:57 +0100 Subject: [PATCH] feat(nordigen): add telegram requisition hook --- reader/nordigen/hooks/telegram-example.sh | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 reader/nordigen/hooks/telegram-example.sh diff --git a/reader/nordigen/hooks/telegram-example.sh b/reader/nordigen/hooks/telegram-example.sh new file mode 100644 index 0000000..e45c218 --- /dev/null +++ b/reader/nordigen/hooks/telegram-example.sh @@ -0,0 +1,29 @@ +#!/bin/sh + + # This script will send a message to a Telegram channel with the reauthentication link + # + # Configuration is done in the /data/telegram_config.env + # Environment variables expected + # + # telegram_bot_token + # telegram_chat_id + # + + # Check if the required parameters are provided + if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 + fi + + # Load Telegram credentials from the file if available + if [ -f "/data/telegram_config.env" ]; then + . "/data/telegram_config.env" + fi + + # Set the parameters + status="$1" + link="$2" + + # Send the message to the Telegram channel + curl -s -X POST https://api.telegram.org/bot${telegram_bot_token}/sendMessage -d chat_id=${telegram_chat_id} -d text="YNABber needs reauthentication\n\nStatus: $status\nLink: $link" +