# VisionOne Market Intel — N8N Workflow Templates

Three pre-built workflows you can import into N8N to get a working automation
loop in under 10 minutes. Each is a starter — adjust connectors (Outlook ↔
Gmail, Teams ↔ Slack, SharePoint folder paths, etc.) for your stack.

## What you need before importing

1. A Market Intel **API key** with scope `write` — generate from
   `Settings → API keys` (or `POST /api/marketintel-api-keys` directly).
   Save the cleartext value; you'll paste it as a credential.
2. Your platform **base URL** (e.g., `https://marketintel.visiononeperformance.com`).
3. The **tenant ID** you want to automate against (e.g., `wanner`).
4. (For the high-risk escalation workflow) the webhook URL that N8N gives you
   when you save the workflow — paste it back into Market Intel under
   `Settings → Outbound webhooks → insight.high-risk`.

## How to import

1. In N8N, click **Workflows → Import → From File** (or paste JSON).
2. Pick the `.json` template you want.
3. Open the workflow's `Credentials` panel and set `x-api-key` and base URL.
4. Adjust the email recipient / Teams channel / SharePoint folder to match
   your setup.
5. Activate.

## The three workflows

### 1. `monday-briefing-broadcast.json`
Every Monday 6am, fires a briefing generation for the tenant, waits for the
draft, and emails the executive summary + PDF attachment to the engagement
sponsor.

**Trigger:** Schedule (Mon 6am UTC) → loop over tenants → generate briefing → fetch PDF → send email.

### 2. `high-risk-insight-escalation.json`
A real-time webhook that catches every `insight.high-risk` event from the
platform, posts a Teams alert in the engagement channel, and creates a
follow-up task in Microsoft To Do (or any task system).

**Trigger:** Webhook (paste the URL into Market Intel webhook settings) → enrich → post Teams + create task.

### 3. `sharepoint-doc-watcher.json`
Watches a specific SharePoint folder for new files. When something appears,
downloads it, uploads it to the platform as a tenant document (the platform's
doc extractor takes over from there).

**Trigger:** SharePoint poll (every 15 min) → for each new file → download → upload to Market Intel.
