Build Telegram bots for BotBhai—without guessing the runtime.
Use this guide as a developer specification or give the AI-ready contract to a coding assistant. The examples explain exactly what runs inside the built-in PHP webhook runtime and how Laravel, HTML and Python projects should integrate.
The dashboard's built-in Start / Restart / Deploy runtime executes a PHP webhook bot whose entry file is exactly bot.php. Laravel and Python examples require compatible hosting or an external service. HTML is a frontend layer and must call a secure backend.
Choose your implementation
Each option is separate, with its own architecture and deployment rules.
The platform contract
These rules are the most important part of building a compatible bot.
For built-in hosting, the main file must be named bot.php.
Read Telegram's JSON update from php://input.
Return HTTP 200 quickly. Avoid infinite loops and long polling.
Keep helper files beside your bot and load them with __DIR__.
After editing files, use Restart to refresh the public runtime.
Use Terminal Logs when a webhook starts but the bot does not reply.
The saved dashboard token configures Telegram webhook controls; do not assume it is injected into your PHP script. Load a token server-side for API calls.
Runtime files are republished on Restart. Use a real external database/service for state that must survive deployments.
Dashboard workflow
How a developer publishes a PHP webhook bot here.
- 1Create a Telegram bot
Use
@BotFather, create the bot and copy its token. - 2Create the bot record
In the dashboard choose a name, token and language. For built-in hosting select PHP.
- 3Create
bot.phpUse the editor or File Manager. Upload helper files if your project needs them.
- 4Press Start
The platform validates the PHP entry file, syncs runtime files and asks Telegram to set the webhook.
- 5Test and inspect logs
Send
/start. After changes, save files and press Restart.
Control action reference
Developers and AI tools should understand what each dashboard action actually does.
| Action | Runtime behavior | When to use it |
|---|---|---|
| Start | Requires PHP + bot.php, checks syntax when server lint is available, publishes workspace files and sets Telegram webhook. | First launch after code is ready. |
| Deploy | Uses the same PHP webhook start pipeline and publishes the current workspace. | Publish a prepared version. |
| Restart | Force-stops current runtime, republishes files and sets a fresh webhook. | After changing code or helper files. |
| Stop | Removes Telegram webhook and marks the bot stopped. | Pause updates without deleting the bot record. |
| Force Stop | Removes webhook and deletes the public runtime directory. | Immediately disable published runtime files. |
| Admin Ban | Locks runtime/file mutations for the user and disables the public runtime until admin unbans. | Administrative enforcement only. |