@tribute-tg/sdk
Developer-friendly & type-safe Typescript SDK specifically catered to leverage Tribute API.
SDK Installation
The SDK can be installed with either npm, pnpm, bun or yarn package managers.
NPM
npm add @tribute-tg/sdkPNPM
pnpm add @tribute-tg/sdkBun
bun add @tribute-tg/sdkYarn
yarn add @tribute-tg/sdk zod
# Note that Yarn does not install peer dependencies automatically. You will need
# to install zod as shown above.[!NOTE] This package is published with CommonJS and ES Modules (ESM) support.
Preparation
Authorization token can be obtained from a network request in the web version of Telegram while using the Tribute mini-app. See
Authorizationheader (in the request with tribute.tg host) and copy value afterTgAuthprefix.
API key can be obtained from the Tribute Developers Settings page: https://wiki.tribute.tg/for-content-creators/api-documentation#how-to-get-an-api-key
# .env
TG_AUTH_TOKEN=...
TRIBUTE_API_KEY=...SDK Example Usage
Example
import { Tribute } from '@tribute-tg/sdk';
const tribute = new Tribute({ token: process.env.TG_AUTH_TOKEN, apiKey: process.env.TRIBUTE_API_KEY });
async function run() {
const result = await tribute.getDashboard();
// Handle the result
console.log(result);
}
run();