{
  "nodes": [
    {
      "id": "1625b6da-0d6f-44a6-9ea7-12e5c6d24e02",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -700,
        -260
      ],
      "parameters": {
        "width": 520,
        "height": 1020,
        "content": "## Dropbox to DocuPipe to Slack\n\nAutomatically extract structured data from files uploaded to Dropbox using [DocuPipe](https://docupipe.ai) AI and post formatted results to Slack.\n\n### Who is this for?\nTeams that collect documents in Dropbox (invoices, receipts, forms) and want instant Slack notifications with the extracted data - great for invoice processing, receipt tracking, or any document workflow where visibility matters.\n\n### How it works\nThis template contains two connected flows:\n\n**Scenario 1 - Upload:** Polls a Dropbox folder every minute for new files, filters for recently added documents, downloads them, and uploads to DocuPipe for extraction.\n\n**Scenario 2 - Notify:** When DocuPipe finishes extracting, the webhook fires, results are fetched, formatted into a readable Slack message with field labels and values, and posted to your channel.\n\n### How to set up\n1. Connect your **Dropbox** account\n2. Set the **folder path** to watch in the List Dropbox Folder node\n3. Sign up at [docupipe.ai](https://docupipe.ai), then get your **DocuPipe API key** at [app.docupipe.ai/settings/general](https://app.docupipe.ai/settings/general)\n4. Select an extraction **schema** in the Upload node\n5. Connect your **Slack** account and select the target channel\n6. Activate this workflow\n\n### Requirements\n- A [DocuPipe](https://docupipe.ai) account with an API key\n- A Dropbox account\n- A Slack workspace with bot permissions\n- An extraction schema configured in DocuPipe\n\n**Note:** Requires the [DocuPipe community node](https://www.npmjs.com/package/n8n-nodes-docupipe). Install via Settings > Community Nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "ddfe9aa6-15c9-4d9f-82c4-7744c5438d46",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -120
      ],
      "parameters": {
        "color": 7,
        "width": 1260,
        "height": 380,
        "content": "## Scenario 1 - Detect New Files & Upload to DocuPipe\nPolls a Dropbox folder every minute for files. A filter checks for recently added files so only new documents are processed. Each new file is downloaded and uploaded to DocuPipe for AI-powered extraction. The extraction runs asynchronously - results arrive via webhook in Scenario 2."
      },
      "typeVersion": 1
    },
    {
      "id": "ec7abe96-e415-4cbc-aaf6-c24e6e9f9b9b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        300
      ],
      "parameters": {
        "color": 7,
        "width": 1420,
        "height": 440,
        "content": "## Scenario 2 - Process Extraction Results & Post to Slack\nWhen DocuPipe completes extraction, the webhook triggers this flow. The extracted data is fetched, formatted into a readable Slack message with labeled fields, and posted to your chosen channel."
      },
      "typeVersion": 1
    },
    {
      "id": "f83edf79-8358-4878-801d-6e9e7261eac0",
      "name": "Check Every Minute",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes",
              "minutesInterval": 1
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6d4f4305-e179-49ff-9856-aa46678ed9f6",
      "name": "List Dropbox Folder",
      "type": "n8n-nodes-base.dropbox",
      "position": [
        240,
        60
      ],
      "parameters": {
        "path": "",
        "filters": {},
        "resource": "folder",
        "operation": "list"
      },
      "credentials": {
        "dropboxOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "27431d1b-0530-46db-bd06-e3bafcf795d6",
      "name": "Filter New Files",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        60
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "filter-1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json['.tag'] }}",
              "rightValue": "file"
            },
            {
              "id": "filter-2",
              "operator": {
                "name": "filter.operator.after",
                "type": "dateTime",
                "operation": "after"
              },
              "leftValue": "={{ $json.server_modified }}",
              "rightValue": "={{ $now.minus({minutes: 2}).toISO() }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e869f550-350a-4f51-a4e8-33e55088e73f",
      "name": "Download File from Dropbox",
      "type": "n8n-nodes-base.dropbox",
      "position": [
        720,
        60
      ],
      "parameters": {
        "path": "={{ $json.path_display }}",
        "resource": "file",
        "operation": "download"
      },
      "credentials": {
        "dropboxOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "6edd1006-67ea-4ab9-991f-6421572aad8b",
      "name": "Upload File & Extract Data",
      "type": "n8n-nodes-docupipe.docuPipe",
      "position": [
        960,
        60
      ],
      "parameters": {
        "resource": "extraction",
        "schemaId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "inputMode": "binary",
        "operation": "uploadAndExtract",
        "binaryPropertyName": "data"
      },
      "credentials": {
        "docuPipeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d52c2e4b-13a0-42a2-8f31-f3eb3a8e3215",
      "name": "Extraction Complete",
      "type": "n8n-nodes-docupipe.docuPipeTrigger",
      "position": [
        0,
        480
      ],
      "parameters": {
        "event": "standardization.processed.success"
      },
      "credentials": {
        "docuPipeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "287a05b6-289c-4493-9857-e3e9f882dea2",
      "name": "Get Extracted Data",
      "type": "n8n-nodes-docupipe.docuPipe",
      "position": [
        260,
        480
      ],
      "parameters": {
        "resource": "extraction",
        "operation": "getResult",
        "standardizationId": "={{ $json.standardizationId }}"
      },
      "credentials": {
        "docuPipeApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "b8202c06-4439-4a66-8f2f-8ecfddce9d9b",
      "name": "Format Slack Message",
      "type": "n8n-nodes-base.code",
      "position": [
        520,
        480
      ],
      "parameters": {
        "jsCode": "// Format extraction results into a readable Slack message\nconst data = $input.first().json;\nconst result = data.result || {};\nconst documentName = data.documentName || 'Document';\n\nlet message = `*DocuPipe Extraction Complete* :white_check_mark:\\n`;\nmessage += `*Document:* ${documentName}\\n\\n`;\n\n// Format each extracted field as a labeled line\nfor (const [key, value] of Object.entries(result)) {\n  let displayValue;\n  if (Array.isArray(value)) {\n    displayValue = value.map((item, i) => {\n      if (typeof item === 'object') {\n        return Object.values(item).join(' | ');\n      }\n      return item;\n    }).join('\\n   ');\n    message += `*${key}:*\\n   ${displayValue}\\n`;\n  } else if (typeof value === 'object' && value !== null) {\n    displayValue = JSON.stringify(value, null, 2);\n    message += `*${key}:* \\`${displayValue}\\`\\n`;\n  } else {\n    message += `*${key}:* ${value}\\n`;\n  }\n}\n\nreturn [{ json: { formattedMessage: message, documentName } }];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "97065c89-8e4f-42d9-b3bf-b38d85b787f1",
      "name": "Set Channel & Message",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        480
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "slack-1",
              "name": "text",
              "type": "string",
              "value": "={{ $json.formattedMessage }}"
            },
            {
              "id": "slack-2",
              "name": "subject",
              "type": "string",
              "value": "=DocuPipe: {{ $json.documentName }} extracted"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bc70419e-e0b0-4931-bb96-b5e167861150",
      "name": "Post Results to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1040,
        480
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    }
  ],
  "connections": {
    "Filter New Files": {
      "main": [
        [
          {
            "node": "Download File from Dropbox",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Every Minute": {
      "main": [
        [
          {
            "node": "List Dropbox Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Extracted Data": {
      "main": [
        [
          {
            "node": "Format Slack Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extraction Complete": {
      "main": [
        [
          {
            "node": "Get Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "List Dropbox Folder": {
      "main": [
        [
          {
            "node": "Filter New Files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Slack Message": {
      "main": [
        [
          {
            "node": "Set Channel & Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Channel & Message": {
      "main": [
        [
          {
            "node": "Post Results to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File from Dropbox": {
      "main": [
        [
          {
            "node": "Upload File & Extract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}