Registry / messaging / polygram

polygram

JSON →
library0.9.0jsnpmunverified

Polygram (v0.9.0, active development) is a Telegram daemon designed for Claude Code that preserves the OpenClaw per-chat session model. It provides a migration path for OpenClaw users moving to Claude Code. Key features include multi-bot support, SQLite-based transcript and history storage, and a per-chat session model that maintains separate contexts for each Telegram chat. Built for Node.js >=22, it integrates directly with Claude Code to handle Telegram interactions without losing session state. Unlike generic Telegram bots, Polygram is purpose-built for AI-assisted chat workflows, ensuring continuity between conversations.

npm install polygram
INSTALL
IMPORT
SIG · POLYGRAM
P
polygram
messagingjavascriptv0.9.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Polygram
import { Polygram } from 'polygram'
const Polygram = require('polygram')
Package is ESM-only since v0.9.0; no CommonJS support.
startDaemon
import { startDaemon } from 'polygram'
import startDaemon from 'polygram/startDaemon'
Do NOT use subpath imports; all exports are from the main entry point.
TelegramSession
import { TelegramSession } from 'polygram'
For TypeScript users, the type is also exported: import type { TelegramSession } from 'polygram'

Initializes the Polygram daemon with a Telegram bot token and SQLite storage, then starts the daemon and handles graceful shutdown.

import { Polygram } from 'polygram'; const bot = new Polygram({ botToken: process.env.TELEGRAM_BOT_TOKEN ?? '', claudeCode: '/path/to/claude', storage: { type: 'sqlite', path: './polygram.db' } }); await bot.start(); process.on('SIGINT', async () => { await bot.stop(); process.exit(0); });
Debug
Known issues
breakingESM-only: Polygram requires Node.js >=22 and ES module syntax. CommonJS require() will not work.
fix
Use 'import' syntax and ensure 'type': 'module' in package.json, or use .mjs extension.
affects: >=0.9.0
gotchaEnvironment variable TELEGRAM_BOT_TOKEN must be set or passed directly; missing token causes immediate exit with no error message.
fix
Always validate the token before calling start(). Example: if (!botToken) throw new Error('TELEGRAM_BOT_TOKEN required');
affects: >=0.9.0
deprecatedThe 'storage' option path defaults to './polygram.db' but this may change in future versions. It is strongly recommended to specify an explicit path.
fix
Always provide a storage path: storage: { type: 'sqlite', path: '/your/path/db.sqlite' }
affects: <0.9.0
gotchaFor Claude Code integration, ensure the claudeCode path is executable and the user has permission; otherwise the daemon fails silently.
fix
Run 'which claude' to verify path, then set claudeCode to that full path.
affects: >=0.9.0
Errors
Common errors & fixes
Error: Cannot find module 'polygram'
Package not installed or not in node_modules.
fix
Run npm install polygram (or yarn add polygram).
Polygram is not a constructor
Using CommonJS require instead of import.
fix
Switch to ES module import: import { Polygram } from 'polygram'
SyntaxError: Unexpected identifier 'Polygram'
Running file as CJS but package is ESM.
fix
Add "type": "module" to your package.json or rename file to .mjs.
Upgrade
Version history
0.9.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Amazon
1
OpenAI (training)
1
Resources
polygram — npm install polygram · libregistry