Skip to content

feat(typescript-recipes): add parallel-procurement-n8n recipe#37

Draft
s-jag wants to merge 2 commits into
parallel-web:mainfrom
s-jag:add/parallel-procurement-n8n
Draft

feat(typescript-recipes): add parallel-procurement-n8n recipe#37
s-jag wants to merge 2 commits into
parallel-web:mainfrom
s-jag:add/parallel-procurement-n8n

Conversation

@s-jag

@s-jag s-jag commented May 19, 2026

Copy link
Copy Markdown

Summary

Adds a new recipe under typescript-recipes/parallel-procurement-n8n/ — continuous vendor risk monitoring built on the Parallel Task and Monitor APIs, orchestrated by n8n, with Slack-routed alerts and a cited audit log. Slots into the Scheduled Research & Webhooks category next to parallel-daily-insights.

What's in the recipe:

  • One combined n8n workflow (50 nodes) covering vendor sync (every 6h), daily Deep Research via Task Groups, V1 event-stream monitors, deterministic risk scoring, severity routing into Slack, and an ad-hoc /vendor-research slash command.
  • output.basis lift-through — every assessment and Slack alert carries the top citation per dimension, and the audit log writes top_citation_url / top_citation_title / confidence per row.
  • 46 Vitest suites (629 tests) — services, models, workflow JSON structure, full pipeline integration, vendor lifecycle, nine error scenarios, scale simulation (200 / 3000 vendors).
  • Optional Next.js + Supabase BYOK dashboard reimplementing the same business logic for users who would rather not run n8n. Includes one-click Vercel deploy in DEPLOY.md.

Registered in both indexes per CONTRIBUTING.md:

  • Row in README.md under Scheduled Research & Webhooks.
  • Entry in website/cookbook.json (slug parallel-procurement-n8n).

Why draft

Submitting as draft because a few items from the cookbook quality bar are still TODO:

  • Live demo URL — n8n side is self-hosted; will record a Loom walkthrough and patch in. Dashboard one-click Vercel deploy is wired but not hosted at a public URL yet.
  • Architecture diagram as PNG — four Excalidraw sources ship today (system-architecture.excalidraw and friends); will export a PNG into docs/ for the README.
  • creators field in cookbook.json — currently ["sahith-3694"]; tell me if it should be a different handle.
  • Category decision — slotted under Scheduled Research & Webhooks. Happy to move it or create a new Workflow Automation category if preferred.

PR Checklist (CONTRIBUTING.md)

  • Recipe runs end-to-end from a fresh clone using only the README (npm ci && npm test → 629 passed)
  • Live demo URL is reachable — see "Why draft"
  • No API keys, secrets, or .env / .dev.vars committed — pre-commit run passes (detect-private-key, gitleaks, forbid-env-files)
  • No hardcoded infra IDs — n8n workflow JSON uses \$vars.PARALLEL_API_KEY and {{ \$env.SLACK_WEBHOOK_URL }} placeholders; dashboard reads everything from env
  • Production-only routes properly isolated (Vercel cron in dashboard/vercel.json)
  • Lockfiles committed (package-lock.json at root and in dashboard/)
  • LICENSE included (MIT, copyright (c) 2026 Shapley AI, Inc.)
  • Title and description fit on one line each
  • Recipe added to both README.md and website/cookbook.json

Test plan

  • CI passes (pre-commit + any per-recipe jobs)
  • Reviewer sanity-checks the README.md table row and cookbook.json entry against cookbook.schema.json
  • Reviewer optionally runs npm ci && npm test inside typescript-recipes/parallel-procurement-n8n/

s-jag added 2 commits May 19, 2026 15:12
Continuous vendor risk monitoring built on the Parallel Task and Monitor
APIs, orchestrated by n8n, with Slack-routed alerts and a cited audit log.

- One combined n8n workflow (50 nodes) covering vendor sync, daily Deep
  Research via Task Groups, V1 event-stream monitors, deterministic risk
  scoring, Slack severity routing, and an /vendor-research slash command.
- 46 Vitest suites covering services, models, workflow JSON structure,
  full pipeline integration, vendor lifecycle, error scenarios, and
  scale simulation (200 / 3000 vendors).
- Optional Next.js + Supabase BYOK dashboard reimplementing the same
  business logic for users who would rather not run n8n.
- Registered in README.md (Scheduled Research & Webhooks) and
  website/cookbook.json per CONTRIBUTING.md.

Co-authored from the n8n-procurement folder of
shapleyai/parallel-integrations-and-demos.
The auth/key route returned "Parallel rejected this key" before the
email lookup, so a valid Parallel key with a wrong email produced a
different error than an invalid key — a credential-stuffing recon
oracle. Defer reporting the Parallel-test failure until after the
account lookup so both branches return the same generic
"Email or Parallel API key is incorrect" 401. Add tests covering
both bad-key/known-email and bad-key/unknown-email paths.
@georgeatparallel

Copy link
Copy Markdown
Collaborator

Replacement implementation is now in #51. It preserves Sahith’s attribution while applying the newer scripts-first scope: one local TypeScript recipe, current V1 Task + snapshot Monitor APIs, deterministic policy, tested cleanup, and article-ready source/diagram links.

zhengchaol pushed a commit that referenced this pull request Jul 14, 2026
## What this adds

This PR adds a local TypeScript recipe for researching vendor risk and
keeping the result current with Parallel.

It has three commands:

- `bootstrap` researches each vendor, applies a deterministic risk
policy, and starts a snapshot Monitor.
- `check-updates` reads new Monitor events and runs focused follow-up
research when a change crosses the review threshold.
- `cleanup` cancels the Monitors recorded in local state.

The README explains what each command does, when it consumes credits,
what a successful result looks like, and how to recover after an
interrupted command. The implementation uses the current TypeScript SDK
and V1 Monitor API.

## Why it is local

The earlier version in #37 combined n8n workflows, a TypeScript layer,
and a hosted Next.js/Supabase app. That gave readers several
implementations of the same workflow and a lot of infrastructure to set
up.

This version keeps one implementation and one local state file. A reader
needs Node.js and a Parallel API key; there is no database, frontend,
webhook, or deployment step. Because there is no hosted demo, the
Cookbook now supports `websiteUrl: null` and hides the Demo button for
verified local recipes.

This PR supersedes #37 and keeps Sahith's attribution in the Cookbook
registry.

## Try it

The normal checks do not call the Parallel API:

```bash
cd typescript-recipes/parallel-vendor-intelligence
npm ci
npm run validate
npm audit --audit-level=high
```

To use the recipe, copy `.env.example` to `.env`, add
`PARALLEL_API_KEY`, and run:

```bash
npm run --silent bootstrap | jq
# Leave the Monitor active. Run this later to process new events:
npm run --silent check-updates | jq
# Run this when you are finished monitoring:
npm run --silent cleanup | jq
```

The opt-in live test consumes credits. It researches Cloudflare, creates
a snapshot Monitor, checks for updates, cancels every Monitor it
created, and confirms the remote status:

```bash
npm run test:live
```

## Verified

- A fresh Node.js 20 install passes the TypeScript check and all 106
deterministic tests.
- The dependency audit reports no vulnerabilities.
- Package, schema, secret, and repository pre-commit checks pass.
- A production run completed a real `core` Task and `lite` Monitor
lifecycle, including confirmed cancellation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants