Extraction et organisation des détails des contrats à partir de PDF vers Slack, GPT-4o et Google Sheets

Avancé

Ceci est unDocument Extraction, AI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 19 nœuds.Utilise principalement des nœuds comme Slack, Switch, HttpRequest, GoogleSheets, SlackTrigger. Extraire et organiser les détails des contrats depuis PDF vers Slack, GPT-4o et Google Sheets

Prérequis
  • Token Bot Slack ou URL Webhook
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Informations d'identification Google Sheets API
  • Clé API OpenAI
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "e04cc86c30b0cecda8e6bbc7cc41459d9bf4d76816638a14d42d636b91913ebc",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "af0cd5b9-3301-4668-93ec-71e1033d3778",
      "name": "Structure Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        544,
        160
      ],
      "parameters": {
        "jsonSchemaExample": "[{\n\t\"Client\": \"XYZ Inc\",\n\t\"Service Provider\": \"ABC Inc\",\n  \"Effective Date\": \"2025/04/29\",\n  \"Expiration Date\" : \"2025/05/29\",\n  \"Signature Date\" : \"2025/05/29\",\n  \"Contract Value\": \"11,000\"\n}]"
      },
      "typeVersion": 1.3
    },
    {
      "id": "c02b6fd7-70d6-47ae-8ea5-2c1ead2e17da",
      "name": "Modèle d'IA",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        400,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "vWYprn1xB4TGPXdo",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c506d41b-aec6-48ad-a33e-15b02e256bb1",
      "name": "Recevoir le fichier de contrat",
      "type": "n8n-nodes-base.slackTrigger",
      "position": [
        -640,
        32
      ],
      "webhookId": "0c333af6-a04b-489e-b267-e60cb4664128",
      "parameters": {
        "options": {},
        "trigger": [
          "message"
        ],
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09EG2EN9AA",
          "cachedResultName": "contract"
        }
      },
      "credentials": {
        "slackApi": {
          "id": "VLK4L2mMCF7UFZXF",
          "name": "Slack account 4"
        }
      },
      "notesInFlow": false,
      "typeVersion": 1
    },
    {
      "id": "df8d6f3e-4f5c-4c58-8967-87180c27c8b5",
      "name": "Vérifier le format du fichier",
      "type": "n8n-nodes-base.switch",
      "position": [
        -400,
        16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "PDF",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3540ad45-eb8f-47c8-9942-c1670ec8acc0",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.files[0].filetype }}",
                    "rightValue": "pdf"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "WORD",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "659d35f5-0ae3-4a75-9744-8a776a6b0391",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.files[0].filetype }}",
                    "rightValue": "docx"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Others",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "1d14871d-5607-4315-b9c8-01eeacf2f916",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "6a259139-f6be-42f0-9018-8e3466a28742",
      "name": "Télécharger le PDF",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -48,
        -160
      ],
      "parameters": {
        "url": "={{ $json.files[0].url_private_download }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "slackApi"
      },
      "credentials": {
        "slackApi": {
          "id": "gLK2woy6bUlX7kdV",
          "name": "Slack account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0407b590-908d-4d11-8fbb-6ff8a8e93a30",
      "name": "Extraire le texte du PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        176,
        -160
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "71b2b5e9-ea55-4985-8c56-561b14fb02df",
      "name": "Convertir Word en PDF",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -48,
        32
      ],
      "parameters": {
        "url": "={{ $json.files[0].converted_pdf }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        },
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "slackApi"
      },
      "credentials": {
        "slackApi": {
          "id": "gLK2woy6bUlX7kdV",
          "name": "Slack account"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ab96f6e9-eb93-4b16-ae44-85eb8f3e0c77",
      "name": "Extraire le texte du PDF1",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        176,
        32
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "=data"
      },
      "typeVersion": 1
    },
    {
      "id": "0050c560-3da1-4ad1-ae77-933bf857c780",
      "name": "Envoyer un message d'erreur",
      "type": "n8n-nodes-base.slack",
      "position": [
        -48,
        176
      ],
      "webhookId": "97cb885e-d1af-4a93-8e27-a4bf6000ca99",
      "parameters": {
        "text": "=Only PDF or Word format contracts can be uploaded.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09EG2EN9AA",
          "cachedResultName": "contract"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "VLK4L2mMCF7UFZXF",
          "name": "Slack account 4"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ca620d80-1959-4d72-95a1-2df99125b248",
      "name": "Analyser le contenu du contrat",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        400,
        -64
      ],
      "parameters": {
        "text": "=please read and understand the input data({{ $json.text }}). I would like you to extract Client, Service Provider, Effective Date, Expiration Date, Signature Date and Contract Value. ",
        "options": {
          "systemMessage": ""
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "ff81dc90-bc72-4b4f-9751-432399ddfedf",
      "name": "Enregistrer dans Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        752,
        -64
      ],
      "parameters": {
        "columns": {
          "value": {
            "Client": "={{ $json.output[0].Client }}",
            "Contract Value": "={{ $json.output[0]['Contract Value'] }}",
            "Effective Date": "={{ $json.output[0]['Effective Date'] }}",
            "Signature Date": "={{ $json.output[0]['Signature Date'] }}",
            "Expiration Date": "={{ $json.output[0]['Expiration Date'] }}",
            "Service Provider": "={{ $json.output[0]['Service Provider'] }}"
          },
          "schema": [
            {
              "id": "Client",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Client",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Service Provider",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Service Provider",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Effective Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Effective Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Expiration Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Expiration Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Signature Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Signature Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Contract Value",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Contract Value",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ggkr6gOWmzcIbqBVuh-HVkKVvBaFj-WuYsprlMPMfOk/edit#gid=0",
          "cachedResultName": "sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ggkr6gOWmzcIbqBVuh-HVkKVvBaFj-WuYsprlMPMfOk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ggkr6gOWmzcIbqBVuh-HVkKVvBaFj-WuYsprlMPMfOk/edit?usp=drivesdk",
          "cachedResultName": "contract_management_sheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "OADOUEa3B96W0iqk",
          "name": "Google Sheets account 2"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "1b8f9d44-5c0a-4eb9-aace-509fec6337fc",
      "name": "Notifier sur Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        976,
        -64
      ],
      "webhookId": "d443ab23-594e-48f7-bf05-b85e81c967f7",
      "parameters": {
        "text": "=---\nClient: {{ $json.Client }}\nService Provider: {{ $json['Service Provider'] }}\nExpiration Date: {{ $json['Expiration Date'] }}\nEffective Date: {{ $json['Effective Date'] }}\nSignature Date: {{ $json['Signature Date'] }}\nContract Value: {{ $json['Contract Value'] }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09EG2EN9AA",
          "cachedResultName": "contract"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "id": "VLK4L2mMCF7UFZXF",
          "name": "Slack account 4"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1c065db0-d6b2-40ae-a2e3-5c5581be0db6",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -496,
        -240
      ],
      "parameters": {
        "width": 288,
        "height": 480,
        "content": "## 2. Check file format\n\n- PDF → Go to Download PDF\n- Word → Go to Convert Word to PDF\n- Others → Send Error Message\n\n\n**Note**: Contracts are generally created in PDF or Word format, so only these two formats are supported."
      },
      "typeVersion": 1
    },
    {
      "id": "d3422fd9-df2d-48bb-bada-b631843758b4",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -240
      ],
      "parameters": {
        "width": 288,
        "height": 480,
        "content": "## 1. Receive Contract File\n\n📃This node receives a contract file uploaded via Slack.\n📃The file is then passed to the workflow for format checking and further processing."
      },
      "typeVersion": 1
    },
    {
      "id": "3f441264-8120-43ea-ad29-4e8de52b9b39",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -240
      ],
      "parameters": {
        "width": 416,
        "height": 576,
        "content": "## 3. Transform file into text\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f14068f8-e327-4bcd-8c72-d684faba5dd4",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -240
      ],
      "parameters": {
        "width": 304,
        "height": 576,
        "content": "## 4. Analyze Contract Content\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b38f1853-a844-43ae-92fb-c4169a495541",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        -240
      ],
      "parameters": {
        "width": 224,
        "height": 368,
        "content": "## 5. Save to Google Sheets\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d55089f4-7887-4875-852c-e740db02344c",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        928,
        -240
      ],
      "parameters": {
        "width": 256,
        "height": 368,
        "content": "## 6. Notify on Slack"
      },
      "typeVersion": 1
    },
    {
      "id": "013d03b1-ebc7-41cf-973b-49fb6968f7eb",
      "name": "Note adhésive6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1456,
        -496
      ],
      "parameters": {
        "width": 576,
        "height": 1392,
        "content": "## Extract and Manage Contracts with Slack, GPT-4o, and Google Sheets.\n\nManaging contracts manually is time-consuming and prone to human error, especially when documents need to be shared, tracked, and stored across different tools. This workflow automates the entire process by capturing contract PDFs and Words uploaded to Slack, extracting key information with GPT, and organizing the data into a structured format inside Google Sheets. Essential fields such as client, service provider, contract value, and important dates are automatically parsed and logged, eliminating repetitive manual entry. Once the data is saved, a confirmation message is posted back to Slack so your team can quickly verify that everything has been recorded accurately.\n\n## Who’s it for\nThis workflow is ideal for operations teams, legal departments, or growing businesses that manage multiple contracts and want to maintain accuracy without spending hours on administration. By integrating Slack, GPT, and Google Sheets, you gain a simple but powerful contract management system that reduces risk, improves visibility, and keeps everyone aligned. Instead of scattered files and manual spreadsheets, you have a single automated pipeline that ensures your contract data is always up to date and accessible.\n\n## How it works\n- The workflow is triggered when a contract in PDF or Word format is shared in the designated Slack channel.\n- The uploaded file is automatically retrieved for processing.\n- Its content is extracted and converted into plain text.\n- If the file is not in PDF or Word format, an error message is sent.\n- GPT interprets the extracted text and structures the essential fields (e.g., Client, Service Provider, Effective Date, Expiration Date, Signature Date, Contract Value).\n- The structured contract information is appended as a new row in the contract tracker spreadsheet on Google Sheets.\n- A summary of the saved data is posted back to Slack for quick validation.\n\n## How to set up\n- You need to import this workflow into your n8n instance.\n- You must authenticate your Slack account and select the target channel for contract submissions.\n- You should link your Google account and specify the spreadsheet where the contract data will be stored. In this template, the required columns are Client, Service Provider, Effective Date, Expiration Date, Signature Date, and Contract Value.\n- You can adjust the GPT parsing prompt to match the specific fields that your organization requires.\n- You upload a sample contract in PDF or Word format to Slack and verify that the extracted data is correctly recorded in Google Sheets.\n\n## Requirements\n- You must have an active n8n instance in the cloud.\n- You need a Slack account with permission to upload files and send messages.\n- You must use a Google Sheets account with edit access to the target spreadsheet.\n- You need a GPT integration (e.g., OpenAI) to enable AI-powered text parsing.\n\n## How to customize the workflow\nYou can modify this workflow to fit your organization’s unique contract needs. For example, you may update the GPT parsing prompt to capture additional fields, change the target Google Sheets structure, or integrate notifications into other tools. You have full flexibility to expand or simplify the steps so the workflow matches your team’s processes and compliance requirements.\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "c02b6fd7-70d6-47ae-8ea5-2c1ead2e17da": {
      "ai_languageModel": [
        [
          {
            "node": "ca620d80-1959-4d72-95a1-2df99125b248",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "6a259139-f6be-42f0-9018-8e3466a28742": {
      "main": [
        [
          {
            "node": "0407b590-908d-4d11-8fbb-6ff8a8e93a30",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b8f9d44-5c0a-4eb9-aace-509fec6337fc": {
      "main": [
        []
      ]
    },
    "af0cd5b9-3301-4668-93ec-71e1033d3778": {
      "ai_outputParser": [
        [
          {
            "node": "ca620d80-1959-4d72-95a1-2df99125b248",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "df8d6f3e-4f5c-4c58-8967-87180c27c8b5": {
      "main": [
        [
          {
            "node": "6a259139-f6be-42f0-9018-8e3466a28742",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "71b2b5e9-ea55-4985-8c56-561b14fb02df",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "0050c560-3da1-4ad1-ae77-933bf857c780",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0050c560-3da1-4ad1-ae77-933bf857c780": {
      "main": [
        []
      ]
    },
    "71b2b5e9-ea55-4985-8c56-561b14fb02df": {
      "main": [
        [
          {
            "node": "ab96f6e9-eb93-4b16-ae44-85eb8f3e0c77",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0407b590-908d-4d11-8fbb-6ff8a8e93a30": {
      "main": [
        [
          {
            "node": "ca620d80-1959-4d72-95a1-2df99125b248",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c506d41b-aec6-48ad-a33e-15b02e256bb1": {
      "main": [
        [
          {
            "node": "df8d6f3e-4f5c-4c58-8967-87180c27c8b5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ff81dc90-bc72-4b4f-9751-432399ddfedf": {
      "main": [
        [
          {
            "node": "1b8f9d44-5c0a-4eb9-aace-509fec6337fc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ab96f6e9-eb93-4b16-ae44-85eb8f3e0c77": {
      "main": [
        [
          {
            "node": "ca620d80-1959-4d72-95a1-2df99125b248",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ca620d80-1959-4d72-95a1-2df99125b248": {
      "main": [
        [
          {
            "node": "ff81dc90-bc72-4b4f-9751-432399ddfedf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Extraction de documents, Résumé IA, IA Multimodale

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds19
Catégorie3
Types de nœuds10
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Toshiki Hirao

Toshiki Hirao

@hirao

dTosh Inc., CEO Nara Institute of Science and Technology, Assistant Professor

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34