Skip to main content
Home ← Telegram bot source ← Welcome Telegram bot source
Level: beginner

Welcome Telegram bot source

Download the free source of the simplest Telegram bot that greets the user and echoes their messages, with a full step-by-step guide. Written in Python with only the requests library.

WHAT_Welcome Telegram bot source

A minimal but complete starting point to understand how a Telegram bot works.

👋 Sends a welcome message on /start
🔁 Echoes back the user’s text
🐍 Pure Python, only the requests library
📦 Zero extra dependencies
This bot is the ideal first step for learning: once you understand this loop of receiving and sending a message, all the other bots are just an extension of it.

Step-by-step setup guide

Follow these steps in order to get the bot running on your system or server.

Create a bot with @BotFather in Telegram and copy its token.
Install Python, then run pip install requests in the terminal.
Paste the token into the TOKEN variable and run python bot.py.
Send /start to your bot in Telegram and see the welcome message.

The full bot source (copy or download)

This is the same code as in the ZIP file. You can copy it right from here. Just remember to replace the TOKEN value with your own bot token.

bot.py
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
#  Welcome Telegram bot  |  Built by Filtor (filtori.com)
# ------------------------------------------------------------
#  This is the simplest possible example:
#   - sends a welcome message on the /start command
#   - echoes back any text message the user sends
#  Written using only the requests library, with no other dependency.
#
#  Note: a Telegram bot must run on a server that has access
#     to api.telegram.org.
#
#  Full illustrated guide:
#     https://filtori.com/en/telegram-bot-source/welcome-bot/
#  Need a professional, custom version? Call: +98 912 287 4862
#  Or message us on Telegram: https://t.me/filtori
# ------------------------------------------------------------

import time
import requests

# 1) Get your bot token from @BotFather in Telegram and paste it here.
TOKEN = "PASTE_YOUR_BOT_TOKEN_HERE"

# Telegram API base address
BASE = f"https://api.telegram.org/bot{TOKEN}"


def send_message(chat_id, text):
    """Send a text message to the user."""
    url = f"{BASE}/sendMessage"
    data = {"chat_id": chat_id, "text": text}
    try:
        requests.post(url, json=data, timeout=15)
    except requests.RequestException as error:
        print("Error sending message:", error)


def get_updates(offset):
    """Fetch new messages using long polling."""
    url = f"{BASE}/getUpdates"
    params = {"offset": offset, "timeout": 30}
    try:
        response = requests.get(url, params=params, timeout=40)
        return response.json()
    except requests.RequestException as error:
        print("Error fetching messages:", error)
        return {"ok": False, "result": []}


def main():
    print("Filtor welcome bot is running... (press Ctrl+C to stop)")
    offset = 0  # id of the last update we processed

    while True:
        updates = get_updates(offset)

        if not updates.get("ok"):
            time.sleep(2)  # on error, wait a bit and try again
            continue

        for update in updates.get("result", []):
            offset = update["update_id"] + 1

            message = update.get("message")
            if not message:
                continue

            chat_id = message["chat"]["id"]
            text = message.get("text", "")

            if text == "/start":
                send_message(
                    chat_id,
                    "Hi 👋 Welcome to our bot!\n"
                    "Whatever you type, I will send it right back to you.\n"
                    "This bot was built with ❤️ by Filtor: filtori.com",
                )
            elif text:
                send_message(chat_id, f"You said: {text}")

        time.sleep(0.5)


if __name__ == "__main__":
    main()
The full source of this bot ↑ — copy or download it now

Is this Telegram bot source really free?

Yes, the full source of the welcome bot is completely free and downloadable without registration. You can use it in your own projects.

What do I need to run it?

Just Python and the requests library, plus a bot token from BotFather. No database or extra tools are needed for this bot.

Does the bot work on any server?

The bot needs a server that can reach api.telegram.org. If you want us to set it up on a stable server for you, the Filtor team can help.

about this bot

Is this Telegram bot source really free?

Yes, the full source of the welcome bot is completely free and downloadable without registration. You can use it in your own projects.

What do I need to run it?

Just Python and the requests library, plus a bot token from BotFather. No database or extra tools are needed for this bot.

Does the bot work on any server?

The bot needs a server that can reach api.telegram.org. If you want us to set it up on a stable server for you, the Filtor team can help.

CTA_Welcome Telegram bot source

The Filtor team builds a custom Telegram bot with an admin panel, database and payment, tailored to your business — from a simple welcome bot to a full sales system.

Other Telegram bot sources

→ Back to all sources   Estimate the cost of a custom bot