Skip to content

XpressAI/xai-telegram

Repository files navigation

Component LibrariesProject Templates
DocsInstallTutorialsDeveloper GuidesContributeBlogDiscord

Xircuits Component Library to interface with Telegram! Create Telegram Bots in minutes.
Uses python-telegram-bot as backend.


Xircuits Component Library for Telegram

This library enables Xircuits to integrate with Telegram, allowing seamless interaction with Telegram bots. It simplifies bot initialization, message handling, and various types of media sharing.

Table of Contents

Preview

Screencast_20250207_113522.mp4

Prerequisites

Before you begin, you will need:

  1. Python 3.9+
  2. Xircuits
  3. A Telegram Bot Token

Try The Examples

We have provided an example workflow to help you get started with the Telegram component library. Give it a try and see how you can create custom Telegram components for your applications.

TelegramEchoBot

Simple bot that echoes back any message it receives - perfect for understanding the basic bot setup.

TelegramMessageReplyBot

Demonstrates how to use Xircuits events to create custom message handling and responses.

TelegramCommandBot

Shows how to implement command-based interactions (e.g., /start, /help) with argument parsing.

TelegramReplyMedia

Showcases how to send various media types (images, PDFs, audio, video) in response to messages.

Coming Soon (TBA)

  • Enhanced group chat support (currently optimized for 1-1 chats)
  • Media reception capabilities (currently supports sending media only)
  • Other cool stuff

Telegram Bot Setup

Creating a New Bot

  1. Start a chat with @BotFather on Telegram
  2. Use the /newbot command
  3. Follow the prompts to:
    • Set a name for your bot
    • Choose a username (must end in 'bot')
  4. BotFather will provide a token - save this securely

Bot Token

  • Keep this token secure - anyone with the token can control your bot
  • export this token or create a .env file with TELEGRAM_BOT_KEY=YOUR_TOKEN.

Important Notes

  • Bot usernames must end in 'bot' (e.g., 'tetris_bot' or 'TetrisBot')
  • Usernames are 5-32 characters long
  • Only Latin characters, numbers, and underscores are allowed
  • Username cannot be changed after creation

Installation

To use this component library, ensure you have an existing Xircuits setup. You can then install this library using:

xircuits install telegram

Or manually:

# in base Xircuits directory
git clone https://github.com/XpressAI/xai-telegram xai_components/xai_telegram
pip install -r xai_components/xai_telegram/requirements.txt

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages