A Telegram bot to automate our shared flat. Users can send messages to the bot on telegram such as request their weekly duty, remind others or rotate to the next cycle.
The app uses Telegraf to interact with users via a webhook that is exposed to an express server. It can be served locally or in a cloud environment such as Google Cloud App Engine.
To develop the app locally, clone the repository, run the install script and start a local development server.
Note that the app is currently using a managed MySQL database, hosted on PlanetScale. To change this, replace the provider
under schema.prisma and migrate your own database. For more see the prisma docs.
# clone repo
git clone [email protected]:ematala/putzbot.git
# navigate into repo
cd putzbot
# set environment variables
cp .env.example .env
# install dependencies with pnpm
pnpm install
# start local development server
pnpm dev
In order to run the app, several environment variables are required that need to be provided inside the .env file or a provider-specific configuration file.
- TELEGRAM_BOT_TOKEN: The Telegram API Token, issued by the @BotFather
- DATABASE_URL: A connection string to a database.
- PASSWORD: A custom app specific password that users can send to the bot during their registration to prevent unauthorized access.
- APP_URL: A static URL to the hosted version of the app. Used to register the webhook for production deployments
- WEBHOOK_SECRET: A custom secret that gets sent along inside the webhook as
X-Telegram-Bot-Api-Secret-Token
header to prevent unauthorized requests. See Telegram api docs for more.