Business Bot
A minimal Telegram Business webhook bot: every regular or business message gets
the same reply, Hi!.
The stack is intentionally small: FastAPI receives the webhook,
python-telegram-bot parses the update, and Wasmer Edge runs the app as a
WebAssembly package.
Mental Model
Wasm, or WebAssembly, is a compact portable binary format. It is useful for running apps in an isolated environment: fast, predictable, and without a full virtual machine.
Wasmer is a Wasm runtime and deployment platform. In this project, Wasmer Edge takes the Python/FastAPI app, packages its dependencies, and publishes it behind a public HTTPS URL.
First Run
cp .env.example .env
Fill BOT_TOKEN in .env, then run:
wasmer login
just install
just run
Local health check:
curl http://127.0.0.1:8000/
First Deploy
just setup
This stores the token in Wasmer secrets, registers the Telegram webhook, and deploys the production version.
Regular Update
After changing the code:
just deploy
For a preview deploy without switching production traffic:
just deploy-preview
Useful Commands
just format # format Python code with Ruff
just lint # lint Python code with Ruff
just health # check the live URL
just webhook # register the Telegram webhook again
just clean # remove local build files
Files
src/main.py is the ASGI entrypoint for Uvicorn and Wasmer.
src/bot.py contains the FastAPI app, health endpoint, and webhook endpoint.
src/handler.py only builds the Telegram webhook response.
wasmer.toml is the package manifest: Python runtime, mounted files, and the
command that runs on Wasmer Edge.
The version is changed manually only in pyproject.toml; just sync-version
syncs wasmer.toml and src/version.py.
Versioning Scheme
MAJOR.YYYYMMDD.PATCH from https://github.com/veiloq/scalver