docx-track-changes

n8n community node for extracting revisions (track changes) and comments from Microsoft Word (.docx) documents

Package Information

Released: 9 mo ago
Downloads: 45 weekly / 195 monthly
Latest Version: 0.2.1
Author: ryoooo

Documentation

n8n-nodes-docx-track-changes

n8n.io - Workflow Automation
npm
License

This is an n8n community node that extracts revisions (track changes) and comments from Microsoft Word (.docx) documents.

Perfect for automating document review workflows, contract management, and approval processes.

n8n is a fair-code licensed workflow automation platform.

Features

  • Extract Revisions - Get all tracked changes (insertions and deletions) with author, timestamp, and unique ID
  • Extract Comments - Get all comments with replies, resolution status, and target text
  • Accept Revisions - Accept specific revisions by ID or accept all at once
  • Reject Revisions - Reject specific revisions by ID or reject all at once
  • Get Stats - Get combined revision and comment statistics with optional author breakdown
  • Context Support - Include surrounding text for each revision
  • Summary Statistics - Get counts by type, author, and status
  • AI Agent Compatible - Use as a tool in AI workflows (usableAsTool: true)

Compatibility

Requirement Version
n8n 1.0.0+ (tested on 2.2.0)
Node.js 18.17.0+

Note: This node uses external dependencies (jszip, fast-xml-parser) and is designed for self-hosted n8n. For n8n Cloud, only verified community nodes are supported.

Installation

Option 1: GUI Install (Recommended)

The easiest way to install on self-hosted n8n:

  1. Go to Settings > Community Nodes
  2. Select Install
  3. Enter n8n-nodes-docx-track-changes
  4. Check "I understand the risks of installing unverified code from a public source"
  5. Select Install

Only Owner and Admin users can install community nodes.

Option 2: Manual Install (npm)

For n8n instances running in queue mode or when installing private packages:

# Access your n8n container
docker exec -it n8n sh

# Create nodes directory and install
mkdir -p ~/.n8n/nodes
cd ~/.n8n/nodes
npm install n8n-nodes-docx-track-changes

# Restart n8n to load the node

Option 3: Docker (Dockerfile)

For persistent installation in Docker deployments, create a custom Dockerfile:

FROM n8nio/n8n:latest

USER root
RUN cd /usr/local/lib/node_modules/n8n && \
    npm install n8n-nodes-docx-track-changes
USER node

Then update your docker-compose.yml:

services:
  n8n:
    build:
      context: .
      dockerfile: Dockerfile
    # ... rest of your configuration

Rebuild and restart:

docker compose down
docker compose up -d --build

Enabling AI Agent Tool Usage

To use this node as an AI Agent tool, set the environment variable:

N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true

Operations

Extract Revisions

Extracts tracked changes (insertions and deletions) from a DOCX file.

Parameter Type Default Description
Input Binary Field string data Binary property containing the DOCX file
Include Context boolean false Include surrounding text for each revision
Context Length number 50 Characters to include before/after
Include Summary boolean true Include revision statistics

Note: Set "Input Binary Field" to match the binary output property name from the previous node:

  • Read Binary File → default is data
  • HTTP Request → default is data
  • Form Trigger → use the fieldName you configured

Output Example:

{
  "revisions": [
    {
      "id": "123456789",
      "type": "insert",
      "text": "新しい条項",
      "author": "田中 太郎",
      "date": "2025-01-15T10:30:00Z",
      "paragraphIndex": 5,
      "context": {
        "before": "契約書の",
        "after": "について"
      }
    },
    {
      "id": "123456790",
      "type": "delete",
      "text": "旧条項",
      "author": "田中 太郎",
      "date": "2025-01-15T10:31:00Z",
      "paragraphIndex": 5,
      "context": null
    }
  ],
  "summary": {
    "totalRevisions": 15,
    "insertions": 12,
    "deletions": 3,
    "authors": ["田中 太郎", "鈴木 花子"]
  }
}

Extract Comments

Extracts comments and replies from a DOCX file.

