Skip to content

A Telegram bot to track products on ah.nl and be notified of discounts

License

Notifications You must be signed in to change notification settings

TommasoAmici/ah-bonus-bot

Repository files navigation

AH Bonus Bot

This repo contains the source code for a Telegram bot that allows users to track products on ah.nl and get notified when they go on sale.

Usage

There are two components to this bot: the Telegram bot itself and a notification service. The bot should always run to accept user input and to store the tracked products.

The notification service can be run on a schedule to check for price changes and send out notifications if any tracked product is on sale. Since AH's discounts are valid for a week, it is sufficient to run the notification service once a week on Monday.

Both binaries are built from the telegram_bot crate. After building, the bot and notify binaries can be found in the target/release directory.

You can build the binaries with the following command:

cargo build --release

Development

The Makefile contains targets to run both binaries locally, make run and make notify. A a .env file with the following environment variables is required:

DATABASE_URL=sqlite:ah_bonus.db
TELOXIDE_TOKEN=XXX

You can request a bot token from the BotFather.

AH API

The reverse engineered AH API is documented in the ah_api crate.