Installing telegram-send for scripted Telegram notifications
telegram-send is a command-line tool for sending messages to Telegram — useful for scripts, cron jobs, and other automation that needs a simple notification channel.
Prerequisites
- Python 3 with
pip3on the host.
Steps
1. Install telegram-send
sudo pip3 install telegram-send2. Work around a python-telegram-bot incompatibility
Depending on which python-telegram-bot version pip resolves, telegram-send can fail on first
run with:
cannot import name 'MAX_MESSAGE_LENGTH' from 'telegram.constants'
This happens when a newer python-telegram-bot release removes/renames the constant
telegram-send’s (older, unmaintained-at-the-time) code imports directly. Force-reinstall a known
compatible version:
pip3 install --force-reinstall -v "python-telegram-bot==13.5"This is a version-pin workaround, not a real fix — check whether it’s still needed against the
current telegram-send release before assuming it applies; a properly updated telegram-send
may no longer need the pin, or may need a different one.
Verify
Run telegram-send interactively once to complete its bot-token setup, then send a test message:
telegram-send "test message"Troubleshooting
cannot import name 'MAX_MESSAGE_LENGTH' from 'telegram.constants': apply thepython-telegram-bot==13.5pin above.
Related
Sources
- Legacy wiki.js (de, translated): telegram-send CLI install — private source; German-only wiki.js page, no English original existed