Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@tribute-tg/sdk

vitalygashkov313MIT0.1.2TypeScript support: included

Unofficial Tribute SDK for Node.js and browsers

tribute, telegram, donate, payments, subscriptions, monetization

readme

@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/sdk

PNPM

pnpm add @tribute-tg/sdk

Bun

bun add @tribute-tg/sdk

Yarn

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 Authorization header (in the request with tribute.tg host) and copy value after TgAuth prefix.

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