Linux: Telegram: Send telegram message to channel when user logged via ssh

PHOTO EMBED

Mon Aug 29 2022 14:49:26 GMT+0000 (Coordinated Universal Time)

Saved by @marcopinero #bash

# Create Channel
# Create new Bot and get Bot TOKEN (to replace TOKEN_OF_BOT)
# and edit:
# /etc/ssh/sshrc

ip=`echo $SSH_CONNECTION | cut -d " " -f 1`

logger -t ssh-wrapper $USER login from $ip

curl -s -X POST https://api.telegram.org/botTOKEN_OF_BOT/sendMessage \
     -d text="Hello world!" -d chat_id=@autanaChannel > /dev/null
content_copyCOPY

Send message to Telegram Channel, using a Bot.