2026-08-22 17:36:38 +02:00
# Agent manual — Nextcloud Collabora Node-RED nodes
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
For flow agents building automations on Nextcloud + Collabora CODE. You edit Node-RED flows, not LibreOffice macros in the browser. File I/O goes through WebDAV or OCS. Document conversion goes through CODE REST.
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
## Rules
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
1. Use **app passwords ** in `nc-collab-config` . Never account passwords.
2. Do **not overwrite originals ** . Default output: `/Dokument/OfficeOut/` .
3. `postMessage` and iframe APIs are browser-only — not Node-RED.
4. Save files with **WebDAV PUT ** , not WOPI PutFile.
5. Do not expose port 9980 beyond loopback on the host.
6. Do not touch odds-scraper or unrelated services in flows.
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
## Environment
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
| Key | Value |
|-----|-------|
| Nextcloud | `https://cloud.example.com` |
| Existing Node-RED | `nextcloud-node-red` on `:1880` — Collabora nodes integrate here |
| Internal CODE | `https://172.17.0.2:9980` on Docker bridge (container `code` ) |
| Auth | Basic + app password, header `OCS-APIRequest: true` |
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
See [INFRASTRUCTURE.md ](INFRASTRUCTURE.md ) for network layout.
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
## Nodes
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
Full reference: [NODES.md ](NODES.md ).
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
**Config: ** one `nc-collab-config` per environment — all six flow nodes need it.
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
**Common msg fields: ** `ncPath` , `fileId` , `payload` , `format` , `destNcPath` , `fields` , `transform` , `operation` .
2026-08-22 14:59:25 +02:00
2026-08-22 17:36:38 +02:00
**Prefer `collabora-bridge` ** for everyday tasks (`ncFileToPdf` , `fillTemplateSave` ). Use low-level `collabora-*` nodes when bridge is not enough.
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
## Example flows
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
### A. NC file → PDF
2026-08-22 14:56:38 +02:00
```
2026-08-22 17:36:38 +02:00
inject { ncPath: "/Documents/contract.docx" }
→ collabora-bridge (ncFileToPdf)
→ debug destNcPath
2026-08-22 14:56:38 +02:00
```
2026-08-22 17:36:38 +02:00
### B. Template fill
2026-08-22 14:56:38 +02:00
```
2026-08-22 17:36:38 +02:00
extractToPayload or template:extractFields
→ function (map data to fields)
→ fillTemplateSave or template:fillFields
2026-08-22 14:56:38 +02:00
```
2026-08-22 17:36:38 +02:00
### C. Open in browser
2026-08-22 14:56:38 +02:00
```
2026-08-22 17:36:38 +02:00
nc-office (document:direct) → debug editorUrl
2026-08-22 14:56:38 +02:00
```
2026-08-22 17:36:38 +02:00
## Troubleshooting
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
| Symptom | Fix |
|---------|-----|
| ECONNREFUSED :9980 | Connect Node-RED to Docker bridge; use detected CODE IP |
| Empty convert response | Use HTTPS to internal CODE; check CODE is healthy |
| WebDAV 401 | New app password; same user as file path |
| WebDAV 404 | Leading slash on path; URL-encode segments |
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
## Acceptance criteria
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
- Test document converts to PDF under `/Dokument/OfficeOut/`
- Original unchanged
- Errors in `msg.error` , node status red — no silent failure
2026-08-22 14:56:38 +02:00
2026-08-22 17:36:38 +02:00
See also [NODES.md ](NODES.md ) for operation tables and examples.