{"_id":"@anura-gate/watcher-telegram-bot","_rev":"7-7b095df6a34cd762afb9cdf6b012b731","name":"@anura-gate/watcher-telegram-bot","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@anura-gate/watcher-telegram-bot","version":"0.1.0","keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-telegram-bot@0.1.0","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-telegram-bot":"cli.js"},"dist":{"shasum":"76caaaf2b9fe950ec446d70601dad4fdac3be323","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.1.0.tgz","fileCount":7,"integrity":"sha512-OH7Ju3zMuCmRLMENnv9iQ0Ar3489JfFWvDpDIzJg7L703cv6HuUytdLc3eohEDQPHi7ryACvBMwkXfZEwgo/kw==","signatures":[{"sig":"MEYCIQDXkGFLmuN+8cyovve/YTS5J1KsB6kAi5dMyWGDUB02HAIhAITBxbobXWgWKyvtj3dKxDxDFKV/Gs8IYoMSAvmPjvoS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48706},"main":"index.js","engines":{"node":">=18"},"gitHead":"ea2583f5508c3559d8121da997393257da03e471","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/watcher-telegram-bot_0.1.0_1771499617872_0.3368328804411853","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anura-gate/watcher-telegram-bot","version":"0.2.0","keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-telegram-bot@0.2.0","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-telegram-bot":"cli.js"},"dist":{"shasum":"b01c071f8e2e6a710e4aa52688c2a2150275c9fa","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.2.0.tgz","fileCount":7,"integrity":"sha512-3g7V6mSZS6zzztWAV+mfauClybH6AdZvSrCq63W4nJ0N0wFuJIkCYWdgIkeq0atEpQY4AYRGCojhYs5PvRrt+g==","signatures":[{"sig":"MEUCICcvqKhw2qdN62+5WxjY/qSHTv/Ax1fRR/AckRLYB1LtAiEAx8afiLGB1iRrMS0UTxfBbwjLyn7QTKcRCQDi5Uzo4h8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77055},"main":"index.js","engines":{"node":">=18"},"gitHead":"a9fd599770cec65f0bdb92e9c5b4964be544ad1d","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/watcher-telegram-bot_0.2.0_1771575811986_0.8974952491290993","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@anura-gate/watcher-telegram-bot","version":"0.2.1","keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-telegram-bot@0.2.1","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-telegram-bot":"cli.js"},"dist":{"shasum":"cea9d68b24a33091f3a249fb8de841f16bf9502a","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.2.1.tgz","fileCount":7,"integrity":"sha512-6T//TgzvWGVJesYg+P0GobVxSSSfZYwpOxIKTVUDoJAack+zVC+C28G5WarSEkl6/ClaM133xhkFo+UhXHRRXA==","signatures":[{"sig":"MEUCICwLitv/HIHExtplqjkqwGS3ugXoGnZMjckZTSXkF4BLAiEA3jVym5pDEcxXw08xcUJX9aT1sunolYQsgSrYjSjjtHs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77055},"main":"index.js","engines":{"node":">=18"},"gitHead":"c654e0ee165f6d1a466e876d9f7bdcd94f0d7a14","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/watcher-telegram-bot_0.2.1_1771582513104_0.7044870500652811","host":"s3://npm-registry-packages-npm-production"}},"0.2.2":{"name":"@anura-gate/watcher-telegram-bot","version":"0.2.2","keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-telegram-bot@0.2.2","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-telegram-bot":"cli.js"},"dist":{"shasum":"38a50f2f897874afc3219a44eac3a4a22c251f0f","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.2.2.tgz","fileCount":7,"integrity":"sha512-27ehHv+YuxTRr+dQaOYuIdAft/FHpsCwRLHAqzAKP+pKigxqtmveVuM+6W+PNR7T556r4wPQmXLHPDWSMpkTfw==","signatures":[{"sig":"MEUCIQCqFYD7zaz/5JRtS6g6j9k3kQRi8cshI8eLbkS/AHNaXAIgL0ha5bwOk9iY1fbfq7N0WvDZlMY4CK6QKYaGt5ylKMg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":86005},"main":"index.js","engines":{"node":">=18"},"gitHead":"c654e0ee165f6d1a466e876d9f7bdcd94f0d7a14","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/watcher-telegram-bot_0.2.2_1771585108063_0.7356674584389711","host":"s3://npm-registry-packages-npm-production"}},"0.2.3":{"name":"@anura-gate/watcher-telegram-bot","version":"0.2.3","keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-telegram-bot@0.2.3","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-telegram-bot":"cli.js"},"dist":{"shasum":"e0be27a2c2661038bdb4fb28823ace621feafca1","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.2.3.tgz","fileCount":7,"integrity":"sha512-yXQjLsczBEuLXxoXVwpL5VLjknHV1aqaJW5hcNhBqacVcFuQWOSHRerLSV1ewKYv8PxyAux5Uh0Ofr4aVx9NuQ==","signatures":[{"sig":"MEQCIFkIqYEPB97vOfBdPbeFk1RVx5VQTU8FQZshrJr9wBSrAiBQVlFQB4zhxEGdhSWjIZe1A0IRz+j9qGKDalDF/1ALZg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90504},"main":"index.js","engines":{"node":">=18"},"gitHead":"afd911c5d3bf2e2e674b9e30d3e1dc9787456504","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/watcher-telegram-bot_0.2.3_1771600357941_0.2589887475202908","host":"s3://npm-registry-packages-npm-production"}},"0.2.4":{"name":"@anura-gate/watcher-telegram-bot","version":"0.2.4","keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-telegram-bot@0.2.4","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-telegram-bot":"cli.js"},"dist":{"shasum":"7c9920cfb60a6fa850634ee198e98fff400be85c","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.2.4.tgz","fileCount":7,"integrity":"sha512-MZLsDB3nMYAgWkRW8Cbu99t1QhaLnAnWqJlre6LTfipoPy1fXdqo3cdtgD5+jtygECxKHidbMHCKWy1Yp2H6MA==","signatures":[{"sig":"MEUCIEhhpCyEKOdCcinokKG63wJSKj1N2titewr4vy9vznJbAiEAgWVswcAWIa18somfepmmecM5h0kXDbqCbcg3AaVABII=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":90835},"main":"index.js","engines":{"node":">=18"},"gitHead":"1aaf6081c08b475ede6d106e3dcfe55e0ee28dd0","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","directories":{},"_nodeVersion":"22.14.0","dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/watcher-telegram-bot_0.2.4_1771940173255_0.6983708555141979","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@anura-gate/watcher-telegram-bot","version":"0.3.0","description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","main":"index.js","bin":{"gate-watcher-telegram-bot":"cli.js"},"scripts":{"start":"node cli.js"},"keywords":["gate","watcher","telegram","bot","self-hosted"],"license":"MIT","homepage":"https://anuragate.com","repository":{"type":"git","url":"git+https://github.com/ahmad-ajmal/AnuraGate_Sample.git"},"dependencies":{"dotenv":"^17.3.1","qrcode":"^1.5.4"},"engines":{"node":">=18"},"_id":"@anura-gate/watcher-telegram-bot@0.3.0","gitHead":"0ebb362ebdf75c602ccbaa15cb7db91b80f2901d","bugs":{"url":"https://github.com/ahmad-ajmal/AnuraGate_Sample/issues"},"_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-qwEXbkQQqzsTG0A1VphIxnMTH41vY5XGPIB97qeMbQbr+0kgoPqIOHdug7QbHQ1//5FatSiKOR4gwU/022WUAA==","shasum":"5471a116a13b52ac4c48cf52182ba37cdbe14bf4","tarball":"https://registry.npmjs.org/@anura-gate/watcher-telegram-bot/-/watcher-telegram-bot-0.3.0.tgz","fileCount":8,"unpackedSize":96464,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEdOc/Tjs93eXNp3am1eO1VLJg4S744rck2zEb6U7NBNAiEA8b29Ob5bK/jEzOSfa29uLGtRAIO8EN4Fbf8RKSPV/WA="}]},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"directories":{},"maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/watcher-telegram-bot_0.3.0_1772353027211_0.1248058365102569"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-19T11:13:37.772Z","modified":"2026-03-01T08:17:07.541Z","0.1.0":"2026-02-19T11:13:38.029Z","0.2.0":"2026-02-20T08:23:32.126Z","0.2.1":"2026-02-20T10:15:13.243Z","0.2.2":"2026-02-20T10:58:28.204Z","0.2.3":"2026-02-20T15:12:38.099Z","0.2.4":"2026-02-24T13:36:13.402Z","0.3.0":"2026-03-01T08:17:07.376Z"},"license":"MIT","keywords":["gate","watcher","telegram","bot","self-hosted"],"description":"GATE Watcher — Self-hosted Telegram Bot. Bot token never leaves your machine.","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"readme":"# GATE Watcher — Telegram Bot\n\nSelf-hosted daemon that connects your Telegram Bot to GATE cloud for security processing via long polling. **Your bot token never leaves your machine.**\n\n## How it works\n\n```\nYour Machine (Watcher)              GATE Cloud\n┌─────────────────────┐        ┌──────────────────┐\n│ Telegram Bot polling │───────>│ Security pipeline │\n│ (token stays HERE)   │<───────│ (redact, policy,  │\n│                      │ poll   │  audit, forward)  │\n└─────────────────────┘        └──────────────────┘\n```\n\n## Quick Start (CLI)\n\n```bash\ncd gate-watcher-telegram-bot\nnpm install\n\n# Create .env (or pass env vars directly)\ncp .env.example .env\n# Fill in GATE_KEY, GATE_INTEGRATION_ID, TELEGRAM_BOT_TOKEN\n\nnpm start\n```\n\n## Embed in Your App (SDK)\n\n```bash\nnpm install @anura-gate/watcher-telegram-bot\n```\n\n```js\nconst { GateTelegramBotWatcher } = require(\"@anura-gate/watcher-telegram-bot\");\n\nconst watcher = new GateTelegramBotWatcher({\n  gateKey: \"gk-xxx\",\n  integrationId: \"int_xxx\",\n  botToken: \"123456:ABC-xxx\",\n  sessionId: \"my-bot\",\n});\n\nwatcher.on(\"ready\", (botInfo) => {\n  console.log(`Telegram Bot connected: @${botInfo.username}`);\n});\n\n// Every message after GATE security processing\nwatcher.on(\"message\", (update, result) => {\n  console.log(`From: ${update.message.from.username}, Text: ${update.message.text}`);\n  console.log(`Security actions: ${result.securityActions}`);\n  console.log(`Blocked: ${result.blocked}`);\n});\n\nwatcher.on(\"action_result\", ({ action, success, error }) => {\n  console.log(`${action}: ${success ? \"done\" : error}`);\n});\n\nawait watcher.start();\n\n// Later...\nawait watcher.stop();\n```\n\n### Pool mode (multiple bots)\n\nManage multiple Telegram bots from a single watcher instance.\n\n```js\nconst { GateTelegramBotWatcher } = require(\"@anura-gate/watcher-telegram-bot\");\n\nconst watcher = new GateTelegramBotWatcher({\n  gateKey: \"gk-xxx\",\n  integrationId: \"int_xxx\",\n  // No botToken → pool mode; each session provides its own\n});\n\n// Attach to your HTTP server — resolveUser maps requests to userId,\n// and resolveToken provides the bot token per user\nwatcher.attach(server, \"/ws/telegram-bot\", {\n  resolveUser: (req) => req.session?.userId,\n  resolveToken: (userId) => getUserBotToken(userId),\n});\n\nwatcher.on(\"pool:ready\", (userId, botInfo) => {\n  console.log(`[${userId}] Bot connected: @${botInfo.username}`);\n});\n\nwatcher.on(\"pool:message\", (userId, update, result) => {\n  console.log(`[${userId}] From: ${update.message.from.username}`);\n});\n\nawait watcher.start();\n```\n\n## SDK Events\n\n### Single-session mode\n\n| Event | Args | Description |\n|---|---|---|\n| `ready` | `(botInfo)` | Bot connected to Telegram |\n| `message` | `(update, result)` | Message received and processed by GATE |\n| `action` | `(action)` | Outbound action received from GATE queue |\n| `action_result` | `({ actionId, action, success, result, error })` | Outbound action completed |\n| `gate_error` | `({ path, status, error })` | GATE API call failed |\n| `limit_reached` | `(type)` | Plan limit hit |\n| `disconnected` | `(reason)` | Disconnected |\n| `stopped` | — | Watcher fully shut down |\n\n### Pool mode\n\nAll pool events include `userId` as the first argument.\n\n| Event | Args | Description |\n|---|---|---|\n| `pool:ready` | `(userId, botInfo)` | Bot session ready |\n| `pool:message` | `(userId, update, result)` | Message for a user's bot |\n| `pool:action` | `(userId, action)` | Outbound action for a user's bot |\n| `pool:action_result` | `(userId, { ... })` | Action completed for a user's bot |\n| `pool:error` | `(userId, error)` | Session error |\n| `pool:disconnected` | `(userId, reason)` | Bot session disconnected |\n\n## SDK Options\n\n| Option | Required | Default | Description |\n|---|---|---|---|\n| `gateKey` | Yes | — | Virtual key (`gk-xxx`) |\n| `integrationId` | Yes | — | Integration ID (`int_xxx`) |\n| `botToken` | Single-session only | — | Telegram bot token from @BotFather |\n| `gateUrl` | No | `\"https://anuragate.com\"` | GATE cloud URL |\n| `pollInterval` | No | `3000` | ms between update polls |\n| `heartbeatInterval` | No | `30000` | ms between heartbeats |\n| `sessionId` | No | — | Session ID (omit for pool mode) |\n| `sessionLabel` | No | — | Human-readable session label |\n| `sessionMetadata` | No | `{}` | Arbitrary metadata for the session |\n\n## Setup\n\n1. Open Telegram and message [@BotFather](https://t.me/BotFather)\n2. Send `/newbot` and follow the prompts to create your bot\n3. Copy the **Bot Token** BotFather gives you\n4. Go to **GATE Dashboard → Integrations → Add Integration**\n5. Select **Telegram Bot**, copy the **Integration ID**\n6. Copy your **Virtual Key** from the **Keys** page\n\n## Environment Variables\n\n| Variable | Required | Description |\n|---|---|---|\n| `GATE_KEY` | Yes | Your GATE virtual key |\n| `GATE_INTEGRATION_ID` | Yes | Integration ID from the dashboard |\n| `TELEGRAM_BOT_TOKEN` | Yes | Bot token from @BotFather |\n| `GATE_URL` | No | Custom GATE cloud URL |\n| `WEB_PORT` | No | Port for the dev dashboard (CLI only) |\n\n## Security model\n\n- Telegram bot token stored in `.env` on YOUR machine\n- GATE cloud never sees or stores your credentials\n- All message content passes through GATE's security pipeline\n- Billing, limits, and security enforced server-side\n","readmeFilename":"README.md","homepage":"https://anuragate.com","repository":{"type":"git","url":"git+https://github.com/ahmad-ajmal/AnuraGate_Sample.git"},"bugs":{"url":"https://github.com/ahmad-ajmal/AnuraGate_Sample/issues"}}