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

openclaw-telegram-mock-channel

v0.1.0

Published

OpenClaw telegram-mock channel plugin

Readme

telegram-mock-channel

telegram-mock-channel is an OpenClaw plugin that simulates Telegram channel behavior for local and CI tests.

It is designed for recipe/integration tests where you want Telegram semantics without external Telegram network dependencies.

What is implemented in this repository

  • Standalone OpenClaw plugin package scaffold (openclaw.plugin.json, index.ts).
  • In-process mock HTTP service with account-scoped state.
  • MVP mock APIs:
    • POST /v1/mock/telegram/{account}/inbound/message
    • POST /v1/mock/telegram/{account}/inbound/callback_query
    • GET /v1/mock/telegram/{account}/outbound
    • POST /v1/mock/telegram/{account}/outbound/drain
    • POST /v1/mock/telegram/{account}/reset
    • GET /v1/mock/telegram/{account}/health
  • Outbound queue model with per-account monotonic seq.

Current status

This repo is in MVP phase.

  • Implemented: mock state store, HTTP protocol, plugin wiring, lifecycle-bound server startup.
  • Pending for full parity: bridging inbound updates into OpenClaw's Telegram runtime chain and capturing editMessageText/answerCallbackQuery from Telegram adapter internals.

The code exposes setTelegramMockBridge(...) and recordOutboundEvent(...) to integrate with a host-side bridge. For OpenClaw host integration helpers, use installTelegramMockBridge(...) and recordTelegramOutboundCall(...).

Bridge into OpenClaw Telegram runtime

In the host integration layer, wire mock inbound updates into the same Telegram inbound pipeline you already use in gateway runtime.

Example integration sketch:

import {
  installTelegramMockBridge,
  recordTelegramOutboundCall,
} from "@renorzr/telegram-mock-channel";

installTelegramMockBridge(async ({ accountId, update }) => {
  // Forward to Telegram channel inbound processor in OpenClaw.
  await telegramRuntime.handleUpdate({ accountId, update });
});

function onTelegramApiCall(accountId: string, method: string, payload: Record<string, unknown>) {
  recordTelegramOutboundCall({
    accountId,
    method,
    payload,
  });
}

This lets tests inject mock inbound events, while your runtime path remains close to real Telegram channel behavior.

See docs/openclaw-host-integration.md for recommended host patch points in openclaw/openclaw.

Install

npm install

Build and test

npm run build
npm run typecheck
npm test

Run a single test file:

node --test dist/tests/state-store.test.js

Run a single test by name:

node --test --test-name-pattern "seq is isolated by account" dist/tests/state-store.test.js

Plugin usage (OpenClaw)

  1. Build plugin.
  2. Load plugin from compiled output directory.
  3. Configure channels["telegram-mock"] in OpenClaw config.

Example config:

{
  channels: {
    "telegram-mock": {
      enabled: true,
      mock_bind: "127.0.0.1:18790",
      mode: "webhook",
      accounts: {
        default: {
          enabled: true
        }
      }
    }
  }
}

Security defaults

  • Bind defaults to loopback (127.0.0.1:18790).
  • Optional bearer protection via mock_api_key.
  • Account state is isolated in memory.

Design doc

See telegram-mock-channel-design.md for scope and API contract details.