Skip to main content

CDOGS Document Generator — Custom n8n Node

The CDOGS Document Generator node interacts with the Common Document Generation Service (CDOGS) API to generate documents from templates. It supports uploading templates, managing cached templates, loading supported conversions from CDOGS, custom TeleJSON formatters, and rendering binary documents.

Overview​

PropertyValue
Node namecdogs
Display nameCDOGS
StyleProgrammatic (execute() method)
Version1
CredentialcdogsOAuth2Api (extends n8n OAuth2 API)
CategoryUtility
AI-tool capableYes (usableAsTool: true)
Operations6 (see Node Operations)

Documentation Index​

DocumentDescription
Node OperationsDetailed guide to every operation and its parameters
CredentialsHow to configure the OAuth2 credential for CDOGS

Source Files​

community-nodes/
├── credentials/
│ └── CDOGSOAuth2Api.credentials.ts # Dedicated OAuth2 credential
└── nodes/
│ └── CDOGSDocumentGenerator/
│ ├── CDOGSDocumentGenerator.node.ts # Main node logic
│ ├── CDOGSDocumentGenerator.node.json # Codex metadata
│ └── shared/
│ └── GenericFunctions.ts # HTTP helper functions

Quick Start​

  1. Configure a CDOGS OAuth2 API credential (see Credentials)
  2. Drag the "CDOGS" node into your workflow
  3. Set the Base URL (defaults to https://cdogs-dev.api.gov.bc.ca/api/v2)
  4. Choose an Operation (e.g., "Generate from Inline Template")
  5. Provide template data and options as required by the operation

The Convert To choices are loaded from the authenticated GET /fileTypes endpoint for the selected Base URL. Changing environments or the text template file type refreshes the available choices.

Common Workflow Patterns​

Generate a PDF from an HTML template​

  1. Use "Generate from Inline Template" operation
  2. Set Template Source to "Text Content"
  3. Paste your HTML template with {{variable}} placeholders in Template Content
  4. Provide the data JSON (e.g., {"name": "John", "date": "2024-01-01"})
  5. Set Convert To = "PDF"

Upload and reuse a DOCX template​

  1. Use "Upload Template" to store a .docx template → receive a template hash
  2. Use "Generate from Existing Template" with that hash to render documents repeatedly
  3. The template stays cached on CDOGS, avoiding repeated uploads

Check if a template is still cached​

  1. Use "Check Template Exists" with the template hash
  2. If not found, re-upload before rendering

Further Reading​