====== Сервис Telegram ====== * [[https://linuxscriptshub.com/send-telegram-message-linux-scripts/]] * [[https://core.telegram.org/bots/tutorial|From BotFather to 'Hello World']] * [[https://dev.to/nathannosudo/bash-script-to-send-a-message-in-telegram-from-your-terminal-20c7|Bash Script to Send a Message in Telegram from your Terminal!]] * [[https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id|Telegram Bot - how to get a group chat id?]] BotFather /newbot choose name: Val spec N choose username: ValspecNbot ... You will find it at t.me/Valspec2bot ... Use this token to access the HTTP API: 823268117438:AAE5W1PlK3ex0udwaQeznHG5ejsQNXc-J58 ... /start ... https://api.telegram.org/bot823268117438:AAE5W1PlK3ex0udwaQeznHG5ejsQNXc-J58/getUpdates ... "chat": { "id": 1776721761 ... $ cat send-to-telegram.sh #!/bin/sh [ "$1" ] && MESSAGE=$1 || MESSAGE="Hello, world!" #MESSAGE=$(cat) TOKEN="768604181156:AAGB1Qwvd-DAPhFbQiMKR3InggtIvPPEtT8" CHAT_ID="1776721761" curl -s -X POST https://api.telegram.org/bot$TOKEN/sendMessage -d chat_id=$CHAT_ID -d text="$MESSAGE" $ time make buildworld; /home/val/send-to-telegram.sh FINISH * [[Использование библиотеки PAM#Использование pam_exec для регистрации подключений]] debian:~# chmod 700 /usr/local/bin/send-to-telegram.sh