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

opencode-telegram-notification

v0.3.1

Published

OpenCode plugin that sends Telegram notifications on session idle, permission requests, and errors

Readme

opencode-telegram-notification

OpenCode plugin that sends Telegram notifications via LLM tool calls and critical event hooks, with bidirectional reply support.

Installation

bun add opencode-telegram-notification
# or
npm install opencode-telegram-notification

Then add the plugin to your opencode.json:

{
  "plugin": ["opencode-telegram-notification"]
}

Setup

1. Create a Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Send /newbot and follow the prompts
  3. Copy the bot token BotFather gives you

2. Set the Bot Token

export OPENCODE_NOTIFICATION_TELEGRAM_BOT_TOKEN="your-bot-token"

3. Send a Message to Your Bot

Open your bot in Telegram and send any message (e.g. "hello"). The plugin will automatically detect your chat_id on startup.

That's it! The plugin will start sending notifications and listening for your replies.

Environment Variables

| Variable | Required | Description | |---|---|---| | OPENCODE_NOTIFICATION_TELEGRAM_BOT_TOKEN | Yes | Bot token from BotFather | | OPENCODE_NOTIFICATION_TELEGRAM_CHAT_ID | No | Chat ID (auto-detected if not set) |

How It Works

Tool: send_notification

The plugin registers a send_notification tool that the LLM can call to send you a Telegram message. The LLM decides when to notify you — typically after completing a significant task or when it has important information you should see while away.

Urgency levels:

| Level | Behavior | |---|---| | low | Silent notification (no sound) | | normal | Default notification | | high | Ensures notification sound |

Event-Based Notifications

The plugin automatically sends notifications for critical events:

  • permission.updated — LLM needs your permission to proceed
  • question.asked — LLM asked a question that needs your answer
  • session.error — Session encountered an error

Duplicate notifications for the same event within 10 seconds are suppressed. Notifications from child sessions (subagents) are filtered out.

Reply-to-Prompt

Reply to any bot notification in Telegram and your message will be injected as a prompt into the corresponding OpenCode session. The agent will process your request and send the result back via notification.

  • Reply is confirmed with a 👍 reaction on your message
  • If the reply fails, a 👎 reaction is shown instead
  • The agent is instructed to notify you of the result since you're away from the terminal
  • Messages sent directly in the terminal are not affected

This creates a bidirectional loop: notification → reply → agent processes → notification → reply...

Polling

The plugin uses Telegram long-polling (getUpdates with 30s timeout) to listen for replies. This runs in the background with minimal resource usage. Polling stops automatically after 3 consecutive failures.

License

MIT