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 🙏

© 2026 – Pkg Stats / Ryan Hefner

plugin-pingpal-telegram

v1.0.0-beta.33

Published

Plugin starter for elizaOS

Readme

PingPal Telegram Plugin for ElizaOS

The pingpal-telegram plugin is a component for ElizaOS designed to help users manage Telegram notification overload. It monitors specified Telegram groups for mentions of a designated target user, analyzes the importance of these mentions using a Language Model (LLM), and delivers private notifications only for critical messages.

Features

  • Telegram Group Monitoring: Actively listens to messages in Telegram groups where the bot (agent) is a member.
  • Targeted Mention Detection: Identifies mentions of a pre-configured targetUsername.
  • LLM-Powered Importance Analysis: Leverages an LLM (e.g., OpenAI, Anthropic) via ElizaOS's runtime.useModel to determine if a mention is important or actionable for the target user.
  • Private Notifications: Sends direct messages via Telegram to the configured targetUserId for messages classified as important.
  • Deduplication: Prevents sending multiple notifications for the exact same message instance.
  • Configurable: Key parameters like API tokens, target user details, and LLM settings are configurable through environment variables and ElizaOS character settings.

How it Works

  1. The plugin, integrated into an ElizaOS agent, uses @elizaos/plugin-telegram to receive messages from Telegram groups.
  2. When a message is received (EventType.MESSAGE_RECEIVED), the handleTelegramMessage handler checks if the configured targetUsername (e.g., alireza7612) is mentioned.
  3. If a new, unprocessed mention is detected, the performMentionAnalysis function is invoked.
    • Deduplication is handled by logging processed message IDs to the ElizaOS database (PGLite via @elizaos/plugin-sql) using runtime.createMemory and checking with runtime.getMemories against a custom table type (pingpal_telegram_processed).
  4. An LLM is called via runtime.useModel with a prompt asking it to classify the message's importance for the target user and provide a reason, expecting a JSON response like {"important": boolean, "reason": string}.
  5. If the LLM deems the message important, the sendPrivateNotification function formats a notification.
  6. The notification (including the original message, sender, group, and LLM's reason) is sent as a private Telegram message to the targetUserId using the Telegram service provided by @elizaos/plugin-telegram.

Prerequisites

Before using this plugin, ensure you have:

  • An existing ElizaOS project setup.
  • Node.js (v23.3.0+ recommended, as per ElizaOS docs).
  • Bun installed.
  • The ElizaOS CLI installed globally (e.g., npm install -g @elizaos/cli@beta).
  • A Telegram Bot Token for the bot you intend to run.
  • An API key for your chosen LLM provider (e.g., OpenAI, Anthropic).
  • The numerical Telegram User ID of the person who should receive the private notifications.

Setup and Configuration

Follow these steps to integrate and configure the pingpal-telegram plugin in your ElizaOS project:

1. Obtain the Plugin Code

Clone this repository or install it if it's published as an npm package.

git clone https://github.com/your-repo-path/plugin-pingpal-telegram.git # Or your fork

2. Install Plugin Dependencies (if cloned locally)

Navigate to the plugin's directory and install its dependencies:

cd path/to/plugin-pingpal-telegram
bun install

3. Link the Plugin to Your ElizaOS Project (if cloned locally)

  • In the plugin-pingpal-telegram directory:
    bun link
  • In your main ElizaOS project's root directory: bash bun link pingpal-telegram If you've installed it as a package, ensure it's listed in your main project's package.json and installed.

4. Install Required Peer Plugins in Your Main ElizaOS Project

Before configuring your agent, ensure that the necessary peer plugins, @elizaos/plugin-telegram and @elizaos/plugin-sql, are installed in your main ElizaOS project. These are essential for the pingpal-telegram plugin to function.

Navigate to your main ElizaOS project's root directory and run:

# In your main ElizaOS project directory
bun add @elizaos/plugin-telegram @elizaos/plugin-sql

This command will add them to your project's package.json and install them.

5. Configure Your Agent's Character (src/index.ts in your main ElizaOS project)

Modify your agent's character definition to include this plugin and its dependencies, along with necessary settings:

import type {
  Character,
  Project,
  ProjectAgent,
  IAgentRuntime,
} from "@elizaos/core";
// Assuming plugin-pingpal-telegram is linked or installed as a dependency
import pingPalTelegramPlugin from "pingpal-telegram";
// Required peer plugins
// import telegramPlugin from '@elizaos/plugin-telegram'; // ElizaOS often auto-loads registered plugins
// import sqlPlugin from '@elizaos/plugin-sql';

export const character: Character = {
  name: "MyPingPalEnabledAgent",
  plugins: [
    "@elizaos/plugin-telegram", // For Telegram connectivity
    "@elizaos/plugin-sql", // For database operations (deduplication)
    pingPalTelegramPlugin, // This PingPal plugin
  ],
  settings: {
    // Secrets for API keys - will be sourced from .env
    secrets: {
      TELEGRAM_BOT_TOKEN: process.env.TELEGRAM_BOT_TOKEN,
      OPENAI_API_KEY: process.env.OPENAI_API_KEY, // Or ANTHROPIC_API_KEY, etc.
    },
    // Configuration for the @elizaos/plugin-sql
    sql: {
      adapter: "pglite", // Using PGLite for simple setup
      // connectionString: "pglite://data/mydb.pglite" // Optional: specify path
    },
    // Configuration specific to the pingpal-telegram plugin
    pingpal: {
      // The Telegram username (without '@') of the user to monitor for mentions.
      targetUsername: "your_telegram_username_to_monitor",
      // The numerical Telegram User ID of the user who will receive private notifications.
      targetUserId: "YOUR_NUMERICAL_TELEGRAM_USER_ID",
    },
    // Optional: LLM model selection (defaults are used if not specified)
    // models: {
    //   default: ModelType.OBJECT_SMALL // As used in messageHandler.ts
    // }
  },
  bio: [
    "I monitor Telegram groups for important mentions and notify my target user.",
  ],
  // ... other character properties (style, etc.)
};

export const projectAgent: ProjectAgent = {
  character,
  init: async (runtime: IAgentRuntime) => {
    console.log(
      "Initializing agent with PingPal capabilities:",
      character.name
    );
    // You can access plugin settings here for validation if needed:
    // const targetUser = runtime.getSetting('pingpal.targetTelegramUserName');
    // console.log('PingPal will monitor for:', targetUser);
  },
};

const project: Project = {
  agents: [projectAgent],
};

export default project;

6. Create/Update Environment Variables (.env file)

In the root directory of your main ElizaOS project, create or update the .env file:

TELEGRAM_BOT_TOKEN=YOUR_TELEGRAM_BOT_TOKEN_HERE
OPENAI_API_KEY=YOUR_OPENAI_API_KEY_HERE
PINGPAL_TARGET_TELEGRAM_USERID=TELEGRAM_TARGET_USER_ID_HERE
PINGPAL_TARGET_TELEGRAM_USERNAME=TELEGRAM_USERNAME_HERE
# Or ANTHROPIC_API_KEY=YOUR_ANTHROPIC_KEY_HERE, etc., based on your LLM choice

ElizaOS will automatically load these.

7. Crucial: Target User Interaction with Bot

The Telegram user specified by pingpal.targetTelegramUserId MUST initiate a conversation with your Telegram bot (e.g., send /start or any message) at least once after the bot is running. This is a Telegram API requirement that allows the bot to send private messages to that user.

8. Install Dependencies in Your Main ElizaOS Project

Navigate to your main ElizaOS project's root directory and run: