Telegram бот для постинга записей в каналы, где бот находится или в личку.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Vladimir Smagin 7d2f845591 Изменить '' 3 weeks ago
helpers import 1 year ago Изменить '' 1 year ago Изменить '' 3 weeks ago
requirements.txt import 1 year ago
run import 1 year ago
telegram-post-bot.service import 1 year ago


This is my Telegram bot that can accept messages in JSON from port or socket file and forward to group, channel or private person.

Requires python 3 libs:

  • wheel
  • python-telegram-bot
  • raven (if you using Sentry)

Best results if you install it to venv or use in Docker image.

Deploy in Docker

To run prepare this ENV variables

  • ENV_TELEGRAM_TOKEN=telegram_bot_token Register new bot and get token with @BotFather bot.
  • ENV_RAVEN_TOKEN=sentry.io_token Set this variable only if you use Sentry error reporting.
  • USEIP=true Required in Docker, opens port instead of socket file.

Now you are ready to start image:

docker run --name telegram-post-bot -p 10010:10021 \
    -e USEIP=true \

Sample alert script for Zabbix

See more here

source /etc/profile

json_escape () {
    printf '%s' "$1" | python -c 'import json,sys; print(json.dumps("\""))'

post_title=$(json_escape "$1")
post_body=$(json_escape "$2")

echo "{\"chatID\":\"${chat_id}\",\"message\":\"${post_title}\n\n${post_body}\"}" | nc -U /run/telegram-GrapeBlessedBot.sock


>$ "Message title" "Message text body"

Change nc call from socket file to port if use docker image.