{
  "id": "cFXP4gO2L3sOPL5k",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered Document Summarizer & Notifier",
  "tags": [
    {
      "id": "oXLqGOyVDwolvp9S",
      "name": "document summarizer",
      "createdAt": "2025-09-17T10:08:20.905Z",
      "updatedAt": "2025-09-17T10:08:20.905Z"
    },
    {
      "id": "qtuQF3Lc141mfYiM",
      "name": "n8n template",
      "createdAt": "2025-09-11T07:44:43.900Z",
      "updatedAt": "2025-09-17T10:07:33.999Z"
    }
  ],
  "nodes": [
    {
      "id": "77c58599-2aea-4ba4-8132-4f82fdcf8bd3",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1136,
        720
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f645be4e-6234-4984-9e4a-1552e847d927",
      "name": "File Created",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        32,
        544
      ],
      "parameters": {
        "event": "watchFolderUpdated",
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": "1FxZOCBSgyd0KyK13cEOwpAGHj8acIyVK"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e97c0523-5ba4-45d3-a993-b11320f99e26",
      "name": "Get a document",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        608,
        400
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "={{ $('Check Document Type').item.json.id }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "cd20e8af-3fba-4204-a953-ab8d07c25184",
      "name": "Check Document Type",
      "type": "n8n-nodes-base.if",
      "position": [
        256,
        544
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4e823422-08d2-4b98-a537-058c84010f1c",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.mimeType }}",
              "rightValue": "application/vnd.google-apps."
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "db6038cb-5a52-420d-abd5-4655e2f383f0",
      "name": "Set Field",
      "type": "n8n-nodes-base.set",
      "position": [
        816,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "2a756e70-4b34-4595-a1cb-a8e6dd715f07",
              "name": "text",
              "type": "string",
              "value": "={{ $json.content }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bf9bf0f4-1315-4816-91ff-9b53c6bf9423",
      "name": "Convert to Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        816,
        768
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1
    },
    {
      "id": "f34b4745-ebd6-430b-88c6-9c34d0e4b03d",
      "name": "Download PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        608,
        768
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download",
        "authentication": "oAuth2",
        "binaryPropertyName": "=data"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4c376f18-39b0-4832-9fe9-2d574e2e31b3",
      "name": "Send message to Slack Channel",
      "type": "n8n-nodes-base.slack",
      "position": [
        1776,
        384
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C096E5P119V",
          "cachedResultName": "general"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ab6365c4-bba3-42fa-b702-fe4f5183ccc9",
      "name": "Email the Summary",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1792,
        656
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "Doc Summary",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "da8dfa4a-23ca-469f-ad13-9811184a3308",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        272
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 688,
        "content": "## \ud83d\udcd1 Auto trigger and checking file type"
      },
      "typeVersion": 1
    },
    {
      "id": "d6411536-3cb7-499d-b27b-c18cf9a09e1d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        272
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 320,
        "content": "## \ud83d\udcd1 Docs, TXT file route"
      },
      "typeVersion": 1
    },
    {
      "id": "cd769f6e-9ffb-431f-8c10-62a6ad85e452",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1024,
        272
      ],
      "parameters": {
        "width": 624,
        "height": 688,
        "content": "## \ud83d\udcd1 Summarizing docs"
      },
      "typeVersion": 1
    },
    {
      "id": "8515df5f-189b-4c8a-8ca8-2c0329544aad",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        272
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 688,
        "content": "## \ud83d\udcd1 Notifier"
      },
      "typeVersion": 1
    },
    {
      "id": "ba29ca4f-8f7b-44f5-ae89-c53c88e288eb",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        624
      ],
      "parameters": {
        "color": 6,
        "width": 480,
        "height": 336,
        "content": "## \ud83d\udcd1 PDF file route\n"
      },
      "typeVersion": 1
    },
    {
      "id": "68ce3cde-5de5-4eed-be04-e98ffb53412a",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        64
      ],
      "parameters": {
        "width": 928,
        "height": 1200,
        "content": "# \ud83d\udee0\ufe0f Setup Guide  \n## **Author:** [Krishna Sharma]\n\nHere's the step to create AI-Powered Document Summarizer & Notifier workflow in n8n:\n\n### \u2705 Step 1: Create a folder within Google Drive and make it public.\nThis will be the folder where you will be adding files (PDF/Docs) to summarize.\n\n### \u2705 Step 2: Add Trigger node 'On changes involving a specific folder' from Google Drive\n2.1 Setup [Google OAuth2 API](https://docs.n8n.io/integrations/builtin/credentials/google/oauth-single-service) and use Client ID and Client Secret to establish a connection.  \n2.2 Select mode as 'every minute' and connect the folder by selecting from the list, ID, or by URL.  \n\n### \u2705 Step 3: Add If node to set route for PDFs and Docs/Text files\nSet condition: Mime type contains `application/vnd.google-apps`.  \nDocs/Text files go to the **True** branch, while PDFs go to the **False** branch.\n\n### \u2705 Step 4: Add Google Get Document node to the True branch\nDo this followed by adding a Set node to make the reference field uniform for the AI agent input.\n\n### \u2705 Step 5: Add Google Drive Download File node to the False branch followed by Extract from PDF node\nThis will download the PDF file, which will then be processed by the next node to extract the text.\n\n### \u2705 Step 6: Connect OpenAI Chat model to Doc Summarizer AI Agent\nHook up the OpenAI Chat model you would like to use, connect it via [OpenAI API](https://docs.n8n.io/integrations/builtin/credentials/openAi).  \n\n### \ud83e\udde0 Step 7: Hook up the Doc/PDF text and refine the system prompts\nFirst, map the text to the user message. Additionally, tailor the assistant\u2019s system prompts to match your **use case**.  \n\u26a0\ufe0f The default prompt is written to get **Title, Summary, Sentiment, etc.**, so be sure to adjust accordingly.\n\n### \u2705 Step 8: Connect channel to get notified\nFinally, add Slack/Gmail to get notified with the summary.\n\n### \ud83e\uddea Step 9: Run & Test  \nTest the setup and confirm you're getting responses as expected."
      },
      "typeVersion": 1
    },
    {
      "id": "d0cae7fa-fd10-4a7b-95ba-5e864357d94c",
      "name": "Doc Summarizer",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1232,
        544
      ],
      "parameters": {
        "text": "=Summarize the following document in less than 300 characters:{{ $json.text }}",
        "options": {
          "systemMessage": "=You are a concise, factual document summarizer. \n\n- Title: short title (<= 60 chars)\n- Summary: concise summary (3\u20135 sentences; <= 300 characters)\n- Key Points: array of up to 5 short bullet points (each <= 140 chars)\n- Action Items: array of up to 3 suggested actions (may be empty)\n- Language: 2-letter ISO code of detected language (e.g., \"en\")\n- Sentiment: \"positive\", \"neutral\", or \"negative\"\n- Truncated: boolean (true if input was trimmed / chunked)\n- Summary Length Chars: integer (actual character length of summary)\n- Max Tokens: 200-300\n\nRules:\n1. Keep the summary factual; do not invent facts or dates. If unsure, use \"likely\" or omit the fact.\n2. If the input contains clear dates, people, numbers or deadlines, include them in key_points.\n5. Always follow the character / length constraints above."
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "14a6ff36-644a-4db4-9a6b-ad48392fccfa",
  "connections": {
    "Set Field": {
      "main": [
        [
          {
            "node": "Doc Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF": {
      "main": [
        [
          {
            "node": "Convert to Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "File Created": {
      "main": [
        [
          {
            "node": "Check Document Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Doc Summarizer": {
      "main": [
        [
          {
            "node": "Send message to Slack Channel",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email the Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a document": {
      "main": [
        [
          {
            "node": "Set Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to Text": {
      "main": [
        [
          {
            "node": "Doc Summarizer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Doc Summarizer",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Document Type": {
      "main": [
        [
          {
            "node": "Get a document",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}