Skip to main content

TGCoreSDK | Enterprise Telegram Bot API Framework.

Project description

TGCore SDK

Enterprise Telegram Bot Framework • Secure • Scalable • Zero-Trust Ready

Maintained PRs Security Architecture FastAPI MongoDB Async Webhook tgcore

pre-commit Python PyPI Downloads Python License

The most secure Telegram Bot SDK ever built.

✨ Features

  • ⚡ Async native ("async/await")
  • 🔐 Secure API key authentication
  • 🤖 Multi-bot token support
  • 🔁 Token rotation ready
  • 🧩 Builder pattern + simple calls
  • 📦 Auto-generated methods from OpenAPI schema
  • 📚 Auto docstring generation
  • 🏗 Enterprise-ready architecture

📦 Installation

pip install tgcore

Or install locally:

pip install -e .


🔑 Authentication

Create client instance:

from tgcore import Client

client = Client("fw_live_xxx")

await client.telegram.send_message(
    chat_id="@channel",
    text="hello"
)

👾 Usage

sendMessage

# Latest version 1.0.16+
# Support Pyrogram/Kurigram (KeyboardBuilder)

from tgcore import Client, KeyboardBuilder

tg = Client()

async def send():
    await (
        tg.raw
        .sendMessage(
            chat_id=m.chat.id,
            text="Testing",
            reply_markup=(
                KeyboardBuilder()
                .url("This Url", "https://github.com/TeamKillerX/tgcore")
                .style("This color", "danger", callback_data="#abc")
                .build()
            )
        )
        .execute()
    )

New button

# old version: 1.0.14
from tgcore import Client, KeyboardBuilder

tg = Client()

async def use_pyrogram(m):
    await tg.telegram.send_message(
        chat_id=str(m.chat.id),
        text="This Button",
        reply_markup=(
            KeyboardBuilder()
            .row("GitHub", url="https://github.com")
            .row("Docs", url="https://www.learnpython.org/")
            .row("Pypi", url="https://pypi.org/project/tgcore/")
            .build()
        )

Simple Call

await client.telegram.send_message(
    chat_id="@channel",
    text="Hello world"
)

Builder Pattern

await (
    client.telegram
        .send_photo_call(chat_id="@channel", photo="https://img.jpg")
        .execute()
)

🔄 Token Rotation Support

The server supports storing encrypted tokens using AES-256-GCM. The SDK automatically uses the active token version.

🔒 Security Model

TgCoreSDK never exposes bot tokens to clients.

Flow:

Client → API Gateway → Decrypt → Telegram API

Benefits:

  • prevents token leaks
  • safe frontend usage
  • safe monitoring dashboards
  • supports IP restrictions

Why TGCore?

Unlike traditional Telegram SDKs, TGCore is built as a secure middleware layer that prevents token leaks, enforces API-key auth, and supports enterprise-grade scaling.

Designed for production, not demos.

Compared to Native Telegram API

Feature Telegram API TGCore
Token Exposure Yes No
Auth Layer None API Key + Secret
Proxy Support Manual Built-in
Multi Bot Limited Yes
Webhook Security Basic Zero-Trust

🧾 License

Licensed under Apache License 2.0

You may:

  • use commercially
  • modify
  • distribute
  • sublicense

🤝 Contributing

Pull requests welcome. For major changes, open an issue first to discuss what you would like to change.


🔥 Status

Production Ready


👑 Author

Built with ❤️ by Randy W

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tgcore-1.0.34.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tgcore-1.0.34-py3-none-any.whl (27.2 kB view details)

Uploaded Python 3

File details

Details for the file tgcore-1.0.34.tar.gz.

File metadata

  • Download URL: tgcore-1.0.34.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tgcore-1.0.34.tar.gz
Algorithm Hash digest
SHA256 40fb8c18f8fc77910e35b1bc89dd1669d7042a8dbf12a5531b275d25e1000235
MD5 32274b7627c4e9823e7dc97849e5954b
BLAKE2b-256 1cb23caea2993f6110eeafe20a3ef272890b2d7140dd7204d0f5cad09ef3049f

See more details on using hashes here.

File details

Details for the file tgcore-1.0.34-py3-none-any.whl.

File metadata

  • Download URL: tgcore-1.0.34-py3-none-any.whl
  • Upload date:
  • Size: 27.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tgcore-1.0.34-py3-none-any.whl
Algorithm Hash digest
SHA256 d7d57b844eeed33bcd397a41a1f2e6ab2e8d3458a187fc7ca5ffb5a4bee3f74b
MD5 e46ee661a726b29b3efeff4d8b1cc655
BLAKE2b-256 269fe18ce8c9b27b19af2b85c17e470ffb12781a4ece004e16fd01b49951e40e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page