Build and host a Telegram bot with a database
A Telegram bot is a small backend that answers messages. Describe the conversation; the AI builds the bot, hosts its webhook on HTTPS and keeps its data.
What runs, and where the data lives
- AddressHTTPS addressYour own domain when you add one
- Web serviceBot webhookReceives Telegram updates over HTTPS · Nano · 128 MiB
- DatabasePostgreSQLPostgreSQL · Nano · 128 MiB · 1 GiB disk
Needs 1 vCPU · 256 MiB memory · 1 GiB storage.
- Daily backups, kept 7 days
- 1 custom domain
- Alerts by email
How the bot runs
Telegram delivers messages to a bot in one of two ways: the bot asks for updates in a loop (long polling), or Telegram sends each update to an HTTPS address (a webhook). On Fullsea a web service gets an HTTPS address the moment it deploys, so the AI builds the webhook kind:
- A web service with one endpoint for Telegram's updates. It answers quickly and does the work — a database lookup, a reply, a booking — inside the request.
- PostgreSQL for what the bot remembers: users, settings, bookings, who is on duty this week.
- The bot token in the environment, encrypted at rest. You add it yourself under the project's environment variables in the dashboard; the app reads it, and the AI only ever sees the variable's name.
When the app is live, the agent registers the webhook with Telegram using the app's address and a secret token, so updates that do not come from Telegram are refused.
If you prefer long polling — for a bot that must not have a public address — ask for a background worker instead of a web service; it holds the connection open and restarts on its own if it crashes.
Things bots do on a schedule
A bot that posts a daily summary or rotates a duty list needs a clock. Add a cron job to the project with a schedule and a time zone: it runs, sends the messages through the same bot token, and exits. Each run's log is kept, so "why did nobody get the reminder?" has an answer.
Getting a token
Create the bot with Telegram's @BotFather and copy the token it gives you. Rather than pasting it into the chat, add it to the project's environment variables in the dashboard under the name the AI tells you — values set there are never read back to the AI.
Questions, answered.
Webhook or long polling?
The webhook kind is the default here: Fullsea gives the bot an HTTPS address, so Telegram pushes updates and nothing runs while the bot is idle. Long polling suits bots that must not be reachable from the internet; it runs as a worker.
Where is the bot token kept?
In the project's environment variables, encrypted at rest and hidden until you reveal it. The code refers to the variable by name; the AI can list the names but never reads the values back.
Can the bot remember users and conversations?
Yes, in its PostgreSQL database: the agent creates the tables it needs, such as users, preferences or bookings.
Can it send messages on a schedule?
Yes, with a cron job in the same project. It uses the same token and database and runs in the time zone you choose.
What language is it written in?
Whatever suits it — Python and Node.js both have good Telegram libraries. Say which you prefer, or let the agent choose.
Start with one sentence.
Describe it, and Fullsea builds it, deploys it with its database and keeps it running — with a full dashboard beside the chat.