{
  "name": "Invoice \u2192 Slack Approval (powered by easybits)",
  "tags": [
    {
      "name": "easybits"
    },
    {
      "name": "Finance"
    },
    {
      "name": "Invoice Automation"
    },
    {
      "name": "AI"
    }
  ],
  "nodes": [
    {
      "id": "3f67804e-0440-4b23-a073-7305e2e28ae1",
      "name": "Invoice Upload Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -16,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "Invoice Upload",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "image"
            }
          ]
        },
        "formDescription": "Upload Document"
      },
      "typeVersion": 2.5
    },
    {
      "id": "89354feb-0386-401b-b2ae-cebc56255758",
      "name": "easybits Extractor: Extract Invoice Data",
      "type": "@easybits/n8n-nodes-extractor.easybitsExtractor",
      "position": [
        256,
        0
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "11e57ed1-cd67-4ab5-9fd9-f9e79ab23966",
      "name": "Map Invoice Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        528,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "765af92d-48a8-4dcd-921f-90e3f7a24d86",
              "name": "supplier_name",
              "type": "string",
              "value": "={{ $json.data.vendor_name }}"
            },
            {
              "id": "3c7ea123-d091-4606-8b3d-d079801e1706",
              "name": "invoice_number",
              "type": "string",
              "value": "={{ $json.data.invoice_number }}"
            },
            {
              "id": "951876e7-a7b6-4d5d-ad6a-d55127810f94",
              "name": "invoice_date",
              "type": "string",
              "value": "={{ $json.data.invoice_date }}"
            },
            {
              "id": "434b58b3-678f-4fc4-9d3a-8d333f9506de",
              "name": "total_amount",
              "type": "string",
              "value": "={{ $json.data.total_amount }}"
            },
            {
              "id": "b8e43c31-2d1b-49e7-86dc-83f228488e02",
              "name": "currency",
              "type": "string",
              "value": "EUR"
            },
            {
              "id": "afe9e84d-d1d8-4197-88de-11583a3a9b5b",
              "name": "approval_tier",
              "type": "string",
              "value": "={{ $json.data.total_amount >= 5000 ? 'high_value' : ($json.data.total_amount >= 1000 ? 'medium_value' : 'low_value') }}"
            },
            {
              "id": "b7f6bfb5-e8c5-4351-a5ec-4cb95c938d54",
              "name": "approver_channel",
              "type": "string",
              "value": "={{ $json.data.total_amount >= 5000 ? '#finance-leads' : '#invoice-review' }}"
            },
            {
              "id": "61366345-a58b-4609-ad72-3026014ccff5",
              "name": "customer_name",
              "type": "string",
              "value": "={{ $json.data.customer_name }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4aa9ba77-eaeb-44ed-8a8e-87408690989b",
      "name": "Send to Slack for Approval",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        0
      ],
      "parameters": {
        "url": "https://slack.com/api/chat.postMessage",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"channel\": \"YOUR_CHANNEL_ID\",\n  \"text\": \"New invoice: {{ $json.supplier_name }} - {{ $json.currency }} {{ $json.total_amount }}\",\n  \"blocks\": [\n    {\"type\":\"header\",\"text\":{\"type\":\"plain_text\",\"text\":\"\ud83d\udcc4 New Invoice for Approval\"}},\n    {\"type\":\"section\",\"fields\":[{\"type\":\"mrkdwn\",\"text\":\"*Supplier:*\\n{{ $json.supplier_name }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Invoice #:*\\n{{ $json.invoice_number }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Amount:*\\n{{ $json.currency }} {{ $json.total_amount }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Date:*\\n{{ $json.invoice_date }}\"},{\"type\":\"mrkdwn\",\"text\":\"*Tier:*\\n{{ $json.approval_tier === 'high_value' ? '\ud83d\udd34 High (\u20ac5k+)' : $json.approval_tier === 'medium_value' ? '\ud83d\udfe1 Medium (\u20ac1k-5k)' : '\ud83d\udfe2 Standard (<\u20ac1k)' }}\"}]},\n    {\"type\":\"actions\",\"elements\":[{\"type\":\"button\",\"text\":{\"type\":\"plain_text\",\"text\":\"\u2705 Approve\"},\"style\":\"primary\",\"value\":\"approved\",\"action_id\":\"invoice_approve\"},{\"type\":\"button\",\"text\":{\"type\":\"plain_text\",\"text\":\"\u274c Reject\"},\"style\":\"danger\",\"value\":\"rejected\",\"action_id\":\"invoice_reject\"},{\"type\":\"button\",\"text\":{\"type\":\"plain_text\",\"text\":\"\ud83d\udea9 Flag\"},\"value\":\"flagged\",\"action_id\":\"invoice_flag\"}]}\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "slackApi"
      },
      "typeVersion": 4.3
    },
    {
      "id": "a3b4ea9f-ea6f-4f81-a229-6d8ca4d90777",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 288,
        "content": "### \ud83d\ude80 Form for Invoice Upload\nForm accepts invoice uploads (PDF, image)"
      },
      "typeVersion": 1
    },
    {
      "id": "ccb4539d-f6b2-4dbf-8161-e4ce7e6f9b6e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 288,
        "content": "### \ud83e\udd16 Data Extraction\neasybits Extractor pulls: supplier, invoice #, date, amount"
      },
      "typeVersion": 1
    },
    {
      "id": "e5262e79-eea0-425f-839c-a110bccf519a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 288,
        "content": "### \ud83d\udcca Field Mapping\nMaps extracted data + determines approval tier based on amount"
      },
      "typeVersion": 1
    },
    {
      "id": "9f404edc-a313-4f4f-a184-2a1cc9e8f550",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 256,
        "height": 288,
        "content": "### \ud83d\udcac Slack Notification\nSends approval request with interactive buttons"
      },
      "typeVersion": 1
    },
    {
      "id": "681da2ff-b940-428f-b5d8-d434ebd0190b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -784,
        -608
      ],
      "parameters": {
        "width": 672,
        "height": 1296,
        "content": "# \ud83d\udcc4 Invoice Approval Workflow\n(powered by easybits + Slack)\n\n## What This Workflow Does\nUpload an invoice (PDF, PNG, or JPEG) via a hosted web form. The file is sent to **easybits Extractor**, which extracts key invoice data (supplier, amount, date, etc.). Based on the amount, an approval tier is assigned. The invoice details are then posted to **Slack** with interactive Approve / Reject / Flag buttons.\n\n## How It Works\n1. **Form Upload** \u2013 A user uploads an invoice through the n8n web form\n2. **Extraction via easybits** \u2013 The data URI is POSTed to the easybits Extractor, which returns structured invoice data\n3. **Field Mapping** \u2013 Extracted fields are mapped + approval tier is calculated based on amount\n4. **Slack Notification** \u2013 A message is posted to Slack with invoice details and interactive buttons\n\n## Approval Tiers\n- \ud83d\udfe2 **Standard:** < \u20ac1,000\n- \ud83d\udfe1 **Medium:** \u20ac1,000 \u2013 \u20ac5,000\n- \ud83d\udd34 **High:** > \u20ac5,000\n\n---\n\n## Setup Guide\n\n### 1. Create Your easybits Extractor Pipeline\n1. Go to **extractor.easybits.tech** and create a new pipeline\n2. Add the following fields to the mapping:\n   - `vendor_name` \u2013 The supplier/company name on the invoice\n   - `invoice_number` \u2013 The invoice reference number\n   - `invoice_date` \u2013 The date on the invoice\n   - `total_amount` \u2013 The total amount due (number only)\n   - `customer_name` \u2013 The recipient/customer name\n3. Copy your **Pipeline ID** and **API Key**\n\n### 2. Connect the Nodes in n8n\n1. Add the **easybits Extractor** node from the n8n community nodes\n2. Enter your **Pipeline ID** and **API Key** as credentials\n3. Create a **Slack API** credential using your Slack Bot Token and assign it to the Slack node\n4. Update the Slack channel ID in the **Send to Slack for Approval** node to your target channel\n\n### 3. Set Up the Slack App\n1. Go to **api.slack.com/apps** and create a new app\n2. Add Bot Token Scopes: `chat:write`, `chat:write.public`\n3. Install the app to your workspace\n4. Copy the **Bot User OAuth Token** (starts with `xoxb-`)\n5. Enable **Interactivity** and set the Request URL to your approval handler webhook\n\n### 4. Activate & Test\n1. Click **Active** in the top-right corner of n8n\n2. Open the form URL and upload a test invoice\n3. Check Slack \u2013 you should see the approval message with buttons"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "Map Invoice Fields": {
      "main": [
        [
          {
            "node": "Send to Slack for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice Upload Form": {
      "main": [
        [
          {
            "node": "easybits Extractor: Extract Invoice Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "easybits Extractor: Extract Invoice Data": {
      "main": [
        [
          {
            "node": "Map Invoice Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}