Basic Telegram Bot

 import os
import logging
from telegram import Update
from telegram.ext import (


logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')

def start(update: Update, context: CallbackContext) -> None:
    update.message.reply_text("Hi! I am your BasicTelegramBot.")

def whats_up(update: Update, context: CallbackContext) -> None:
    update.message.reply_text("whats up?")

def main():

About this template

A good starting point for a telegram bot.

Introduction to the Basic Telegram Bot Template

Welcome to the Basic Telegram Bot template! This template is designed to help you create a simple Telegram bot that can respond to messages and commands. It's a great starting point for those who are new to building bots on the Telegram platform. The bot created with this template will greet users and respond to any text message with "What's up?"

Getting Started

To begin using this template, click on "Start with this Template" on the Lazy platform. This will set up the template in your Lazy Builder interface, pre-populating the code so you can start customizing your bot right away.

Initial Setup

Before you can start using your bot, you'll need to set up an environment secret for the TELEGRAM_API_TOKEN. Here's how to obtain and set up your TELEGRAM_API_TOKEN:

  • Open the Telegram app and search for the BotFather or go to
  • Start a chat with BotFather and send the command /newbot.
  • Follow the instructions to set up your new bot, providing a name and username.
  • Once your bot is created, BotFather will provide you with a token.
  • Copy this token.
  • Set this value in the Environment Secrets tab within the Lazy Builder.

For more information, refer to the Telegram Bot API documentation provided by the BotFather or visit


After setting up the TELEGRAM_API_TOKEN, press the "Test" button to begin the deployment of your bot. The Lazy CLI will handle the deployment process, and you won't need to provide any additional input at this stage.

Using the Bot

Once the bot is deployed, you can start interacting with it on Telegram. Send the command /start to your bot, and it will greet you with a message. Any text message you send to the bot will prompt a response of "What's up?"

Integrating the Bot

If you wish to integrate this bot into an external service or frontend, you will need to use the server link provided by the Lazy builder CLI after pressing the "Test" button. This link will allow you to interact with your bot through the Telegram API. You can add this link to any external tool that supports Telegram bot integration, following the specific instructions provided by that tool.

Remember, this template is just a starting point. You can expand your bot's capabilities by adding more commands, message handlers, and integrating with other services as needed. Enjoy building your Telegram bot!

Last published
June 15, 2024

More templates like this

Basic Telegram Bot

A good starting point for a telegram bot.


Emoji Financial News Bot

This app creates a Telegram bot that fetches the latest financial news from Bloomberg's RSS feed, analyzes the news titles using LLM ability, and shares it with users in the form of emoji representations. The user will be asked for their API token when they run the app.


Simple Telegram Bot

Simple Telegram Bot is a simple example Telegram bot that can receive and send messages, and handle a custom command /hey which responds with "What's up?".

Basic Telegram Bot