TeleHost Docs
Create a Telegram bot, launch it, and run it — no VPS, no webhook setup, no server to keep alive.
Quickstart: BotFather → Add Bot → Launch
- On Telegram, open @BotFather and send
/newbot. Pick a name and username, and copy the token it gives you. Never share this token publicly. - On TeleHost, sign up, then click Add bot. Paste the name and token, pick a starter template (Welcome, Support or Info), and click Create bot.
- TeleHost verifies the token with Telegram's
getMe. Your bot is now saved as a draft — it does not reply yet. - Open the bot and click Launch Bot. TeleHost registers the webhook with a secret token and the bot goes live.
- Message your bot on Telegram with
/startand check the reply. Edit replies in the console — no re-deploy needed for reply changes.
This is the same Add Bot → Launch flow as other bot hosts: console in, token in, command written, Launch pressed, bot live. The difference is that TeleHost commands are fixed replies, buttons and variables — not arbitrary JavaScript — so a command can never escape its sandbox or run code on a server.
Commands
Each command has a trigger like /start or /help and a reply of up to 4000 characters. Replies are edited in the dashboard and take effect immediately.
- /start — cannot be deleted, only edited. Every bot starts with one from its template.
- Custom commands — add any
/wordtrigger. Only the first word of a message is matched, so/help pleasestill runs/help. - Fallback reply — set one reply for any message that matches no command. Leave it empty and unknown messages are logged as ignored, with no reply.
- Format — Plain text, Markdown or HTML per command.
- Export / Import — download a bot's commands as JSON and import them into another bot.
- Sync Telegram menu — pushes your commands into Telegram's
setMyCommands, so users see them in the chat menu.
Inline buttons
When adding a command, add buttons one per line in the buttons box:
Help | /help Our website | https://example.com
A button pointing at a /command sends that command's reply when tapped. A button pointing at a URL opens the link. Button taps arrive as callback_query updates and are logged like commands.
Variables in replies
These are replaced for each user before the reply is sent:
{first_name} {last_name} {full_name} {username} {chat_id} {bot_name} {bot_username}
Example: Hi {first_name}! Welcome to {bot_name}.
Deploy / Launch, enable and disable
- Launch Bot — validates the token (
getMe), callssetWebhookwith a random secret token, and marks the bot live. Deploy steps are shown in the dashboard. - Re-launch — re-registers the same webhook, useful after Telegram reports a stale webhook.
- Live toggle off — deletes the webhook. The bot stops replying; drafts and commands are kept.
- Delete bot — deletes the webhook, then the bot, its commands, chats and logs.
- Webhook URL —
https://<api>/webhook/<random-bot-id>. Telegram must send the secret header or the server returns 401.
Logs, stats and broadcast
Per bot you get: a live activity log (deploy, command, button, broadcast, error, ignored), and stats for chats reached, replies sent and errors. Broadcast sends one message to every chat that has messaged the bot (up to 200 per send) and reports sent/failed counts. Broadcast only to people who already talked to your bot — that is Telegram's own anti-spam rule in practice.
Serverless: handlers, endpoints, library, database
TeleHost follows the Telegram Serverless model from core.telegram.org/bots/serverless, adapted to TeleHost's own backend. In tgcloud a project is a tgcloud/ folder with four kinds of code. TeleHost gives you the same four sections per bot in the dashboard — without running arbitrary user JavaScript, so a bad module can never escape its sandbox.
| tgcloud | TeleHost |
|---|---|
handlers/<type>.js | Handlers tab: one entry per update type (message, callback_query, inline_query, chat_member, my_chat_member). Disabled or missing = that update is ignored. |
endpoints/<name>.js | Endpoints tab: a Mini App function, called as POST /endpoint/<botId>/<name> with verified Telegram initData. |
lib/ | Library tab: shared text modules, used as {lib:name} in any reply. |
schema.js | Database tab: declare tables and columns; TeleHost creates a real bot-scoped table from validated names and types only. |
Handlers — how to use them
In tgcloud, handlers/message.js receives the Message payload and its default export runs. In TeleHost, the message handler is your commands + fallback: a message's first word matches a command, otherwise the fallback reply runs. The callback_query handler answers button taps. Add an inline_query handler and TeleHost answers inline queries with one article built from its reply. Turn any handler off and Telegram updates of that type are logged as ignored and nothing runs.
// tgcloud/handlers/message.js — the equivalent pattern
import { api } from 'sdk';
export default async function (message) {
await api.sendMessage({ chat_id: message.chat.id, text: 'Hello!' });
}
Endpoints — how to use them
In tgcloud, an endpoint is called by a Mini App with Telegram.WebApp.Serverless.call('getProfile', input, cb) and receives verified ctx.initData. In TeleHost, create an endpoint named e.g. getProfile with a response like Hello {first_name}!, then call POST /endpoint/<botId>/getProfile with { initData, input }. TeleHost verifies initData with HMAC-SHA256 keyed by SHA256(bot token) and returns 401 on bad initData, exactly like the platform check. Use {input:field} in the response to echo Mini App input. Test an endpoint from the dashboard without initData using the owner-only Test button.
Library — how to use it
In tgcloud, lib/ holds shared modules imported by handlers (import { format } from '../lib/cart.js'). In TeleHost, a lib module is a shared text block: save greeting = "Welcome to TeleHost!" and write {lib:greeting} in any reply — it is expanded before variables like {first_name} are replaced.
Database — how to use it
In tgcloud, schema.js declares tables with a Drizzle-like DSL (table('users', { id: integer('id').primaryKey() })) and npx tgcloud migrate applies them; deploying code never touches data. In TeleHost, declare a table in the Database tab (columns as name:type, types text/integer/real/boolean/json) and TeleHost creates the table. View its rows from the same tab. Deleting the schema entry drops the bot-scoped table. There are no foreign keys, matching the tgcloud constraint — model relations with plain id columns.
Source: Telegram Serverless docs, read in full for this build: handlers, endpoints, library, database, SDK (sdk, sdk/db, api, fetch), CLI (push, migrate, run, status, webhook sync) and the BotFather Serverless screens.
API reference
All /api/* routes except auth need Authorization: Bearer <session-token>.
POST /api/auth/register { email, password } -> { token, user }
POST /api/auth/login { email, password } -> { token, user }
GET /api/auth/me
GET /api/bots list (token never included)
POST /api/bots { name, token, template } -> draft bot
POST /api/bots/:id/deploy Launch: getMe + setWebhook + live
PATCH /api/bots/:id { enabled, name }
DELETE /api/bots/:id
GET /api/bots/:id/commands GET, POST (upsert), DELETE ?trigger=
POST /api/bots/:id/commands/import { commands: [...] }
GET /api/bots/:id/stats logs by type, command + chat counts
POST /api/bots/:id/sync-menu setMyCommands from commands
POST /api/bots/:id/broadcast { text }
GET /api/bots/:id/logs last 100 events
GET /api/bots/:id/webhook live getWebhookInfo
GET /api/bots/:id/serverless handlers + endpoints + lib + schema
GET/POST /api/bots/:id/handlers update-type handlers (enable/reply)
GET/POST /api/bots/:id/endpoints Mini App endpoints (+ DELETE ?name=)
POST /api/bots/:id/endpoints/:name/test owner-only endpoint test
GET/POST /api/bots/:id/lib library modules (+ DELETE ?name=)
GET/POST /api/bots/:id/schema database tables (+ DELETE ?table=, GET rows)
POST /endpoint/:botId/:name Mini App endpoint, initData verified
POST /webhook/:botId Telegram only, secret header verified
FAQ
Do I need a server or VPS?
No. Everything runs on TeleHost's own backend. Nothing for you to keep alive.
Why no custom code?
Running arbitrary user code safely needs a real sandbox with CPU, memory and network limits. TeleHost v2 deliberately gives you the powerful no-code surface — commands, buttons, variables, fallback, broadcast — and keeps code execution out.
Is my BotFather token safe?
It is AES-GCM encrypted on the server with a server secret, never returned to the browser, and never written to logs. Still, treat it like a password: if it leaks, revoke it in @BotFather with /revoke.
Troubleshooting
- Bot does not reply: check it is Live (not Draft), click Re-launch, then Check status — Telegram should report your webhook URL with 0 pending updates.
- Invalid token: copy it again from @BotFather. Tokens look like
123456:ABC…with no spaces. - Old replies keep coming: another host may still hold the webhook. Launch here overwrites it; also check the log for errors.
- Buttons do nothing: make sure the button target is an existing
/command, and that the bot was launched after the button was added (webhook must allow callback_query — Launch does this).
TeleHost · Built by pooraddyy