What This Project Provides – Purpose & Capabilities

This community package brings the power of DocuWriter.ai into your n8n workflows. It offers:

  • Action Node (DocuWriter.ai): A single, versatile node exposing all DocuWriter.ai features via Resources and Operations.
  • Trigger Node (DocuWriter.ai Trigger): A webhook-based listener for real-time generation events.

🚀 Action Node: DocuWriter.ai

The DocuWriter.ai node lets you generate and retrieve AI-powered artifacts from source code. Configure the node by selecting a Resource and an Operation.

Emoji Resource Operations Description
📖 codeDocumentation generate Create comprehensive code documentation
🧪 codeTests generate Generate unit/integration test cases
📝 codeComments generate Add inline comments explaining code functionality
💡 codeOptimization optimize Refactor and optimize source code
📊 umlDiagram generate Produce UML diagrams (class, sequence, activity, etc.)
🔄 generations getAll | get Fetch metadata for all or specific generations
👤 userInfo get Retrieve authenticated user’s account details

Example – Generate code documentation:

{
  resource: 'codeDocumentation',
  operation: 'generate',
  sourceCode: 'function add(a, b) { return a + b; }',
  filename: 'math.js',
  outputLanguage: 'English',
  documentationType: 'General Documentation',
}

Note: All requests go to your configured DocuWriter.ai API instance. You must provide your API Token and Base URL in the node credentials.


🌐 Trigger Node: DocuWriter.ai Trigger

The DocuWriter.ai Trigger node allows n8n to react when DocuWriter.ai emits events. It exposes:

  • Events

    • generation.created – Fires when a new generation is finished
    • generation.updated – Fires when an existing generation is updated
  • Filtering

    • filterByGenerationType (boolean)
    • generationTypes (multiOptions)

Example – Listen only for new documentation generations:

{
  type: 'n8n-nodes-docuwriter-ai.docuWriterTrigger',
  parameters: {
    event: 'generation.created',
    filterByGenerationType: true,
    generationTypes: ['[Basic] => Documentation'],
  },
  credentials: {
    docuWriterApi: {
      apiToken: 'YOUR_TOKEN',
      baseUrl: 'https://app.docuwriter.ai',
    },
  },
}

🔄 Typical Workflow

  1. Trigger fires on generation.created.
  2. Fetch Generation Details via the Action node (resource: generations, operation: get).
  3. Process the returned generated content (e.g., save to Google Docs, GitHub, Notion).
sequenceDiagram
  participant Trigger as n8n Trigger
  participant API as DocuWriter.ai API
  Trigger->>API: GET /api/generations/{id}
  API-->>Trigger: { data: { filename, generated, ... } }
  Trigger->>n8n: Forward data to downstream nodes

📦 Under the Hood

  • Node Definitions live in nodes/DocuWriter/DocuWriter.node.ts and nodes/DocuWriterTrigger/DocuWriterTrigger.node.ts.
  • Compiled Output is shipped in dist, ready for Node.js >= 18.10 and pnpm environments.
  • Credential Type DocuWriterApi handles authentication via Bearer tokens.

This package streamlines embedding DocuWriter.ai’s full suite—documentation, testing, comments, UML, optimization, and metadata retrieval—into automated n8n pipelines.