Getting started¶
This page takes you from a new account to a running bot. Use the python-webhook example the first time: it deploys without changes and receives updates by webhook, the recommended mode on BotBarn.
1. Create your account¶
Press Continue with Telegram and confirm in Telegram. That is all: no email or password needed. You can add an email later in Account.
If you prefer, sign up with your email and a password under or use email, and open the link in the verification email. You can link Telegram later in Account. See Telegram.
Then open @botbarn_app in Telegram: the BotBarn app there shows your bots, starts and stops them, and is where you pay for plans.
2. Create the bot on Telegram¶
- Open @BotFather in Telegram.
- Send
/newbot, choose a display name and a username ending inbot. - Copy the token BotFather sends you. It looks like
123456789:AA....
Keep the token secret
Anyone with the token controls your bot. Paste it only in BotBarn, never in your code or in a public repository. See Telegram token.
3. Create the bot on BotBarn and pay for its plan¶
- Press New bot.
- Choose a plan. Each card shows the price in Telegram Stars, how many days it lasts and, when the plan sets them, the CPU and memory your bot gets.
- Name the bot and review the summary: what you pay, and the date the service ends.
- Press Pay in Telegram and pay in Telegram Stars in the BotBarn app (how). When the payment goes through, the bot is created. The free plan needs no payment.
If you cancel the payment, nothing is created and nothing is charged. See Plans, expiry and renewal.
4. Add the token¶
On the bot's Overview, paste the token in the Telegram card. BotBarn asks Telegram who owns
the token, shows the bot's @username, and saves the token as the secret variable
TELEGRAM_BOT_TOKEN.
5. Connect your code¶
Open the bot's Source tab and either:
- Use the example bot: one click adds a small Python bot that answers
/startand repeats your messages (long polling). Deploy it to see your bot working, then replace it with your own code; - Upload archive: a
.zip,.tar.gzor.tgzup to 20 MB, for example python-webhook.zip; or - GitHub / Git: the HTTPS URL of the repository and the branch. Add an access token for a private repository.
What the code must contain: Preparing your code.
6. Deploy¶
Press Deploy on the Overview. The status moves through Queued, Building, Starting
and Running. Send /start to your bot in Telegram: it answers.
If the status ends in Failed, open Logs and read Troubleshooting.
Next steps¶
- Use the webhook in your own bot too: Polling or webhook.
- Add the settings your bot needs on the Variables tab: Variables and secrets.
- Learn what happens when you deploy again or the bot crashes: Deploys, statuses and logs.