send telegram message

This commit is contained in:
Kirill Chikalin
2025-03-20 08:14:22 +03:00
parent 266bb1c3e2
commit f7c4549104
3 changed files with 53 additions and 1 deletions

18
sendMessage Executable file
View File

@@ -0,0 +1,18 @@
+-#!/bin/bash
MESSAGE=$(echo -e "$3")
response=$(curl -s -X POST "https://api.telegram.org/bot$1/sendMessage" \
-d "chat_id=$2" \
-d "parse_mode=MarkdownV2" \
-d "link_preview_options={\"is_disabled\":true}" \
-d "text=$(echo -e "$3")")
# if command -v jq >/dev/null 2>&1; then
message_id=$(echo "$response" | jq '.result.message_id')
# else
# message_id=$(echo "$response" | grep -o '"message_id":[0-9]*' | sed 's/"message_id"://')
# fi
echo "Sent message ID: $message_id"
echo "TELEGRAM_MESSAGE_ID=$message_id" >> $GITHUB_ENV