{"_id":"@astralibx/telegram-rule-engine","_rev":"7-14def35dd40ebd671805dbde97da1b7d","name":"@astralibx/telegram-rule-engine","dist-tags":{"latest":"1.0.1"},"versions":{"0.0.1":{"name":"@astralibx/telegram-rule-engine","version":"0.0.1","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","_id":"@astralibx/telegram-rule-engine@0.0.1","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"homepage":"https://github.com/Hariprakash1997/astralib#readme","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"dist":{"shasum":"c9b29ec4dad09f00b296bc3c6fabc69f9a8aceaf","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-0.0.1.tgz","fileCount":2,"integrity":"sha512-gUTiwavS0BPzihbnP8r6LP/KOwpyLuzBaj9xsTbteQm7aXRm80XM2miGu6D2II7Afc6t73+CtmlGutxLKQj4BA==","signatures":[{"sig":"MEYCIQCZh5qEXp2ybuU4aM4Sxt6manb7EGzmx/xsge4XGcuq+AIhAPoyr2Lx8EQx+nxawg2ubo3q78UVl7zNwkmJi9i8jdQE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7185},"main":"dist/index.cjs","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"gitHead":"7b31566b4e1292e820e38c3c891a8e38c6ad13d4","scripts":{"dev":"tsup --watch","lint":"eslint src/","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"repository":{"url":"git+https://github.com/Hariprakash1997/astralib.git","type":"git","directory":"packages/telegram-rule-engine"},"_npmVersion":"10.9.4","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","directories":{},"_nodeVersion":"22.22.1","dependencies":{"zod":"^3.23.0","handlebars":"^4.7.0","@astralibx/core":"*"},"_hasShrinkwrap":false,"devDependencies":{"express":"^5.0.0","ioredis":"^5.4.2","mongoose":"^8.12.1","typescript":"^5.8.2","@types/node":"^22.0.0","@types/express":"^5.0.0","@vitest/coverage-v8":"^3.0.0","mongodb-memory-server":"^10.0.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-rule-engine_0.0.1_1773719531043_0.4211384398418705","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@astralibx/telegram-rule-engine","version":"0.1.1","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","_id":"@astralibx/telegram-rule-engine@0.1.1","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"homepage":"https://github.com/Hariprakash1997/astralib#readme","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"dist":{"shasum":"6ccbc03d73c37f5594653126c672df4b109a3ba4","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-0.1.1.tgz","fileCount":8,"integrity":"sha512-dzGiVRK1FhhtaJf3InnXXG/rB5hbDbNj/CyFESEiRpbrroPeyfElv4ZF1KZaNqhlNKRmIyefs3EJaHKkFBYWeg==","signatures":[{"sig":"MEUCIQCPz2Lry2Rc9k8QS6stTtTzQEARTukM0a1W3qHDW1FZ9QIgDsuH7f4FZJGEgrp3bQgDM9w/K3FGnbPsorybnOLjydo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":601843},"main":"dist/index.cjs","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"gitHead":"df956e4b9f30b71fc0ee0eba6b811eee2092bf52","scripts":{"dev":"tsup --watch","lint":"eslint src/","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"repository":{"url":"git+https://github.com/Hariprakash1997/astralib.git","type":"git","directory":"packages/telegram/rule-engine"},"_npmVersion":"10.9.4","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","directories":{},"_nodeVersion":"22.22.1","dependencies":{"zod":"^3.23.0","handlebars":"^4.7.0","@astralibx/core":"*"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","express":"^5.0.0","ioredis":"^5.4.2","mongoose":"^8.12.1","typescript":"^5.8.2","@types/node":"^22.0.0","@types/express":"^5.0.0","@vitest/coverage-v8":"^3.0.0","mongodb-memory-server":"^10.0.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-rule-engine_0.1.1_1773730924884_0.31161686860625015","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@astralibx/telegram-rule-engine","version":"0.1.2","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","_id":"@astralibx/telegram-rule-engine@0.1.2","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"homepage":"https://github.com/Hariprakash1997/astralib#readme","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"dist":{"shasum":"625d11f2730fc00042c647d2af4338fa0fd04382","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-0.1.2.tgz","fileCount":8,"integrity":"sha512-4G00oyA50ye/xbAhoiFlVEAXaAutediXxSUGn5Jw33B5tMjHvqI18xJNb+o5BfnFvCpC/qjMONBZdhMCSxBI3g==","signatures":[{"sig":"MEQCIF6JEglbue7acIZLf3AJG0t6lL892TqSigDT9R0nImOyAiBGo9CL1pM6AMaTIGHjUei3W9+gsLGgpi4phlmGUI2dzA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":601843},"main":"dist/index.cjs","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"gitHead":"fd42f0db8c9fd08982aee61f94304819cd425d54","scripts":{"dev":"tsup --watch","lint":"eslint src/","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"repository":{"url":"git+https://github.com/Hariprakash1997/astralib.git","type":"git","directory":"packages/telegram/rule-engine"},"_npmVersion":"10.9.4","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","directories":{},"_nodeVersion":"22.22.1","dependencies":{"zod":"^3.23.0","handlebars":"^4.7.0","@astralibx/core":"*"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","express":"^5.0.0","ioredis":"^5.4.2","mongoose":"^8.12.1","typescript":"^5.8.2","@types/node":"^22.0.0","@types/express":"^5.0.0","@vitest/coverage-v8":"^3.0.0","mongodb-memory-server":"^10.0.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-rule-engine_0.1.2_1773733708795_0.8820035581561028","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@astralibx/telegram-rule-engine","version":"0.1.3","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","_id":"@astralibx/telegram-rule-engine@0.1.3","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"homepage":"https://github.com/Hariprakash1997/astralib#readme","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"dist":{"shasum":"0437c194f50e2e5269b2309e646d9a42345371b2","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-0.1.3.tgz","fileCount":8,"integrity":"sha512-hREH4kJhgKCDj1eFx8jhdBfvQ5IoUYDOsce6Xzu+YaAisqKivGR0u8f2yG4lpeasWFcMeFq6HHh2R/b8YBJ8+Q==","signatures":[{"sig":"MEUCIQCfaTEaKKcvgEIOnljuhy/UcfHxuE07Nwej3cEs9IucCQIgIDkktfQP3rzhLBPPn0bcnqu5cj1B00GDIb72v32Iesk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":603265},"main":"dist/index.cjs","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"gitHead":"2799c3a72496f6989c30cb5e2954ea0f4c34d66b","scripts":{"dev":"tsup --watch","lint":"eslint src/","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"repository":{"url":"git+https://github.com/Hariprakash1997/astralib.git","type":"git","directory":"packages/telegram/rule-engine"},"_npmVersion":"10.9.4","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","directories":{},"_nodeVersion":"22.22.1","dependencies":{"zod":"^3.23.0","handlebars":"^4.7.0","@astralibx/core":"*"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","express":"^5.0.0","ioredis":"^5.4.2","mongoose":"^8.12.1","typescript":"^5.8.2","@types/node":"^22.0.0","@types/express":"^5.0.0","@vitest/coverage-v8":"^3.0.0","mongodb-memory-server":"^10.0.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-rule-engine_0.1.3_1773745863356_0.23784939770197466","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@astralibx/telegram-rule-engine","version":"0.2.0","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","_id":"@astralibx/telegram-rule-engine@0.2.0","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"homepage":"https://github.com/Hariprakash1997/astralib#readme","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"dist":{"shasum":"ac389fcc30aacfe9d1954cb8e52214bc7dda9fa0","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-0.2.0.tgz","fileCount":8,"integrity":"sha512-uRR5/mAyn+7a1MiwOWTtkc9mMIawqO/tMpCSwjWrqgKmsY5QQeGFZtJB0BhGOqBg6grsuTxefB7vJrPqlWfiTQ==","signatures":[{"sig":"MEUCIQCXSGgs7bLDATMhuNCWwksxiwfdZ8EZ6TI9icWX85vUzwIgYlZ2GA6Y8vQa6pjgeapz1kfddJibpTulXfJZNCROjFM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":654033},"main":"dist/index.cjs","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"gitHead":"b96fb6e63feccf19591d627ddda0c3d04f165ad2","scripts":{"dev":"tsup --watch","lint":"eslint src/","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"repository":{"url":"git+https://github.com/Hariprakash1997/astralib.git","type":"git","directory":"packages/telegram/rule-engine"},"_npmVersion":"10.9.4","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","directories":{},"_nodeVersion":"22.22.1","dependencies":{"zod":"^3.23.0","handlebars":"^4.7.0","@astralibx/core":"*"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","express":"^5.0.0","ioredis":"^5.4.2","mongoose":"^8.12.1","typescript":"^5.8.2","@types/node":"^22.0.0","@types/express":"^5.0.0","@vitest/coverage-v8":"^3.0.0","mongodb-memory-server":"^10.0.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-rule-engine_0.2.0_1773814061889_0.8790150644621253","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@astralibx/telegram-rule-engine","version":"1.0.0","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","_id":"@astralibx/telegram-rule-engine@1.0.0","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"homepage":"https://github.com/Hariprakash1997/astralib#readme","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"dist":{"shasum":"d38f919aa0266c3d9b73a676e3f13e2ff4ad9ac4","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-1.0.0.tgz","fileCount":8,"integrity":"sha512-KDeeQRFLGNdC5+EAsFJ6XAQgGHnx9OyUCO/aBy2hizl0TqDiJIa/h/xZZY9vLBW60QYAnVmz6l+v5lFRx88T8w==","signatures":[{"sig":"MEYCIQC8fgspbQ1TOfxJKZdibp/gnDVINifWjG5dcw21MwXsjgIhAIehwIwiA3zJVxeLd6SEmRAUg+0MBVBAxeUtAmCWfNhq","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":134489},"main":"dist/index.cjs","types":"dist/index.d.ts","module":"dist/index.mjs","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"gitHead":"ae1365ff1004be6b7ef07ac5ca5a5d6d8d9a6fa6","scripts":{"dev":"tsup --watch","lint":"eslint src/","test":"vitest run","build":"tsup","clean":"rm -rf dist","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"repository":{"url":"git+https://github.com/Hariprakash1997/astralib.git","type":"git","directory":"packages/telegram/rule-engine"},"_npmVersion":"10.9.4","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","directories":{},"_nodeVersion":"22.22.1","dependencies":{"zod":"^3.23.0","handlebars":"^4.7.0","@astralibx/core":"*","@astralibx/rule-engine":"*"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.0.0","express":"^5.0.0","ioredis":"^5.4.2","mongoose":"^8.12.1","typescript":"^5.8.2","@types/node":"^22.0.0","@types/express":"^5.0.0","@vitest/coverage-v8":"^3.0.0","mongodb-memory-server":"^10.0.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-rule-engine_1.0.0_1773917002282_0.5939546132404394","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@astralibx/telegram-rule-engine","version":"1.0.1","description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","repository":{"type":"git","url":"git+https://github.com/Hariprakash1997/astralib.git","directory":"packages/telegram/rule-engine"},"main":"dist/index.cjs","module":"dist/index.mjs","types":"dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage","lint":"eslint src/","clean":"rm -rf dist"},"keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"license":"MIT","dependencies":{"@astralibx/core":"*","@astralibx/rule-engine":"*","handlebars":"^4.7.0","zod":"^3.23.0"},"peerDependencies":{"express":"^4.18.0 || ^5.0.0","ioredis":"^5.0.0","mongoose":"^7.0.0 || ^8.0.0"},"devDependencies":{"@types/express":"^5.0.0","@types/node":"^22.0.0","@vitest/coverage-v8":"^3.0.0","vitest":"^3.0.0","express":"^5.0.0","ioredis":"^5.4.2","mongodb-memory-server":"^10.0.0","mongoose":"^8.12.1","typescript":"^5.8.2"},"_id":"@astralibx/telegram-rule-engine@1.0.1","gitHead":"4d2a55b3968e55f083d4a957eb2319acb1fa5ba3","bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"homepage":"https://github.com/Hariprakash1997/astralib#readme","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-DwwQO6RRMT44pCnLS6X445SNPmckHq1D14kLKBPqFWHepw+WQnhqLzXzI6hdk8cBE82gEztYwnxfS9HdjqqvfA==","shasum":"6c7ac0d50849b46275a7159983b327a3cf64adbe","tarball":"https://registry.npmjs.org/@astralibx/telegram-rule-engine/-/telegram-rule-engine-1.0.1.tgz","fileCount":8,"unpackedSize":134489,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCg1ZfFRMB8pgYwUHupMvZ79gy28SzBVS38wqJQmiRNzAIhAJwDQamUxY68l0BKN2+uUBoJ69FnHlhloSGltg8hfWrp"}]},"_npmUser":{"name":"astralib","email":"1997hariprakash@gmail.com"},"directories":{},"maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/telegram-rule-engine_1.0.1_1773998152248_0.07337414731412717"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-17T03:52:10.936Z","modified":"2026-03-20T09:15:52.568Z","0.0.1":"2026-03-17T03:52:11.191Z","0.1.1":"2026-03-17T07:02:05.022Z","0.1.2":"2026-03-17T07:48:28.943Z","0.1.3":"2026-03-17T11:11:03.501Z","0.2.0":"2026-03-18T06:07:42.028Z","1.0.0":"2026-03-19T10:43:22.436Z","1.0.1":"2026-03-20T09:15:52.431Z"},"bugs":{"url":"https://github.com/Hariprakash1997/astralib/issues"},"license":"MIT","homepage":"https://github.com/Hariprakash1997/astralib#readme","keywords":["telegram","automation","rule-engine","handlebars","throttle","campaign"],"repository":{"type":"git","url":"git+https://github.com/Hariprakash1997/astralib.git","directory":"packages/telegram/rule-engine"},"description":"Rule-based Telegram message automation engine with Handlebars templates, throttling, and distributed locking","maintainers":[{"name":"astralib","email":"1997hariprakash@gmail.com"}],"readme":"# @astralibx/telegram-rule-engine\n\n[![npm version](https://img.shields.io/npm/v/@astralibx/telegram-rule-engine.svg)](https://www.npmjs.com/package/@astralibx/telegram-rule-engine)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nTelegram-specific rule engine for automated message delivery. Built on [`@astralibx/rule-engine`](https://github.com/Hariprakash1997/astralib/tree/main/packages/rule-engine) -- the platform-agnostic core that handles templates, rules, throttling, scheduling, and execution. This package adds Telegram-specific adapters, health-adjusted delays, and error categorization.\n\n> **Getting started?** See the [Quick Start Tutorial](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/docs/quick-start-tutorial.md) for a step-by-step walkthrough, [Integration Guide](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/docs/integration-guide.md) for multi-package setup, or the [Glossary](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/docs/glossary.md) for ID terminology.\n\n### What core provides\n\n- Template CRUD, Handlebars rendering, media attachments\n- Rule CRUD, targeting (query + list modes), dry runs, validity dates\n- Per-user throttling (MongoDB or Redis-backed), send deduplication\n- Distributed locking, run progress tracking, cancel support\n- Express REST routes for admin UIs\n- Analytics: send logs, error logs, run logs, aggregated stats\n- Collection schemas with joins for flexible targeting\n\n### What this package adds\n\n- **Telegram adapters** -- maps `sendMessage`/`selectAccount`/`findIdentifier` to Telegram-specific naming conventions (not the core's generic `send`/`selectAgent`)\n- **Health-adjusted delays** -- `getHealthAdjustedDelay` scales send pacing based on account health score\n- **Error categorization** -- `categorizeError` classifies Telegram API errors into `critical`, `account`, `recoverable`, `skip`, `unknown`\n- **Redis throttle** -- optional Redis-backed throttle tracking via `checkRedisThrottle`/`incrementRedisThrottle`\n- **Human-like timing** -- thinking pauses, jitter, and configurable batch progress intervals\n- **Telegram-specific constants and defaults** -- delay multipliers, failure thresholds, progress intervals\n\n## Install\n\n```bash\nnpm install @astralibx/telegram-rule-engine\n```\n\n**Peer dependencies:**\n\n| Peer Dependency | Version |\n|-----------------|---------|\n| `express` | `^4.18.0 \\|\\| ^5.0.0` |\n| `mongoose` | `^7.0.0 \\|\\| ^8.0.0` |\n| `ioredis` | `^5.0.0` |\n\n```bash\nnpm install express mongoose ioredis\n```\n\n## Quick Start\n\n```typescript\nimport express from 'express';\nimport mongoose from 'mongoose';\nimport Redis from 'ioredis';\nimport { createTelegramRuleEngine } from '@astralibx/telegram-rule-engine';\n\nconst app = express();\napp.use(express.json());\n\nconst dbConnection = mongoose.createConnection('mongodb://localhost/myapp');\nconst redis = new Redis();\n\nconst engine = createTelegramRuleEngine({\n  db: { connection: dbConnection },\n  redis: { connection: redis },\n  adapters: {\n    queryUsers: async (target, limit) => {\n      return User.find(target.conditions).limit(limit).lean();\n    },\n    resolveData: (user) => ({\n      user: { name: user.name },\n      platform: { name: 'MyApp' },\n    }),\n    sendMessage: async (params) => {\n      await telegramClient.sendMessage(params.identifierId, params.message, params.media);\n    },\n    selectAccount: async () => ({ accountId: 'default', phone: '+919876543210', metadata: {} }),\n    findIdentifier: async (phoneOrUsername) => {\n      const contact = await Contact.findOne({ phone: phoneOrUsername });\n      return contact ? { id: contact._id.toString(), contactId: contact._id.toString() } : null;\n    },\n  },\n});\n\n// Mount REST routes\napp.use('/api/telegram-rules', engine.routes);\n\n// Trigger a run programmatically (e.g., from a cron job)\n// engine.runner.trigger('cron');\n\napp.listen(3000);\n```\n\nThe factory wraps core's `createRuleEngine` with Telegram-specific adapters and returns a `TelegramRuleEngine` instance with:\n\n- `routes` -- Express Router with all CRUD, runner, analytics, and settings endpoints (provided by core)\n- `runner` -- `RuleRunnerService` for triggering runs programmatically\n- `templateService` -- `TemplateService` for CRUD and preview\n- `ruleService` -- `RuleService` for CRUD and dry runs\n- `models` -- Direct Mongoose model access\n- `destroy()` -- Graceful shutdown (stops the runner service)\n\n## Configuration\n\nThe `createTelegramRuleEngine(config)` factory accepts a `TelegramRuleEngineConfig` object validated at startup with Zod.\n\n| Section | Required | Description |\n|---------|----------|-------------|\n| `db` | Yes | Mongoose connection and optional collection prefix |\n| `redis` | Yes | ioredis connection for distributed locking |\n| `adapters` | Yes | 5 required functions bridging your app to the engine |\n| `platforms` | No | Valid platform values for schema validation |\n| `audiences` | No | Valid audience/role values for schema validation |\n| `categories` | No | Valid template categories for schema validation |\n| `options` | No | Lock TTL, max per run, send window, delays, human-like timing, Redis throttle |\n| `hooks` | No | Callbacks at key execution points |\n| `logger` | No | Logger with `info`, `warn`, `error` methods |\n\nSee [docs/configuration.md](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/configuration.md) for the full reference with examples.\n\n## Getting Started Guide\n\n1. [Configuration](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/configuration.md) -- Set up database, Redis, adapters, and options\n2. [Templates](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/templates.md) -- Create message templates with Handlebars and media\n3. [Rules](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/rules.md) -- Define targeting rules with conditions or explicit lists\n\nReference: [API Routes](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/api-routes.md) | [Types](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/types.md)\n\n### Redis Key Prefix (Required for Multi-Project Deployments)\n\n> **WARNING:** If multiple projects share the same Redis server, you MUST set a unique `keyPrefix` per project. Without this, run locks, cancel flags, and progress keys will collide between projects.\n\n```typescript\nconst engine = createTelegramRuleEngine({\n  redis: {\n    connection: redis,\n    keyPrefix: 'myproject:', // REQUIRED if sharing Redis\n  },\n  // ...\n});\n```\n\n| Default | Risk |\n|---------|------|\n| `''` (empty) | Two projects share global keys like `tg-rule-engine:lock` and `run:{id}:cancel` -- Project A can cancel Project B's runs |\n\n**Always set a unique prefix** like `projectname:` when sharing Redis.\n\n> **Important:** Configure throttle settings before running rules. Default limits (1/day, 2/week, 3 day gap) may be too restrictive. See the throttle settings API in [API Routes](https://github.com/Hariprakash1997/astralib/blob/main/packages/telegram/rule-engine/docs/api-routes.md#settings-throttle).\n\n## License\n\nMIT\n","readmeFilename":"README.md"}