@anura-gate/watcher-linkedin
v0.2.0
Published
GATE Watcher — Self-hosted daemon for LinkedIn monitoring. Session never leaves your machine.
Maintainers
Readme
GATE Watcher — LinkedIn
Self-hosted daemon that monitors your LinkedIn messages via an automated browser session and pushes events to GATE cloud for security processing. Your LinkedIn session never leaves your machine.
How it works
Your Machine (Watcher) GATE Cloud
┌─────────────────────┐ ┌──────────────────┐
│ LinkedIn browser │───────>│ Security pipeline │
│ session (stays HERE) │<───────│ (redact, policy, │
│ │ poll │ audit, forward) │
└─────────────────────┘ └──────────────────┘Quick Start (CLI)
cd gate-watcher-linkedin
npm install
# Create .env (or pass env vars directly)
cp .env.example .env
# Fill in GATE_KEY, GATE_INTEGRATION_ID
npm startA browser window will open on first launch — log in to LinkedIn manually. The session is saved locally for future headless runs.
Embed in Your App (SDK)
npm install @anura-gate/watcher-linkedinconst { GateLinkedInWatcher } = require("@anura-gate/watcher-linkedin");
const watcher = new GateLinkedInWatcher({
gateKey: "gk-xxx",
integrationId: "int_xxx",
});
watcher.on("login_required", () => {
console.log("Please log in to LinkedIn in the browser window...");
});
watcher.on("ready", () => {
console.log("LinkedIn connected!");
});
// Every new message after GATE security processing
watcher.on("message", (msg, result) => {
console.log(`From: ${msg.senderName}, Text: ${msg.text}`);
console.log(`Security actions: ${result.securityActions}`);
console.log(`Blocked: ${result.blocked}`);
});
watcher.on("action_result", ({ action, success, error }) => {
console.log(`${action}: ${success ? "done" : error}`);
});
await watcher.start();
// Later...
await watcher.stop();SDK Events
| Event | Args | Description |
|---|---|---|
| login_required | — | Browser opened for manual LinkedIn login |
| ready | — | LinkedIn session active, polling started |
| message | (msg, result) | New message processed by GATE |
| message_sent | (msg) | Message sent via action |
| action | (action) | Outbound action received from GATE queue |
| action_result | ({ actionId, action, success, result, error }) | Outbound action completed |
| gate_error | ({ path, status, error }) | GATE API call failed |
| limit_reached | (type) | Plan limit hit |
| stopped | — | Watcher fully shut down |
SDK Options
| Option | Required | Default | Description |
|---|---|---|---|
| gateKey | Yes | — | Virtual key (gk-xxx) |
| integrationId | Yes | — | Integration ID (int_xxx) |
| gateUrl | No | "https://anuragate.com" | GATE cloud URL |
| sessionDir | No | "./.linkedin_session" | Path to store browser session |
| headless | No | auto | Run browser headless (auto after first login) |
| pollInterval | No | 10000 | ms between message polls |
| heartbeatInterval | No | 30000 | ms between heartbeats |
| puppeteer | No | — | Extra Puppeteer launch options |
| sessionId | No | — | Session ID for multi-tenant use |
| sessionLabel | No | — | Human-readable session label |
| sessionMetadata | No | {} | Arbitrary metadata for the session |
Setup
- Go to GATE Dashboard → Integrations → Add Integration
- Select LinkedIn, copy the Integration ID
- Copy your Virtual Key from the Keys page
- Set the env vars and run — a browser window will open on first launch for you to log in
Environment Variables
| Variable | Required | Description |
|---|---|---|
| GATE_KEY | Yes | Your GATE virtual key |
| GATE_INTEGRATION_ID | Yes | Integration ID from the dashboard |
| LINKEDIN_HEADLESS | No | Force headless mode (true/false) |
| LINKEDIN_POLL_INTERVAL | No | Poll interval in ms |
| LINKEDIN_SESSION_DIR | No | Custom path to store browser session |
| GATE_URL | No | Custom GATE cloud URL |
| WEB_PORT | No | Port for the dev dashboard (CLI only) |
Security model
- LinkedIn session cookies stored in
sessionDiron YOUR machine - GATE cloud never sees or stores your LinkedIn credentials
- All message content passes through GATE's security pipeline
- Billing, limits, and security enforced server-side
