npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tonsolutions/telemetree-node

v0.2.7

Published

The Telemetree Node SDK provides a convenient way to track and analyze Telegram events using the Telemetree service.

Downloads

490

Readme

Telemetree SDKs for Telegram Mini App Analytics

Telemetree is a comprehensive free analytics tool designed specifically for Telegram Mini Apps. With our SDKs, developers, marketers, and product managers can easily track and optimize user engagement, making data-driven decisions to boost user acquisition and retention. Telemetree simplifies Analytics for Telegram Mini Apps by delivering insights into user behaviors, acquisition channels, and in-app interactions.

Key Features

  • Real-Time Analytics: Monitor user activity within your Telegram Mini App in real-time.
  • User Retention Metrics: Track returning users and pinpoint which features encourage app retention.
  • Web3 data: discover web3 metrics associated with your users.
  • Seamless Integration: Our SDKs are lightweight and integrate easily with auto event mapping.
  • Telegram-native: Telemetree is built natively for Telegram.
  • User segmentation: API for personalized notifications based on cohorts, completed actions. web3 data and more.
  • Free tier with wide limits.

Why Use Telemetree for Telegram Mini App Analytics?

Telemetree is uniquely focused on the needs of Telegram Mini App developers, providing tailored metrics and insights that help you grow and retain your user base efficiently. As the demand for Analytics for Telegram Mini Apps grows, Telemetree remains at the forefront, offering tools that cater specifically to the Telegram ecosystem.

Start capturing valuable insights with Telemetree and make data-driven decisions for your app's growth on Telegram.

Resources

Consider visiting our resources for more info about the state of the Telegram Mini Apps ecosystem and Telegram analytics.

NodeJS SDK Features

  • Easy integration with Telegram bot backends
  • Secure event encryption
  • Automatic event capturing
  • Customizable event tracking
  • Comprehensive error handling and logging

A Tutorial With A Sample App

Check out our full tutorial to learn how to set up Telemetree for your NodeJS Telegram bot.

Installation

npm install @tonsolutions/telemetree-node

Quick Start

  1. First, obtain your Telemetree API credentials:

    • Project ID
    • API Key
  2. Initialize the Telemetree client in your bot:

const { TelemetreeClient } = require('@tonsolutions/telemetree-node');

const telemetree = new TelemetreeClient(
    process.env.TELEMETREE_PROJECT_ID,
    process.env.TELEMETREE_API_KEY
);

// Initialize the client before using
await telemetree.initialize();
  1. Set up event tracking in your bot handlers:
// Example with node-telegram-bot-api
bot.on('message', async (msg) => {
    try {
        // Track the update
        const response = await telemetree.trackUpdate(msg);
        console.log('Tracking response:', response);
    } catch (error) {
        console.error('Failed to track message:', error);
    }
});

Configuration

Create a .env file with your Telemetree credentials:

TELEMETREE_PROJECT_ID=your-project-id
TELEMETREE_API_KEY=your-api-key

Event Tracking

The SDK automatically tracks various Telegram events:

  • Messages
  • Edited messages
  • Commands
  • Inline queries
  • And more...

Custom Event Tracking

You can also track custom events:

await telemetree.trackEvent({
    event_type: 'custom_event',
    event_data: {
        // your custom data
    }
});

Error Handling

The SDK provides comprehensive error handling:

try {
    await telemetree.trackUpdate(update);
} catch (error) {
    if (error.name === 'CustomEventNotSupported') {
        // Handle unsupported event
    } else {
        // Handle other errors
    }
}

Response Logging

The SDK provides detailed response logging:

{
    success: true/false,
    status: 200,
    statusText: 'OK',
    data: {...},
    headers: {...},
    requestTime: '2024-11-26T01:48:24.745Z'
}

Encryption

The SDK uses RSA encryption to secure event data before sending it to the Telemetree service, ensuring data privacy. The publicKey is fetched automatically from the Telemetree configuration service during initialization, so there’s no need to manually set it.

Other SDKs

Telemetree SDKs are available for various frameworks and environments, making it easy to incorporate powerful analytics into any Telegram Mini App.

  • React SDK: https://github.com/TONSolutions/telemetree-react
  • Javascript integration: https://github.com/TONSolutions/telemetree-pixel
  • Python SDK: https://github.com/TONSolutions/telemetree-python
  • .NET SDK: https://github.com/MANABbl4/Telemetree.Net (community-supported)

License

This SDK is licensed under the MIT License.