One-time setup. After this, day-to-day use is just the Quick Start.
- Python 3 — Install via python.org or Homebrew (
brew install python3) - pip3 — Typically bundled with Python 3; otherwise
brew install pip3 - virtualenv —
pip3 install virtualenv
- Clone the repository:
git clone <repository-url> cd telegram-bot
- Create and activate a virtual environment:
virtualenv env-telegram-bot source env-telegram-bot/bin/activate - Install dependencies:
pip3 install -r requirements.txt
- Download and install the Telegram Desktop App.
- Create a new bot by messaging BotFather.
- Obtain the API token.
- For an existing bot, send
/mybotsto BotFather, select the bot, and click API Token.
- For an existing bot, send
- Create a
.envfile in the project root:touch .env
- Add your token in this format:
API_KEY = "110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw" - Create at least one Telegram group chat and add your bot as a member. That group will receive the message when the script runs.
Next: add your recipient groups — see Recipient Groups.