Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
8.5 KiB
PRD — N8n Contact CRUD Node Expansion
- Slug:
n8n-contact-crud - Date:
2026-03-14 - Status: Draft
Summary
Expand the Alga PSA n8n community node so automation builders can work with contacts directly, not just tickets and lookup resources. The first pass adds a first-class Contact resource with Create, Get, List, Update, and Delete operations, and matches the current ticket node’s ergonomics for field grouping, validation, normalized output, and continue-on-fail behavior.
Problem
The current n8n-nodes-alga-psa package exposes ticket CRUD plus helper lookup resources, but it does not expose contact CRUD. Teams building Alga PSA automations in n8n cannot create or maintain contacts without falling back to generic HTTP nodes, hand-rolled request payloads, and manual error handling.
That gap creates three problems:
- Contact workflows are inconsistent with ticket workflows in the same package.
- Users lose the package’s built-in lookup, validation, and output normalization behavior.
- Common automations such as “create contact from form submission” or “update a contact before creating a ticket” require lower-level API wiring than they should.
Goals
- Add
Contactas a first-class resource in theAlga PSAn8n node. - Support contact
Create,Get,List,Update, andDelete. - Mirror the ticket node’s editor conventions: separate required and optional fields, manual UUID fallback for lookups, normalized success output, and continue-on-fail support.
- Limit the first pass to core contact fields already supported by the current API contract.
- Update examples, README, release notes, and package tests so the feature is complete and publishable.
Non-goals
- No
Contact -> Searchoperation in this pass. - No attempt to expose the full contact schema on day one.
- No backend API changes unless implementation discovers an actual API gap.
- No full resource-registry rewrite for the n8n package.
- No new credential model or authentication behavior.
Users and Primary Flows
-
n8n workflow builder:
- Selects
Contactas the resource. - Creates a contact from upstream automation data.
- Lists contacts with filters for downstream branching or enrichment.
- Fetches, updates, or deletes a contact by ID.
- Selects
-
Existing Alga PSA node user:
- Expects contact operations to feel like ticket operations.
- Reuses
Clientlookup behavior when settingclient_id. - Expects list responses and error objects to follow the package’s current conventions.
UX / UI Notes
- Add
Contactto the resource selector besideTicket,Client,Board,Status, andPriority. - When
Contactis selected, show a dedicatedcontactOperationselector. - Use ticket-style field organization:
- required top-level fields for
Create - optional “additional fields” collections for
CreateandUpdate - dedicated ID field for
Get,Update, andDelete - dedicated pagination/filter fields for
List
- required top-level fields for
client_idshould use the sameresourceLocatorpattern as ticket references:From ListBy ID
phone_numbersshould be authored as JSON in the first pass rather than as a nested collection UI.- Do not expose a contact search operation in the first pass.
Requirements
Functional Requirements
- FR-01: The node resource selector includes
Contact. - FR-02: The node exposes
Contactoperations:Create,Get,List,Update, andDelete. - FR-03:
Contact -> Createrequiresfull_name. - FR-04:
Contact -> Createsupports optionalemail,client_id,role,notes,is_inactive, andphone_numbers. - FR-05:
Contact -> Updatesupports optionalfull_name,email,client_id,role,notes,is_inactive, andphone_numbers. - FR-06:
client_idinput for contact create/update supports both lookup mode and manual UUID mode. - FR-07:
Contact -> Get,Update, andDeletevalidatecontactIdbefore making a request. - FR-08:
Contact -> Listsupports pagination and core filters needed for practical automation:page,limit,client_id,search_term, andis_inactive. - FR-09: Contact create requests send
POST /api/v1/contactswith a compact payload that omits empty values. - FR-10: Contact get requests send
GET /api/v1/contacts/{id}. - FR-11: Contact list requests send
GET /api/v1/contactsand preserve pagination metadata in node output. - FR-12: Contact update requests send
PUT /api/v1/contacts/{id}with only provided fields. - FR-13: Contact delete requests send
DELETE /api/v1/contacts/{id}and return a non-empty normalized success object. - FR-14: Contact operations use the package’s existing API response normalization so wrapped
{ data: ... }contact responses are unwrapped for downstream nodes. - FR-15: Continue-on-fail behavior works for contact operations with the same item-level error shape already used by ticket operations.
- FR-16:
phone_numbersinput is validated before request dispatch and must match the API’s expected array-of-objects shape. - FR-17: The README operation matrix and examples include contact support.
- FR-18: Release notes mention the contact CRUD expansion.
Non-functional Requirements
- NFR-01: Existing ticket, client, board, status, and priority behaviors remain unchanged.
- NFR-02: Contact support follows the package’s current TypeScript, Vitest, and helper conventions rather than introducing a second style.
- NFR-03: Validation failures for contact IDs or
phone_numbersoccur before outbound HTTP requests are made. - NFR-04: The first pass avoids gold-plating and stays limited to core CRUD plus documentation and test coverage.
Data / API / Integrations
-
Package scope:
packages/n8n-nodes-alga-psa/nodes/AlgaPsa/AlgaPsa.node.tspackages/n8n-nodes-alga-psa/nodes/AlgaPsa/helpers.tspackages/n8n-nodes-alga-psa/nodes/AlgaPsa/transport.tspackages/n8n-nodes-alga-psa/__tests__/*packages/n8n-nodes-alga-psa/README.mdpackages/n8n-nodes-alga-psa/RELEASE_NOTES.mdpackages/n8n-nodes-alga-psa/examples/*
-
Existing API endpoints:
POST /api/v1/contactsGET /api/v1/contactsGET /api/v1/contacts/{id}PUT /api/v1/contacts/{id}DELETE /api/v1/contacts/{id}
-
Relevant server contracts:
server/src/lib/api/schemas/contact.tsserver/src/lib/api/controllers/ApiContactController.ts
-
Contact payload scope for the first pass:
full_nameemailclient_idrolenotesis_inactivephone_numbers
-
phone_numbersAPI shape:- array of objects
- each entry requires
phone_number - optional keys include
contact_phone_number_id,canonical_type,custom_type,is_default, anddisplay_order
Security / Permissions
- The node continues using the existing
Alga PSA APIcredential withx-api-key. - No permission model changes are required in the node package.
- Client and contact UUID fields must be validated before request dispatch.
phone_numbersJSON must be validated before dispatch to prevent opaque API failures caused by malformed local input.
Observability
- No new telemetry or logging work is planned in this pass.
- Existing request tests, helper tests, and documentation tests are the primary quality controls for this package-level change.
Rollout / Migration
- No migration is required because this is a package surface expansion.
- Existing installed workflows remain unchanged.
- Contact support should ship as a package release with updated docs and example workflows.
Open Questions
- Should the first-pass list UI expose only the agreed core filters, or should it also expose additional contact API filters such as
full_name,email,phone_number,role,has_client, andclient_name? - Should the first example workflow focus on create-only, or demonstrate a chained CRUD flow such as create then update?
Acceptance Criteria (Definition of Done)
- The
Alga PSAnode exposesContactwithCreate,Get,List,Update, andDelete. - Contact create and update support the agreed core fields and validate IDs plus
phone_numberslocally. - Contact list preserves pagination metadata and supports core filters required for practical automation use.
- Contact operations return normalized outputs and item-level continue-on-fail errors consistent with existing ticket behavior.
- Automated tests cover node description, request construction, validation failures, list behavior, delete normalization, and docs synchronization.
- README, release notes, and at least one example workflow reflect the new contact support.