Skip to content

Commit

Permalink
feat(nordigen): add telegram requisition hook
Browse files Browse the repository at this point in the history
  • Loading branch information
yemexx1 authored and martinohansen committed Nov 8, 2024
1 parent 77c792a commit 2be6020
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions reader/nordigen/hooks/telegram-example.sh
Original file line number Diff line number Diff line change
@@ -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 <status> <link>"
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"

0 comments on commit 2be6020

Please sign in to comment.