Parameter Type Default Description
Input Binary Field string data Binary property containing the DOCX file
Include Resolved boolean true Include resolved comments
Include Summary boolean true Include comment statistics

Output Example:

{
  "comments": [
    {
      "id": "1",
      "author": "田中 太郎",
      "date": "2025-01-15T10:30:00Z",
      "text": "この部分を確認してください",
      "targetText": "契約期間は1年間とする",
      "resolved": false,
      "replies": [
        {
          "id": "2",
          "author": "鈴木 花子",
          "date": "2025-01-15T11:00:00Z",
          "text": "確認しました。問題ありません。"
        }
      ]
    }
  ],
  "summary": {
    "totalComments": 5,
    "totalReplies": 3,
    "resolved": 2,
    "unresolved": 3,
    "authors": ["田中 太郎", "鈴木 花子"]
  }
}

Accept Revisions

Accepts tracked changes by ID or accepts all revisions at once. Outputs a modified DOCX file.

Parameter Type Default Description
Input Binary Field string data Binary property containing the DOCX file
Accept All boolean false Accept all revisions instead of specific IDs
Revision IDs string[] [] IDs of revisions to accept (from Extract Revisions)
Output Binary Field string data Binary property for the modified DOCX

Output Example:

{
  "acceptedCount": 3,
  "acceptedIds": ["123456789", "123456790", "123456791"],
  "warningIds": []
}

The modified DOCX file is available in the specified binary output field.

Reject Revisions

Rejects tracked changes by ID or rejects all revisions at once. Outputs a modified DOCX file.

Parameter Type Default Description
Input Binary Field string data Binary property containing the DOCX file
Reject All boolean false Reject all revisions instead of specific IDs
Revision IDs string[] [] IDs of revisions to reject (from Extract Revisions)
Output Binary Field string data Binary property for the modified DOCX

Output Example:

{
  "rejectedCount": 2,
  "rejectedIds": ["123456792", "123456793"],
  "warningIds": ["999999999"]
}

Note: warningIds contains IDs that were not found in the document.

Get Stats

Gets combined revision and comment statistics from a DOCX file.

Parameter Type Default Description
Input Binary Field string data Binary property containing the DOCX file
Include Author Breakdown boolean false Include per-author statistics

Output Example:

{
  "revisions": {
    "total": 15,
    "insertions": 12,
    "deletions": 3,
    "authors": ["田中 太郎", "鈴木 花子"]
  },
  "comments": {
    "total": 5,
    "replies": 3,
    "resolved": 2,
    "unresolved": 3,
    "authors": ["田中 太郎", "鈴木 花子"]
  },
  "authorBreakdown": [
    {
      "author": "田中 太郎",
      "insertions": 8,
      "deletions": 2,
      "comments": 3
    },
    {
      "author": "鈴木 花子",
      "insertions": 4,
      "deletions": 1,
      "comments": 5
    }
  ]
}

Usage Examples

Basic Workflow

[Read Binary File] → [DOCX Revisions] → [IF] → [Slack/Email]
  1. Read Binary File - Load the DOCX file
  2. DOCX Revisions - Extract revisions or comments
  3. IF - Check if there are unresolved items
  4. Slack/Email - Notify reviewers

Contract Review Automation

[Webhook] → [DOCX Revisions (Extract Revisions)] → [Code] → [Google Sheets]

Track all contract changes in a spreadsheet for audit purposes.

Comment Aggregation

[Google Drive Trigger] → [DOCX Revisions (Extract Comments)] → [Filter] → [Notion]

Automatically collect unresolved comments from shared documents.

Automated Revision Approval

[Webhook] → [DOCX Revisions (Extract Revisions)] → [Code (Filter by author)] → [DOCX Revisions (Accept Revisions)] → [Google Drive]

Automatically accept revisions from trusted authors and save the cleaned document.

Development

# Install dependencies
pnpm install

# Start development server
pnpm dev

# Run tests
pnpm test

# Build for production
pnpm build

# Lint code
pnpm lint

Resources

License

MIT

Author

ryoooo


Made with ❤️ for the n8n community

Discussion