Skip to content

Latest commit

 

History

History
70 lines (48 loc) · 1.89 KB

File metadata and controls

70 lines (48 loc) · 1.89 KB

Telegram notifier

Simple console utility for send message to telegram chat from telegram bot.

Create telegram bot

For create and manage Telegram bots you will need to communicate with @botfather. Details here.

Install

git clone https://github.com/igancev/telegram-notifier
cd telegram-notifier
go build -o telegram-notifier .
sudo mv telegram-notifier /usr/local/bin
telegram-notifier --help

or use docker image

docker pull igancev/telegram-notifier:latest

Usage

To send a message, you must provide 3 required arguments:

  • token. Authorization api token for bot. Received from the @botfather when creating the bot

  • chat_id. Unique telegram identifier for the target chat. If you want sending message yourself, you may detect his for example in @userinfobot.

  • message. Any message what you want to send. Supports telegram markdown syntax.

This parameters must be pass as arguments or define as environment variables:

  • TELEGRAM_NOTIFIER_TOKEN
  • TELEGRAM_NOTIFIER_CHAT_ID
  • TELEGRAM_NOTIFIER_MESSAGE

Inline arguments is a higher priority than environment variables.

Bin

telegram-notifier -token='telegramBotApiToken' -chat_id=123456 -message='*Any* _message_ with `markdown`'

Docker

docker run --rm igancev/telegram-notifier telegram-notifier -token='telegramBotApiToken' -chat_id=123456 -message='*Any* _message_ with `markdown`'

Docker compose

version: '3'
services:
    telegram-notifier:
        image: igancev/telegram-notifier:latest
        environment:
          - TELEGRAM_NOTIFIER_TOKEN=1428033353:AAGg95hVqqW2qStmKlJHD0rXRG2vyMNVxlQ
          - TELEGRAM_NOTIFIER_CHAT_ID=123456
          - TELEGRAM_NOTIFIER_MESSAGE=*Any* _message_ with `markdown`
docker-compose up