@anura-gate/watcher-outlook
v0.4.0
Published
GATE Watcher — Self-hosted Outlook monitor. Credentials never leave your machine.
Maintainers
Readme
GATE Watcher — Outlook
Self-hosted daemon that monitors your Outlook / Microsoft 365 inbox via IMAP and pushes mail events to GATE cloud for security processing. Your email credentials never leave your machine.
How it works
Your Machine (Watcher) GATE Cloud
┌─────────────────────┐ ┌──────────────────┐
│ Outlook IMAP session│───────>│ Security pipeline │
│ (credentials HERE) │<───────│ (redact, policy, │
│ │ poll │ audit, forward) │
└─────────────────────┘ └──────────────────┘Quick Start (CLI)
cd gate-watcher-outlook
npm install
# Create .env (or pass env vars directly)
cp .env.example .env
# Fill in GATE_KEY, GATE_INTEGRATION_ID, OUTLOOK_EMAIL, OUTLOOK_PASSWORD
npm startEmbed in Your App (SDK)
npm install @anura-gate/watcher-outlookconst { GateOutlookWatcher } = require("@anura-gate/watcher-outlook");
const watcher = new GateOutlookWatcher({
gateKey: "gk-xxx",
integrationId: "int_xxx",
email: "[email protected]",
password: "your-app-password",
});
watcher.on("ready", (email) => {
console.log(`Outlook connected: ${email}`);
});
// Every new email after GATE security processing
watcher.on("mail", (mail, result) => {
console.log(`From: ${mail.from}, Subject: ${mail.subject}`);
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 |
|---|---|---|
| ready | (email) | Connected to Outlook IMAP |
| mail | (mail, result) | New email processed by GATE |
| 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 |
| disconnected | (reason) | IMAP disconnected |
| stopped | — | Watcher fully shut down |
SDK Options
| Option | Required | Default | Description |
|---|---|---|---|
| gateKey | Yes | — | Virtual key (gk-xxx) |
| integrationId | Yes | — | Integration ID (int_xxx) |
| email | Yes | — | Outlook / Microsoft 365 email address |
| password | Yes | — | App password or OAuth token |
| gateUrl | No | "https://anuragate.com" | GATE cloud URL |
| host | No | "outlook.office365.com" | IMAP host |
| port | No | 993 | IMAP port |
| pollInterval | No | 30000 | ms between mail polls |
| heartbeatInterval | No | 30000 | ms between heartbeats |
| sessionId | No | — | Session ID for multi-tenant use |
| sessionLabel | No | — | Human-readable session label |
| sessionMetadata | No | {} | Arbitrary metadata for the session |
Setup
- Sign in to your Microsoft account and go to Security → Advanced security options
- Under App passwords, generate a new app password
- Go to GATE Dashboard → Integrations → Add Integration
- Select Outlook, copy the Integration ID
- Copy your Virtual Key from the Keys page
- Set the env vars and run
Environment Variables
| Variable | Required | Description |
|---|---|---|
| GATE_KEY | Yes | Your GATE virtual key |
| GATE_INTEGRATION_ID | Yes | Integration ID from the dashboard |
| OUTLOOK_EMAIL | Yes | Your Outlook / Microsoft 365 email |
| OUTLOOK_PASSWORD | Yes | App password |
| OUTLOOK_HOST | No | Custom IMAP host |
| OUTLOOK_PORT | No | Custom IMAP port |
| OUTLOOK_POLL_INTERVAL | No | Poll interval in ms |
| GATE_URL | No | Custom GATE cloud URL |
| WEB_PORT | No | Port for the dev dashboard (CLI only) |
Security model
- Outlook credentials stored in
.envon YOUR machine - GATE cloud never sees or stores your credentials
- All email content passes through GATE's security pipeline
- Billing, limits, and security enforced server-side
