Skip to main content

Quick Start

Get a real Telegram bot replying to you in about five minutes.

1. Create a bot

In Botgami, click New Bot. You land in the workspace: a code editor on one side, a live visual graph of your flows on the other, and a Variables panel for state and secrets.

2. Paste a starter

Replace the editor contents with this:

bot QuickStart {
user clicks: Number = 0

// A named menu — declared once, attached to any message with reply_markup.
menu mainMenu {
text "👆 Click me" -> handleClick()
url "📖 Docs" "https://docs.botgami.app"
}

flow start on command "/start" {
send.text("👋 Welcome! Tap the button or send /help.", reply_markup: mainMenu)
}

// Button handler — the runtime calls this when "Click me" is tapped.
subflow handleClick() {
set { user.clicks += 1 }
send.text(`You've clicked ${user.clicks} time(s).`)
}

flow help on command "/help" {
send.text("/start — open the menu\n/help — this message")
}
}

As you type, the editor checks your code and the graph updates to show the flows and the menu. If anything is wrong, you'll see a red underline with a hover explanation.

3. Connect Telegram

You need a bot token from Telegram's @BotFather. Open the Connect panel, paste the token, and Botgami wires everything up. Full walkthrough: Connecting Telegram.

4. Publish and try it

Click Publish. Open your bot in Telegram and send /start. Tap the button — the count goes up and persists, because user.clicks is stored per user.

What just happened

  • bot QuickStart { ... } declares your bot.
  • user clicks: Number = 0 is a persistent per-user variable.
  • menu mainMenu { ... } declares a named keyboard that re-renders from current state on every press.
  • Each flow ... on <trigger> { ... } runs when that trigger fires.
  • subflow handleClick() { ... } is the button handler — the menu routes each press here automatically.
  • send.text(..., reply_markup: mainMenu) attaches the menu to a message.
  • set { ... } writes variables; ${...} interpolates values into backtick templates.

Next steps