An enhanced TypeScript SDK for Telegram Web Apps (TWA), providing easy access to user data and Telegram Bot API functionality.
Join our Telegram group: https://t.me/TeleDeveloperz
- 🚀 TypeScript support for better developer experience
- 👤 Easy access to TWA user data
- 🤖 Integration with Telegram Bot API
- 🛠 Utility functions for common TWA operations
- 📦 Lightweight and easy to integrate
npm install @teledeveloperz/twa-sdk
import { TWASDK } from "@teledeveloperz/twa-sdk";
// Initialize the SDK with the TWA init data
const sdk = new TWASDK(window.Telegram.WebApp.initData);
// Access user information
console.log(sdk.user.getFullName());
// Make API calls
sdk.getBotInfo().then(botInfo => {
console.log("Bot info:", botInfo);
});
The main class for interacting with the TWA SDK.
new TWASDK(initData: string)
initData
: The initialization data provided by Telegram Web App.
user
: An instance ofTelegramUser
containing user information.
getBotInfo()
: Fetches information about the bot.getUserProfilePhotos(userId: number)
: Fetches profile photos for a given user ID.
A class representing the Telegram user.
getId()
: Returns the user's ID.getFullName()
: Returns the user's full name.getUsername()
: Returns the user's username.
For more advanced usage and examples, please refer to our documentation.
We welcome contributions! Please see our Contributing Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please file an issue on our GitHub repository or join our Telegram group for community support.