A package to deliver notifications via your telegram bot
Project description
Installation
$ pip install notipi
Setup
In order to use notipi library - you would be needing two environment variables: BOT_API_TOKEN
and CHAT_ID
To get BOT_API_TOKEN
:
- In the telegram app, initiate conversation with
@BotFather
and follow the instructions to create a new bot and get theBOT_API_TOKEN
- You will be required to enter bot's account name and username.
- Detailed instructions can be found at Telegram website
To get CHAT_ID
:
- Once a new bot is created, send a dummy message to the bot via Telegram app so that your chat gets assigned an ID.
- Run the following script with your
BOT_API_TOKEN
to get yourCHAT_ID
from notipi.notipi import get_chat_id
get_chat_id(BOT_API_TOKEN)
This will give the following output:
Your CHAT ID: 1234567890
Once the BOT_API_TOKEN
and CHAT_ID
are obtained, set the environment variables
export BOT_API_TOKEN=<bot_api_token>
export CHAT_ID=<chat_id>
Usage
Once the required environment variables are in place, following script can be used to send messages to your telegram app.
from notipi.notipi import notify
def example():
for i in range(1000):
if i%100==0:
notify(f"Currently at {i}")
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
notipi-0.0.3.tar.gz
(4.2 kB
view hashes)
Built Distribution
notipi-0.0.3-py3-none-any.whl
(4.8 kB
view hashes)