Nodes and API operations (reference)

Trigger node: DocuWriter.ai Trigger

The DocuWriter.ai Trigger node listens for webhook events emitted by DocuWriter.ai. It enables workflows to react to AI generation events—such as new documentation or tests being created—and optionally filter these events by generation type.

⚙️ Overview

  • Sets up a POST webhook endpoint on n8n for DocuWriter.ai events
  • Validates the incoming payload matches the selected Event
  • Optionally filters by specific Generation Types
  • Converts numeric generation_type codes to human-readable names
  • Emits standardized workflow data containing key generation metadata

🔑 Properties

Property Type Description
Event options Which DocuWriter.ai event to trigger on: generation.created or generation.updated
Filter by Generation Type boolean Enable filtering by specific generation types when event is generation.created or generation.updated
Generation Types multiOptions List of generation types to allow (e.g., [Basic] => Documentation, [Basic] => Tests, …)

🔄 Workflow

flowchart TD
  A[DocuWriter.ai] -->|Webhook POST| B[n8n: /webhook/docuWriterTrigger]
  B --> C{Payload.event === selected **Event**?}
  C -->|No| D[Stop]
  C -->|Yes| E{Filter by **Generation Type**?}
  E -->|No| G[Map & Emit Data]
  E -->|Yes| F{payload.data.generation_type in **Generation Types**?}
  F -->|No| D
  F -->|Yes| G
  G[Map numeric code → name] --> H[Emit Execution Data]

📥 Incoming Payload

A typical payload from DocuWriter.ai looks like:

{
  "event": "generation.created",
  "data": {
    "id": "123e4567-e89b-12d3-a456-426614174000",
    "filename": "app.js",
    "generation_type": 1,
    "generated_by_user": "[email protected]",
    "created_at": "2025-09-10T14:48:00.000Z",
    "updated_at": "2025-09-10T14:48:00.000Z",
    "...": "…"
  }
}

Note: Numeric generation_type values are mapped to human-readable names (e.g., 1 → Documentation, 2 → Tests, etc.).

📤 Emitted Workflow Data

After validation and mapping, the node emits a single item with the following fields:

Field Type Description
id string Unique generation UUID
filename string Name of the source file
generation_type string Human-readable generation type (e.g., “Documentation”)
generated_by_user string Email or ID of the user who triggered generation
created_at string ISO timestamp of generation creation
updated_at string ISO timestamp of last update
raw_data object Full original payload under data

🛠️ Credentials

The node requires a DocuWriter.ai API credential to verify payload signatures and fetch user or generation details if needed .

📑 Example Workflow

Below is an excerpt from [examples/workflows/generation-created-webhook.json] illustrating how to wire the trigger node into a workflow that:

  1. Listens for new generations
  2. Filters for Documentation or Tests
  3. Fetches full generation details
  4. Saves results to Google Drive
{
  "nodes": [
    {
      "parameters": {
        "event": "generation.created",
        "filterByGenerationType": true,
        "generationTypes": ["Documentation", "Tests"]
      },
      "id": "webhook-trigger",
      "name": "Generation Created",
      "type": "n8n-nodes-docuwriter-ai.docuWriterTrigger",
      "typeVersion": 1,
      "webhookId": "generation-webhook",
      "credentials": {
        "docuWriterApi": {
          "id": "1",
          "name": "DocuWriter.ai API"
        }
      }
    },
    {
      "parameters": {
        "resource": "generations",
        "operation": "get",
        "generationId": "={{$node['Generation Created'].json['data']['id']}}"
      },
      "id": "fetch-generation-details",
      "name": "Fetch Generation Details",
      "type": "n8n-nodes-docuwriter-ai.docuWriter",
      "typeVersion": 1
    },
    {
      "parameters": {
        "authentication": "serviceAccount",
        "resource": "document",
        "operation": "create",
        "folderId": "YOUR_GOOGLE_DRIVE_FOLDER_ID",
        "name": "Documentation - {{$node['Generation Created'].json['data']['filename']}}",
        "options": { "bodyContentType": "text/html" },
        "bodyData": "<h1>{{$node['Generation Created'].json['data']['filename']}}</h1>\n<p>Generated by: {{$node['Generation Created'].json['data']['generated_by_user']}}</p>\n<div>{{$node['Fetch Generation Details'].json['data']['generated']}}</div>"
      },
      "id": "save-to-google-docs",
      "name": "Save to Google Docs",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3
    }
  ]
}