BotBhai
BotBhaiDeveloper Docs
Public developer documentation

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.

Platform runtime compatibility

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.

01

Choose your implementation

Each option is separate, with its own architecture and deployment rules.

02

The platform contract

These rules are the most important part of building a compatible bot.

Entrypoint

For built-in hosting, the main file must be named bot.php.

Webhook input

Read Telegram's JSON update from php://input.

Fast response

Return HTTP 200 quickly. Avoid infinite loops and long polling.

Relative files

Keep helper files beside your bot and load them with __DIR__.

Publish changes

After editing files, use Restart to refresh the public runtime.

Observe logs

Use Terminal Logs when a webhook starts but the bot does not reply.

Token boundary

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.

Durable state

Runtime files are republished on Restart. Use a real external database/service for state that must survive deployments.

03

Dashboard workflow

How a developer publishes a PHP webhook bot here.

  1. 1
    Create a Telegram bot

    Use @BotFather, create the bot and copy its token.

  2. 2
    Create the bot record

    In the dashboard choose a name, token and language. For built-in hosting select PHP.

  3. 3
    Create bot.php

    Use the editor or File Manager. Upload helper files if your project needs them.

  4. 4
    Press Start

    The platform validates the PHP entry file, syncs runtime files and asks Telegram to set the webhook.

  5. 5
    Test and inspect logs

    Send /start. After changes, save files and press Restart.

04

Control action reference

Developers and AI tools should understand what each dashboard action actually does.

ActionRuntime behaviorWhen to use it
StartRequires PHP + bot.php, checks syntax when server lint is available, publishes workspace files and sets Telegram webhook.First launch after code is ready.
DeployUses the same PHP webhook start pipeline and publishes the current workspace.Publish a prepared version.
RestartForce-stops current runtime, republishes files and sets a fresh webhook.After changing code or helper files.
StopRemoves Telegram webhook and marks the bot stopped.Pause updates without deleting the bot record.
Force StopRemoves webhook and deletes the public runtime directory.Immediately disable published runtime files.
Admin BanLocks runtime/file mutations for the user and disables the public runtime until admin unbans.Administrative enforcement only.
AI-ready specification

Give an AI the exact runtime contract.

Use the prepared prompt to generate a compatible project instead of generic Telegram bot code.

Open AI Guide