New:Socket for Asana Is Now Available.Learn more
Get Started

@agentick/connector-telegram

Package Overview
Dependencies
Maintainers
2
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentick/connector-telegram

Telegram plugin for Agentick gateway — bridge Telegram bots to agent sessions

latest
Source
npmnpm
Version
0.15.4
Version published
Maintainers
2
Created
Source

@agentick/connector-telegram

Telegram platform adapter for the Agentick connector system. Bridge a Telegram bot to an agent session.

Install

pnpm add @agentick/connector-telegram grammy

grammy is a peer dependency.

Usage

import { createConnector } from "@agentick/connector";
import { TelegramPlatform } from "@agentick/connector-telegram";

const connector = createConnector(
  client,
  new TelegramPlatform({
    token: process.env.TELEGRAM_BOT_TOKEN!,
    allowedUsers: [parseInt(process.env.TELEGRAM_USER_ID!)],
  }),
  {
    sessionId: "main",
    contentPolicy: "summarized",
    deliveryStrategy: "debounced",
    debounceMs: 2000,
  },
);

await connector.start();

Options

interface TelegramConnectorOptions {
  token: string;
  allowedUsers?: number[];
  chatId?: number;
  confirmationStyle?: "inline-keyboard" | "text";
}

token — Telegram bot token from @BotFather.

allowedUsers — Whitelist of Telegram user IDs. Empty array allows all users. Get your ID from @userinfobot.

chatId — Specific chat to use. If omitted, auto-detects from the first incoming message.

confirmationStyle — How tool confirmations are presented. Default: "inline-keyboard".

Tool Confirmations

Inline Keyboard (default)

Sends a message with Approve/Deny buttons. The user taps a button, the confirmation resolves.

Text-based

Sends a text prompt. The next message from the user is parsed as the confirmation response. Supports natural language — "yes but skip tests" is approved with the full text as reason.

For a conversational bot experience:

{
  contentPolicy: "summarized",   // collapse tool calls into brief summaries
  deliveryStrategy: "debounced", // wait for a pause before sending
  debounceMs: 2000,
}

For a long-running agent that reports results:

{
  contentPolicy: "text-only",    // only deliver text, no tool noise
  deliveryStrategy: "on-idle",   // deliver only when execution completes
}

Gateway Plugin

TelegramPlugin connects a bot directly to the gateway without a separate connector process:

import { createGateway } from "@agentick/gateway";
import { TelegramPlugin } from "@agentick/connector-telegram";

const gateway = createGateway({
  apps: { myApp },
  defaultApp: "myApp",
  plugins: [
    new TelegramPlugin({
      token: process.env.TELEGRAM_BOT_TOKEN!,
      allowedUsers: [12345678],
    }),
  ],
});

The plugin receives messages from Telegram, routes them to sessions, and delivers responses back. Registers a telegram:send method for outbound messaging from tool handlers.

Gateway Config File

With the gateway config system, Telegram options live in agentick.config.json:

{
  "connectors": {
    "telegram": {
      "token": "${env:TELEGRAM_BOT_TOKEN}",
      "allowedUsers": [12345678],
      "chatId": 987654321
    }
  }
}

Read it from the config store:

import { getConfig } from "@agentick/gateway";

const telegram = getConfig().get("connectors")?.telegram;
if (telegram) {
  gateway.use(new TelegramPlugin(telegram));
}

Importing @agentick/connector-telegram augments the gateway's ConnectorConfigs type, so get("connectors")?.telegram is fully typed.

Exports

export { TelegramPlugin, type TelegramPluginOptions } from "./telegram-plugin.js";
export { escapeMarkdownV2 } from "./telegram-format.js";
export { parseTextConfirmation, formatConfirmationMessage } from "./confirmation-utils.js";

Keywords

agent

FAQs

Package last updated on 18 Aug 2026

Related posts