feat(n8n): add school intake workflow v1.1

This commit is contained in:
Fizzlepoof
2026-05-13 21:32:18 +00:00
parent 8165d7b2a6
commit 31223c875d
4 changed files with 253 additions and 11 deletions

View File

@@ -1,7 +1,7 @@
# School Paperless Intake Workflow
Current workflow versions:
- `n8n-workflows/18-school-paperless-intake-v1.0.json`
- `n8n-workflows/18-school-paperless-intake-v1.1.json`
- `n8n-workflows/19-paperless-school-metadata-enrichment-v1.0.json`
This workflow set is meant for a Telegram chat-driven upload pipeline that sends schoolwork into Paperless-NGX while recording intake metadata in shared Postgres.
@@ -15,7 +15,7 @@ When these workflow artifacts change, the version must change too:
## What it does
### Workflow 18 — v1.0
### Workflow 18 — v1.1
1. Accepts a multipart upload at `POST /webhook/school/intake/upload`
2. Requires form fields:
@@ -39,7 +39,9 @@ When these workflow artifacts change, the version must change too:
- Use the shared Postgres network/credentials pattern already used by the automation stack.
- The workflow expects an n8n Postgres credential named `Shared Postgres`.
- Recommended target database: `school_intake`
- Preferred target database: dedicated `school_intake`
- Current fast-path/live bootstrap also works against the existing `n8n` database, provided the schema tables are created there.
- If you are using the current PD bootstrap path, point the n8n credential at database `n8n` with the existing Postgres account.
- Tracked schema: `docs/reference/SCHOOL_INTAKE_POSTGRES_SCHEMA.sql`
## Required environment variables
@@ -83,7 +85,7 @@ Notes:
- `PAPERLESS_CORRESPONDENT_SCHOOL` and `PAPERLESS_DOCUMENT_TYPE_SCHOOL` should be numeric IDs if you want those fields auto-assigned.
- `PAPERLESS_TAG_CLASS_MAP_JSON`, `PAPERLESS_TAG_SUBMISSION_KIND_MAP_JSON`, `PAPERLESS_DOCUMENT_TYPE_PAPER_KIND_MAP_JSON`, and `PAPERLESS_CORRESPONDENT_CLASS_MAP_JSON` are optional JSON maps used by workflow 19.
- Leave optional Paperless IDs and JSON maps blank/default if you prefer to start with deterministic title + generic tags only.
- `NODE_FUNCTION_ALLOW_BUILTIN=crypto` is required because the Code node hashes the uploaded file.
- Workflow 18 v1.1 no longer requires `crypto`, so `NODE_FUNCTION_ALLOW_BUILTIN=crypto` is optional instead of required.
- `N8N_BLOCK_ENV_ACCESS_IN_NODE` must remain `false`.
## Paperless metadata behavior
@@ -116,7 +118,7 @@ Use the example curl request in:
Minimum test checklist:
1. Import the workflow into n8n.
2. Attach the `Shared Postgres` credential.
3. Confirm the target DB/table exists.
3. Confirm the target DB/table exists in either `school_intake` or `n8n`, depending on which credential/database you are using.
4. Send the sample multipart request.
5. Verify a row appears in `school_paperless_intake` with `status=uploaded`.
6. Verify the uploaded Paperless document title and stored filename both include the deterministic intake ID.
@@ -127,5 +129,5 @@ Minimum test checklist:
- The workflow is repo-only and was not live-tested against the running n8n/Paperless stack.
- The Postgres node uses SQL expressions inline rather than parameter binding because exported n8n node JSON can differ by version.
- If your n8n build blocks `require('crypto')`, add `NODE_FUNCTION_ALLOW_BUILTIN=crypto` to the container env.
- Workflow 18 v1.0 needed `require('crypto')`; workflow 18 v1.1 removed that dependency for easier live rollout.
- If Paperless needs tags as repeated `tags[]` fields instead of a comma-separated `tags` field, adjust the HTTP Request node after import.