{"_id":"@anura-gate/watcher-whatsapp-business","_rev":"2-e97e35e495f22db10643e0d4a19103cc","name":"@anura-gate/watcher-whatsapp-business","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@anura-gate/watcher-whatsapp-business","version":"0.1.0","keywords":["gate","watcher","whatsapp","business","self-hosted"],"license":"MIT","_id":"@anura-gate/watcher-whatsapp-business@0.1.0","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"bin":{"gate-watcher-whatsapp-business":"cli.js"},"dist":{"shasum":"40f1a34e57181aac259057e22de480f6b304760d","tarball":"https://registry.npmjs.org/@anura-gate/watcher-whatsapp-business/-/watcher-whatsapp-business-0.1.0.tgz","fileCount":7,"integrity":"sha512-QmPCnHLa9vH2noazC/BdEKaAmJon6Gb7aX7xp0qY/GeTC/hfkdiD8i8SHkD/7Q8MRLY1pvJ2/9kE5OIOxu0yAw==","signatures":[{"sig":"MEYCIQCIK/XeW9Q1oXVvvEal8nqMFiXoH+l+z447Z34dVrfZJwIhAIxX0fgok0XgsY+RSqt31sml37/S/4zUzxtZkMOASjVh","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":55503},"main":"index.js","engines":{"node":">=18"},"gitHead":"5bdeddcfbf0e8788dce8d1abf01c06c8fc83501f","scripts":{"start":"node cli.js"},"_npmUser":{"name":"anuragate","email":"ahmadajmal1514@gmail.com"},"_npmVersion":"10.9.2","description":"GATE Watcher — Self-hosted WhatsApp Business monitor. Access 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-whatsapp-business_0.1.0_1771499636561_0.43635658651291","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@anura-gate/watcher-whatsapp-business","version":"0.2.0","description":"GATE Watcher — Self-hosted WhatsApp Business monitor. Access token never leaves your machine.","main":"index.js","bin":{"gate-watcher-whatsapp-business":"cli.js"},"scripts":{"start":"node cli.js"},"keywords":["gate","watcher","whatsapp","business","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-whatsapp-business@0.2.0","gitHead":"0ebb362ebdf75c602ccbaa15cb7db91b80f2901d","bugs":{"url":"https://github.com/ahmad-ajmal/AnuraGate_Sample/issues"},"_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-mZwtQRE0f9bCbxkNUVdC8d48SWJJT5YErHHvAdwibgusScRgown0L5ePm/A4JoCFldHmRX+6TgLoSDB+/lXR0g==","shasum":"4accbe3410a34ed18590fc192754ad1085d0db09","tarball":"https://registry.npmjs.org/@anura-gate/watcher-whatsapp-business/-/watcher-whatsapp-business-0.2.0.tgz","fileCount":8,"unpackedSize":61863,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCfrQH2WsibPzpUnWOOAgnsK959HDXW8lMNuegH0e/P2gIgY4vnjII+4dX7P5PCfYMYXXpqDMuAdtl3tiVotLux3lQ="}]},"_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-whatsapp-business_0.2.0_1772353029990_0.24906322826006178"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-19T11:13:56.504Z","modified":"2026-03-01T08:17:10.282Z","0.1.0":"2026-02-19T11:13:56.691Z","0.2.0":"2026-03-01T08:17:10.140Z"},"license":"MIT","keywords":["gate","watcher","whatsapp","business","self-hosted"],"description":"GATE Watcher — Self-hosted WhatsApp Business monitor. Access token never leaves your machine.","maintainers":[{"name":"anuragate","email":"ahmadajmal1514@gmail.com"}],"readme":"# GATE Watcher — WhatsApp Business\n\nSelf-hosted daemon that connects to the WhatsApp Business Cloud API and pushes message events to GATE cloud for security processing. **Your access token never leaves your machine.**\n\n## How it works\n\n```\nMeta Cloud API                  Your Machine (Watcher)              GATE Cloud\n┌──────────────┐  webhook POST  ┌──────────────────────┐        ┌──────────────────┐\n│ WhatsApp     │───────────────>│ Local webhook server  │───────>│ Security pipeline │\n│ Business API │                │ (token stays HERE)    │<───────│ (redact, policy,  │\n└──────────────┘                │                       │ poll   │  audit, forward)  │\n                                └──────────────────────┘        └──────────────────┘\n```\n\n## Quick Start (CLI)\n\n```bash\ncd gate-watcher-whatsapp-business\nnpm install\n\n# Create .env (or pass env vars directly)\ncp .env.example .env\n# Fill in GATE_KEY, GATE_INTEGRATION_ID, WHATSAPP_ACCESS_TOKEN, WHATSAPP_PHONE_NUMBER_ID\n\nnpm start\n```\n\nThe watcher starts a local webhook server (default port 3100). Point your Meta webhook URL to your public address (e.g. via [ngrok](https://ngrok.com)).\n\n## Embed in Your App (SDK)\n\n```bash\nnpm install @anura-gate/watcher-whatsapp-business\n```\n\n```js\nconst { GateWhatsAppBusinessWatcher } = require(\"@anura-gate/watcher-whatsapp-business\");\n\nconst watcher = new GateWhatsAppBusinessWatcher({\n  gateKey: \"gk-xxx\",\n  integrationId: \"int_xxx\",\n  accessToken: \"EAAxxxxx\",\n  phoneNumberId: \"1234567890\",\n  verifyToken: \"my-secret-verify-token\",\n  webhookPort: 3100,\n});\n\nwatcher.on(\"webhook_listening\", (port, verifyToken) => {\n  console.log(`Webhook listening on port ${port} (verify token: ${verifyToken})`);\n  console.log(\"Point Meta to: https://your-domain.com/webhook\");\n});\n\nwatcher.on(\"ready\", (phoneInfo) => {\n  console.log(`WhatsApp Business connected: ${phoneInfo.display_phone_number}`);\n});\n\n// Every incoming message after GATE security processing\nwatcher.on(\"message\", (message, result) => {\n  console.log(`From: ${message.from}, Text: ${message.text?.body}`);\n  console.log(`Security actions: ${result.securityActions}`);\n  console.log(`Blocked: ${result.blocked}`);\n});\n\n// Message status updates (sent, delivered, read, failed)\nwatcher.on(\"status_update\", (status, result) => {\n  console.log(`Message ${status.id}: ${status.status}`);\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## SDK Events\n\n| Event | Args | Description |\n|---|---|---|\n| `webhook_listening` | `(port, verifyToken)` | Local webhook server started |\n| `webhook_verified` | — | Meta successfully verified the webhook |\n| `ready` | `(phoneInfo)` | Connected and webhook verified |\n| `message` | `(message, result)` | Incoming message processed by GATE |\n| `status_update` | `(status, result)` | Message delivery status update |\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| `stopped` | — | Watcher fully shut down |\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| `accessToken` | Yes | — | Meta permanent access token (`EAAxxxxx`) |\n| `phoneNumberId` | Yes | — | WhatsApp Business phone number ID |\n| `gateUrl` | No | `\"https://anuragate.com\"` | GATE cloud URL |\n| `verifyToken` | No | random | Webhook verify token for Meta handshake |\n| `webhookPort` | No | `3100` | Local webhook server port |\n| `heartbeatInterval` | No | `30000` | ms between heartbeats |\n| `pollInterval` | No | `3000` | ms between outbound polls |\n| `sessionId` | No | — | Session ID for multi-tenant use |\n| `sessionLabel` | No | — | Human-readable session label |\n| `sessionMetadata` | No | `{}` | Arbitrary metadata for the session |\n\n## Setup\n\n1. Create a [Meta Business Account](https://business.facebook.com) and a WhatsApp Business app in the [Meta Developer Portal](https://developers.facebook.com)\n2. Add the **WhatsApp** product to your app\n3. Go to **WhatsApp → API Setup** to get your **Phone Number ID** and generate a **Permanent Access Token**\n4. Start the watcher — it will listen for webhook events on `webhookPort`\n5. Expose the webhook port publicly (e.g. `ngrok http 3100`) and configure it in **Meta → WhatsApp → Configuration → Webhook URL**: `https://your-domain/webhook`\n6. Set the **Verify Token** to match your `verifyToken` option\n7. Subscribe to webhook fields: `messages`\n8. Go to **GATE Dashboard → Integrations → Add Integration**, select **WhatsApp Business**, copy the **Integration ID**\n9. 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| `WHATSAPP_ACCESS_TOKEN` | Yes | Meta permanent access token |\n| `WHATSAPP_PHONE_NUMBER_ID` | Yes | WhatsApp Business phone number ID |\n| `WHATSAPP_VERIFY_TOKEN` | No | Webhook verify token (auto-generated if omitted) |\n| `WHATSAPP_WEBHOOK_PORT` | No | Local webhook server port (default: `3100`) |\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- Meta access 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- Webhook runs locally — Meta pushes directly to your machine\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"}}