Skip to content

TeamKillerX/tgcore-ts

Repository files navigation

TGCore TS SDK

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

Maintained PRs Security Architecture FastAPI MongoDB Async Webhook tgcore

pre-commit

npm downloads license

Install

npm install @xtsea/tgcore-ts

Getting started

import { 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()

Reference Backend (FastAPI)

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()

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.


About

TgCore Typescript • Official Telegram SDK Framework

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors