Auto backup: 2026-02-21 07:01
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Smart Newsletter Digest
|
||||
|
||||
**Runs:** Daily at 8:00 PM (Australia/Perth)
|
||||
**Sends to:** Telegram + Gotify
|
||||
**Sends to:** Telegram + ntfy
|
||||
**Learns from your feedback!**
|
||||
|
||||
## How It Works
|
||||
|
||||
@@ -10,8 +10,9 @@ source "$SCRIPT_DIR/../../.env" 2>/dev/null || true
|
||||
source "$IMAP_SKILL/.env" 2>/dev/null || true
|
||||
|
||||
TELEGRAM_CHAT="${TELEGRAM_CHAT:-1793951355}"
|
||||
GOTIFY_URL="${GOTIFY_URL:-http://runtipi.kangaroo-eel.ts.net:8129}"
|
||||
GOTIFY_TOKEN="${GOTIFY_TOKEN:-AGKnHafW3FGzBlt}"
|
||||
NTFY_URL="${NTFY_URL:-}"
|
||||
NTFY_TOPIC="${NTFY_TOPIC:-}"
|
||||
NTFY_MIN_PRIORITY="${NTFY_MIN_PRIORITY:-4}"
|
||||
PREFERENCES_FILE="$SCRIPT_DIR/newsletter-preferences.json"
|
||||
|
||||
log() {
|
||||
@@ -146,11 +147,27 @@ send_telegram() {
|
||||
-d "{\"chat_id\": \"$TELEGRAM_CHAT\", \"text\": \"$message\", \"parse_mode\": \"Markdown\", \"disable_web_page_preview\": true}" > /dev/null
|
||||
}
|
||||
|
||||
send_gotify() {
|
||||
local msg="$1"
|
||||
curl -s -X POST "${GOTIFY_URL}/message?token=${GOTIFY_TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"title\": \"Newsletter Digest\", \"message\": \"$msg\", \"priority\": 5}" > /dev/null || true
|
||||
send_ntfy() {
|
||||
local title="$1"
|
||||
local msg="$2"
|
||||
local priority="${3:-4}"
|
||||
local sound="${4:-default}"
|
||||
|
||||
[[ -z "$NTFY_URL" ]] && return 0
|
||||
[[ -z "$NTFY_TOPIC" ]] && return 0
|
||||
|
||||
# Enforce minimum priority (default 4)
|
||||
if [[ "$priority" =~ ^[0-9]+$ ]] && [[ "$NTFY_MIN_PRIORITY" =~ ^[0-9]+$ ]]; then
|
||||
if (( priority < NTFY_MIN_PRIORITY )); then
|
||||
priority="$NTFY_MIN_PRIORITY"
|
||||
fi
|
||||
fi
|
||||
|
||||
curl -s -X POST "${NTFY_URL}/$NTFY_TOPIC" \
|
||||
-H "Title: $title" \
|
||||
-H "Priority: $priority" \
|
||||
-H "Sound: $sound" \
|
||||
-d "$msg" > /dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
main() {
|
||||
@@ -161,7 +178,7 @@ main() {
|
||||
digest=$(fetch_and_build_digest)
|
||||
|
||||
send_telegram "$digest"
|
||||
send_gotify "Digest sent to Telegram"
|
||||
send_ntfy "🦀 Newsletter digest" "Digest sent to Telegram" 4 default
|
||||
|
||||
log "Done!"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user