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-connector

v1.0.0

Published

Approve/deny opencode tool calls (bash, read, edit, task) directly from Telegram

Readme

opencode-telegram-connector

Approve/deny opencode tool calls (bash, read, edit, task) directly from Telegram with inline Approve/Deny buttons.

  • 15s timeout — if Telegram doesn't respond, bash falls back to a terminal prompt
  • Per-tool icons — instantly see what tool is requesting permission
  • Zero terminal prompts — set permissions to "allow" and let Telegram be the gate

Installation

1. Create a Telegram bot

Open Telegram, talk to @BotFather and create a new bot:

/newbot

Name it something like opencode-gatekeeper. Save the bot token — it looks like:

1234567890:ABCdefGHIjklMNOpqrsTUVwxyz

2. Get your chat ID

Message your bot once (any message), then open this URL in your browser (replace <YOUR_TOKEN>):

https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates

Find your chat_id in the JSON response (it's a number like 123456789).

3. Install the plugin

Add the plugin to your global or project opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-telegram-connector"],
  "permission": {
    "bash": "allow",
    "read": "allow",
    "edit": "allow",
    "task": "allow"
  }
}

Setting permissions to "allow" is required — this skips opencode's built-in terminal prompts so Telegram is the sole gatekeeper.

4. Set environment variables

Add these to your shell config (~/.bashrc, ~/.zshrc, or .env):

export TELEGRAM_BOT_TOKEN="1234567890:ABCdefGHIjklMNOpqrsTUVwxyz"
export TELEGRAM_CHAT_ID="123456789"

5. Restart opencode

Quit and restart opencode. You should see this message in your Telegram chat:

opencode Telegram Connector is now active.

Usage

Whenever opencode tries to run a tool, the plugin sends a message to Telegram with Approve/Deny buttons:

| Tool | Icon | Telegram message shows | |--------|------|------------------------------| | bash | 🛠 | The shell command | | read | 📖 | The file path being read | | edit | ✏️ | The file path being edited | | task | 🧠 | The task description/prompt |

Tap Approve to allow or Deny to block the action.

Timeout behavior

  • 0–15s: Waiting for your tap on Telegram
  • After 15s: If no response, bash shows a terminal prompt (Allow? (y/n):). Other tools are automatically denied.
  • The terminal fallback itself waits 60s for your input.

Telegram commands

| Command | Description | |-------------|------------------------------------| | /pending | List all active permission requests | | /help | Show help message |


Security

  • The bot token grants full control of your bot. Keep it secret.
  • Only messages from your configured TELEGRAM_CHAT_ID are processed (callback queries and text commands).
  • All communication is over HTTPS with Telegram's API.
  • Telegraphic approval means an attacker who compromises your Telegram can approve commands — protect your Telegram account with 2FA.

Configuration reference

opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["opencode-telegram-connector"],
  "permission": {
    "bash": "allow",
    "read": "allow",
    "edit": "allow",
    "task": "allow"
  }
}

Environment variables

| Variable | Required | Description | |---------------------|----------|---------------------------------| | TELEGRAM_BOT_TOKEN| Yes | Bot token from @BotFather | | TELEGRAM_CHAT_ID | Yes | Your Telegram user/chat ID |


Development

git clone https://github.com/YOUR_USERNAME/opencode-telegram-connector.git
cd opencode-telegram-connector
npm install

Link locally for testing:

npm link
# Then in your opencode config:
# "plugin": ["opencode-telegram-connector"]

License

MIT