A Telegram-based automated payment detection system
Project description
Autopaybot (AvtoPaymentBot)
A Telegram-based automated payment detection system designed specifically for the Uzbekistan market. This application uses Telegram Userbots via the Telethon library to intercept incoming transaction notifications from payment systems (Click, Payme, Uzcard, Humo) on behalf of merchants. It acts as an integration middleware, parsing transaction SMS/Messages and automatically firing Webhooks to your backend server.
Features
- Multi-Merchant Support: Manages concurrent Telegram Userbots for multiple independent merchants dynamically.
- Smart Payment Parser: Uses regex to interpret and normalize transaction amounts from Click, Payme, Uzcard, and Humo notification bots.
- Collision Management: Temporarily augments subsequent identical transaction requests by tiny fractions (+0.01 UZS offset) to maintain uniqueness for idempotent processing.
- Webhook Integration: Instantly fires asynchronous HTTP webhooks signed with an HMAC (SHA-256) signature.
- Background Health Checking: Asynchronous daemon runs every 5 minutes to verify if merchant sessions have been revoked.
🚀 Installation & Usage
You can run autopaybot anywhere by simply installing it via pip.
1. Install via pip
pip install autopaybot
Note: Python 3.11+ is required.
2. Initialization
Initialize the project to create your .env configuration file:
autopay init
Fill out TELEGRAM_API_ID, TELEGRAM_API_HASH, BOT_TOKEN, ADMIN_TELEGRAM_IDS and your preferred POSTGRES_* credentials.
3. Database Migrations
Run the embedded Alembic migrations to set up your PostgreSQL database:
autopay upgrade
4. Run the Services
You need to run two separate processes (the API and the Telegram Worker):
Start the Web API:
autopay web
Start the Telegram Worker:
autopay worker
🐳 Docker Deployment
Don't want to install Python packages directly? You can use the official pre-built Docker image from the GitHub Container Registry!
docker pull ghcr.io/themirmakhmudov/autopaybot:latest
Run the API:
docker run --env-file .env -p 8000:8000 ghcr.io/themirmakhmudov/autopaybot:latest autopay web
Run the Worker:
docker run --env-file .env ghcr.io/themirmakhmudov/autopaybot:latest autopay worker
Testing & Development
To contribute or run automated tests locally:
git clone https://github.com/theMirmakhmudov/AutoPay-API.git
cd AutoPay-API/backend
# Install with development dependencies
pip install -e .[dev]
# Run tests
pytest tests/ -v
License
MIT License. See the LICENSE file for details. Note: Using userbots to scrape messages technically falls into a grey area under Telegram's Terms of Service. Be mindful of usage rate-limits and restrict the listener solely to the official banking bots.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autopaybot-0.1.1.tar.gz.
File metadata
- Download URL: autopaybot-0.1.1.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0672c6d19c8395c2e3b4966f8c232aa4f977ed9c2a8920ea83ed0699c1b4dc7
|
|
| MD5 |
ca4dcbeab4693e7f10c4747c83fb0328
|
|
| BLAKE2b-256 |
9140d59f96951ad494a54f7b981271c5a48044a847a47686f688f1e40851ebe9
|
Provenance
The following attestation bundles were made for autopaybot-0.1.1.tar.gz:
Publisher:
publish.yml on theMirmakhmudov/AutoPay-API
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autopaybot-0.1.1.tar.gz -
Subject digest:
d0672c6d19c8395c2e3b4966f8c232aa4f977ed9c2a8920ea83ed0699c1b4dc7 - Sigstore transparency entry: 2153654525
- Sigstore integration time:
-
Permalink:
theMirmakhmudov/AutoPay-API@e433260d4abdb6395a879da76f88a0c41c8fef89 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/theMirmakhmudov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e433260d4abdb6395a879da76f88a0c41c8fef89 -
Trigger Event:
release
-
Statement type:
File details
Details for the file autopaybot-0.1.1-py3-none-any.whl.
File metadata
- Download URL: autopaybot-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
066874fb9aa23ec7efcee0fa318eff6ee0de3f4c0a82a6c8c0f0375d616d3411
|
|
| MD5 |
c5f59844e10a3025719fb29ae7ee0b96
|
|
| BLAKE2b-256 |
8a0c474b84a663777b85ef869a66c254da52919d79a68b761ec1b3ded45cb4ef
|
Provenance
The following attestation bundles were made for autopaybot-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on theMirmakhmudov/AutoPay-API
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
autopaybot-0.1.1-py3-none-any.whl -
Subject digest:
066874fb9aa23ec7efcee0fa318eff6ee0de3f4c0a82a6c8c0f0375d616d3411 - Sigstore transparency entry: 2153654607
- Sigstore integration time:
-
Permalink:
theMirmakhmudov/AutoPay-API@e433260d4abdb6395a879da76f88a0c41c8fef89 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/theMirmakhmudov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e433260d4abdb6395a879da76f88a0c41c8fef89 -
Trigger Event:
release
-
Statement type: