Skip to main content

Send a notification to a Telegram user or group.

Project description

telegram_notifier_bot - v1.0.0

A simple package to send notifications to a Telegram user or group.

E.g.

  • Send notifications triggered by some event
    • in a monitoring system
    • an IoT device
    • a service

Installation

From PyPI

(venv) $ pip install telegram-notifier-bot
(venv) $

From GitHub

(venv) $ pip install git+https://github.com/p4irin/telegram_notifier_bot.git
(venv) $

Verify

(venv) $ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import telegram_notifier_bot
>>> telegram_notifier_bot.__version__
'0.0.1'
>>>

Usage

Prerequisite

Create a new Telegram bot

Send a notification

(venv) $ export TELEGRAM_BOT_TOKEN=<Your Telegram bot token>
(venv) $ export TELEGRAM_CHAT_ID=<Recipient(s) chat or group id>
(venv) $ export TELEGRAM_PATH_TO_PHOTO=<File system path to photo>
(venv) $ python
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> from telegram_notifier_bot import Notifier
>>> token = os.getenv('TELEGRAM_BOT_TOKEN')
>>> chat_id = os.getenv('TELEGRAM_CHAT_ID')
>>> photo = os.getenv('TELEGRAM_PATH_TO_PHOTO')
>>> notifier = Notifier(token)
>>> notifier.send("We're out of coffee! Please fix ASAP!", chat_id)
>>> notifier.send_photo(photo, chat_id)
>>>

Reference

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telegram_notifier_bot-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

telegram_notifier_bot-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file telegram_notifier_bot-1.0.0.tar.gz.

File metadata

  • Download URL: telegram_notifier_bot-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for telegram_notifier_bot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 704fb0afc8fa366d47de45f62ef0c5b904b5b84aaa1426d3e536eaa8ea5bc0d8
MD5 c04d038bbaaca68f93015284f1119ac8
BLAKE2b-256 0394a9a20baaf2091316a568b025900cc441e2bc0ceb331a7f35aad3a3086660

See more details on using hashes here.

File details

Details for the file telegram_notifier_bot-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for telegram_notifier_bot-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c4ef75704c8473b24487ff0bf06c3203192ff48832e6d4325cb5341dc4cb0bc
MD5 7c2d2c38512b16d1d72bbf146a5b2987
BLAKE2b-256 f860ee9901aa844db8c6a051ca646beabe36e222b09d52465b41aec9e2613e4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page