Enterprise Telegram Bot Framework • Secure • Scalable • Zero-Trust Ready
npm install @xtsea/tgcore-tsimport { tgcore, KeyboardBuilder } from "@xtsea/tgcore-ts"
// old version: 0.1.9 new Client({})
const tg = tgcore({ api_key: "fw_live_xxx" }) // latest version
await tg.raw.sendMessage({
chat_id: -1001234567890,
text: "Hello from tgcore-ts"
})
const keyboard = KeyboardBuilder
.inline()
.callback("Yes", "yes")
.callback("No", "no")
.build()
await tg.calls
.sendMessage()
.chatId(123)
.text("Confirm?")
.replyMarkup(keyboard)
.execute()Optional features
☐ Proxy support
☐ Webhook support
☐ TypeScript full-stack integration
☐ Multi bot token support
☐ Web-based API key management
☐ Security audit logging
☐ AES-256-GCM encryption
Optional: AES-256-GCM encryption for sensitive tokens
import httpx
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
router = APIRouter()
async def get_database_token():
# Your own code
# You need to add a database for example (mongodb, redis)
# Optional: AES-256-GCM
pass
class SendMessageBody(BaseModel):
# your own code
chat_id: int
text: str
@router.post("/api/v2/sendMessage")
async def send_message(body: SendMessageBody):
token = await get_database_token()
async with httpx.AsyncClient() as client:
r = await client.post(
f"https://api.telegram.org/bot{token}/sendMessage",
json={
"chat_id": body.chat_id,
"text": body.text
}
)
return r.json()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.
| 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 |
Licensed under Apache License 2.0
You may:
- use commercially
- modify
- distribute
- sublicense
Pull requests welcome. For major changes, open an issue first to discuss what you would like to change.