TGCoreSDK | Enterprise Telegram Bot API Framework.
Project description
TGCore SDK
Enterprise Telegram Bot Framework • Secure • Scalable • Zero-Trust Ready
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()
)
Rest API & TgCore Bot
from tgcore import Client, KeyboardBuilder
tg = Client()
async def pinterest_images(q: str):
kw = await tg._post(
"/api/web/pinterest",
payload={"query": q}
)
like_ts = tg.to_obj(kw)
if not like_ts.ok or not like_ts.data:
return None
return like_ts.data.pins[1].media.images.orig.url
async def send_photo():
newurl = await pinterest_images("Real coding")
resp = await tg.raw.sendPhoto(
chat_id=-100123456789,
photo=newurl,
reply_markup=(
KeyboardBuilder()
.url("View Pinterest", newurl)
.url("Tgcore on PyPI", "https://pypi.org/project/tgcore/")
.row()
.url("Tgcore on NPMJS", "https://www.npmjs.com/package/@xtsea/tgcore-ts")
.build()
)
).execute()
return tg.to_obj(resp).ok
🔄 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tgcore-1.0.41.tar.gz.
File metadata
- Download URL: tgcore-1.0.41.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
733ff4b2a2e6fa9d69552df40073c0f19098bdd24e4f65cb72b6c981befb02ec
|
|
| MD5 |
ddc0c0d901db6fe9cdee521a4e284102
|
|
| BLAKE2b-256 |
f6cc6d74b3d1fe4019a8c7ebeaaf0add6a2bda9f9c3c9540c2a3cfb9fdc41b6c
|
File details
Details for the file tgcore-1.0.41-py3-none-any.whl.
File metadata
- Download URL: tgcore-1.0.41-py3-none-any.whl
- Upload date:
- Size: 27.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d24e57d938f68c6dae85201e8986731bee380316f5a88f05e4829493edd6fd42
|
|
| MD5 |
85b75a0a7dc3cd22828c2f6a813e09b6
|
|
| BLAKE2b-256 |
23a20c2865fe94ee7d3545320ca8681efbd5450b6484c22c4b69d0b1ec162d06
|