Créer, supprimer et organiser des compartiments S3 AWS et des fichiers directement depuis votre email

Intermédiaire

Ceci est unFile Management, Multimodal AIworkflow d'automatisation du domainecontenant 15 nœuds.Utilise principalement des nœuds comme If, Code, AwsS3, Switch, EmailSend. Créer, supprimer et organiser directement depuis vos e-mails les buckets de fichiers AWS S3 et les fichiers

Prérequis
  • Access Key et Secret AWS
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
{
  "id": "OO8dBG01EPaQGcVA",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Create, Delete, and Organize AWS S3 Buckets & Files Directly from Your Email",
  "tags": [],
  "nodes": [
    {
      "id": "de49fbb0-5d1b-42ad-b500-beed9e895414",
      "name": "Démarrer le workflow (requête GET)",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        0,
        920
      ],
      "parameters": {
        "options": {
          "customEmailConfig": "[\"UNSEEN\", [\"SUBJECT\", \"s3\"]]"
        }
      },
      "credentials": {
        "imap": {
          "id": "zTEGYssr7MSVeCs3",
          "name": "IMAP-test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4ab408d8-416d-4a39-91cd-3e06553c36a1",
      "name": "Extraire les données de l'email",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        920
      ],
      "parameters": {
        "jsCode": "const emailBody = $json[\"textPlain\"] || \"\";\n\n// Helper function to match patterns\nfunction matchFirst(patterns) {\n  for (const pattern of patterns) {\n    const match = emailBody.match(pattern);\n    if (match) return match[1];\n  }\n  return null;\n}\n\n// Detect bucket name\nconst bucket = matchFirst([\n  /bucket[:\\s*]*([a-z0-9.-]+)/i,\n  /on bucket\\s+([a-z0-9.-]+)/i\n]);\n\n// Detect file name\nconst fileName = matchFirst([\n  /file[:\\s*]*([^\\s]+)/i,\n  /named\\s+([^\\s]+)/i\n]);\n\n// Detect source file (for copy)\nconst sourceFile = matchFirst([\n  /source\\s+([^\\s]+)/i\n]);\n\n// Detect destination file (for copy)\nconst destFile = matchFirst([\n  /destination\\s+([^\\s]+)/i\n]);\n\n// Decide task type\nlet task_type = null;\nif (/create bucket/i.test(emailBody)) task_type = \"create_bucket\";\nelse if (/delete bucket/i.test(emailBody)) task_type = \"delete_bucket\";\nelse if (/copy file/i.test(emailBody)) task_type = \"copy_file\";\nelse if (/delete file/i.test(emailBody)) task_type = \"delete_file\";\nelse if (/download file/i.test(emailBody)) task_type = \"download_file\";\nelse if (/upload file/i.test(emailBody)) task_type = \"upload_file\";\nelse if (/list files/i.test(emailBody)) task_type = \"get_files\";\n\nreturn [\n  {\n    json: {\n      bucket,\n      fileName,\n      sourceFile,\n      destFile,\n      task_type\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d2926988-4e41-4d5e-84e2-75893ed04565",
      "name": "Créer un bucket",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        320
      ],
      "parameters": {
        "name": "new-project",
        "resource": "bucket",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "1401cf3e-62c1-44db-bca6-29231f3add1e",
      "name": "Supprimer un bucket",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        520
      ],
      "parameters": {
        "name": "new-project",
        "resource": "bucket",
        "operation": "delete"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "43d9a1bb-6ad5-4916-91ef-0e9df365d8f4",
      "name": "Copier un fichier",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        720
      ],
      "parameters": {
        "operation": "copy",
        "sourcePath": "/old/old-project-image.jpg",
        "destinationPath": "/new/new-project-image.jpg",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "b7af67ad-ba3d-41fe-96fc-3613f332a1fa",
      "name": "Téléverser un fichier",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        1320
      ],
      "parameters": {
        "fileName": "/new/new-project-image.jpg",
        "operation": "upload",
        "bucketName": "new-project",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e8290bcc-0816-421d-bea3-e588809d63b9",
      "name": "Obtenir plusieurs fichiers",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        1520
      ],
      "parameters": {
        "options": {},
        "operation": "getAll",
        "bucketName": "={{ $json.bucket }}"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "cd585a21-6073-4a59-a157-943360266ac4",
      "name": "Télécharger un fichier",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        1120
      ],
      "parameters": {
        "fileKey": "/new/new-project-image.jpg",
        "bucketName": "new-project"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "33819696-4b09-45c8-b938-0a929281be26",
      "name": "Supprimer un fichier",
      "type": "n8n-nodes-base.awsS3",
      "position": [
        660,
        920
      ],
      "parameters": {
        "fileKey": "/new/new-project-image.jpg",
        "options": {},
        "operation": "delete",
        "bucketName": "new-project-image"
      },
      "credentials": {
        "aws": {
          "id": "KRRqQf7ufs26Mvaq",
          "name": "AWS account - test"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ae71cb97-4e9e-4733-a024-990045bed90f",
      "name": "Vérifier le type de tâche",
      "type": "n8n-nodes-base.switch",
      "position": [
        440,
        836
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "99e9f0b2-e19b-45c5-a60e-317d772e6291",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "create_bucket"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "4e72b4c7-eed9-4039-84c7-773a4dee2eb6",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "delete_bucket"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "aef1b8b8-9175-4819-9cb8-87209e4b2954",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "copy_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a256941b-0882-4ee1-9126-491da78f5fb4",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "delete_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "a502de56-2efa-4766-b883-65d8cefaab1a",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "download_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "62aae8fd-71f2-4194-af78-b8d42179a2d0",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "upload_file"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e70fb51d-7d2e-4ed2-bdde-7edd03059033",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.task_type }}",
                    "rightValue": "get_files"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "a3b10fac-ff46-4aac-9683-949c4c6246c8",
      "name": "Envoyer un email d'échec",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1100,
        1020
      ],
      "webhookId": "2c315c54-22bb-49c5-8f74-5f32569b8821",
      "parameters": {
        "text": "=AWS S3 Operation Failed",
        "options": {
          "replyTo": "={{ $('Start Workflow (GET Request)').item.json.from }}"
        },
        "subject": "=AWS S3 Operation Failed",
        "toEmail": "={{ $('Start Workflow (GET Request)').item.json.from }}",
        "fromEmail": "xyz@gmail.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7c01eb42-56e7-431e-ba13-9fa8b88cb84f",
      "name": "Envoyer un email de succès",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1100,
        820
      ],
      "webhookId": "2c315c54-22bb-49c5-8f74-5f32569b8821",
      "parameters": {
        "text": "=AWS S3 Operation Successful",
        "options": {
          "replyTo": "={{ $('Start Workflow (GET Request)').item.json.from }}"
        },
        "subject": "=AWS S3 Operation Successful",
        "toEmail": "={{ $('Start Workflow (GET Request)').item.json.from }}",
        "fromEmail": "xyz@gmail.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "id": "G1kyF8cSWTZ4vouN",
          "name": "SMTP -test"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d79e2096-604a-441b-9697-6e308b3002f5",
      "name": "Vérification - succès ou échec",
      "type": "n8n-nodes-base.if",
      "position": [
        880,
        920
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "045a2b56-33db-45b3-8c14-ad7d0ba64db7",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.Key }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": true
    },
    {
      "id": "d6872864-93fc-462a-8693-41377e283d37",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        380
      ],
      "parameters": {
        "width": 1000,
        "height": 140,
        "content": "\n## What is this workflow for?\n### This workflow enables the management of AWS S3 buckets and files by processing email commands. It supports creating and deleting buckets, uploading and downloading files, copying files, and listing files, with automated email responses for confirmation or failure."
      },
      "typeVersion": 1
    },
    {
      "id": "c19d98fb-6112-4886-807f-c78f5aead7be",
      "name": "Note adhésive 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -680,
        760
      ],
      "parameters": {
        "color": 4,
        "width": 560,
        "height": 400,
        "content": "## How It Works\n- **Start Workflow (GET Request)** - Captures incoming email requests.\n- **Extract Data from Email** - Parses email content to extract S3 operation commands.\n- **Check Task Type** - Validates the type of task (e.g., create bucket, delete file).\n- **Create a Bucket** - Creates a new S3 bucket.\n- **Delete a Bucket** - Deletes an existing S3 bucket.\n- **Copy a File** - Copies a file within S3.\n- **Delete a File** - Deletes a file from S3.\n- **Download a File** - Downloads a file from S3.\n- **Upload a File** - Uploads a file to S3.\n- **Get Many Files** - Lists multiple files in a bucket.\n- **Check Success or Fail** - Determines the outcome of the operation.\n- **Send Success Email** - Sends a success confirmation email.\n- **Send Failed Email** - Sends a failure notification email."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2bdf2886-f43d-4a91-853c-f40359658edd",
  "connections": {
    "43d9a1bb-6ad5-4916-91ef-0e9df365d8f4": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "33819696-4b09-45c8-b938-0a929281be26": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b7af67ad-ba3d-41fe-96fc-3613f332a1fa": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e8290bcc-0816-421d-bea3-e588809d63b9": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ae71cb97-4e9e-4733-a024-990045bed90f": {
      "main": [
        [
          {
            "node": "d2926988-4e41-4d5e-84e2-75893ed04565",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "1401cf3e-62c1-44db-bca6-29231f3add1e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "43d9a1bb-6ad5-4916-91ef-0e9df365d8f4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "33819696-4b09-45c8-b938-0a929281be26",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "cd585a21-6073-4a59-a157-943360266ac4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "b7af67ad-ba3d-41fe-96fc-3613f332a1fa",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e8290bcc-0816-421d-bea3-e588809d63b9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d2926988-4e41-4d5e-84e2-75893ed04565": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1401cf3e-62c1-44db-bca6-29231f3add1e": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cd585a21-6073-4a59-a157-943360266ac4": {
      "main": [
        [
          {
            "node": "d79e2096-604a-441b-9697-6e308b3002f5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d79e2096-604a-441b-9697-6e308b3002f5": {
      "main": [
        [
          {
            "node": "7c01eb42-56e7-431e-ba13-9fa8b88cb84f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a3b10fac-ff46-4aac-9683-949c4c6246c8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4ab408d8-416d-4a39-91cd-3e06553c36a1": {
      "main": [
        [
          {
            "node": "ae71cb97-4e9e-4733-a024-990045bed90f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "de49fbb0-5d1b-42ad-b500-beed9e895414": {
      "main": [
        [
          {
            "node": "4ab408d8-416d-4a39-91cd-3e06553c36a1",
            "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é ?

Intermédiaire - Gestion de fichiers, 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é
Intermédiaire
Nombre de nœuds15
Catégorie2
Types de nœuds7
Description de la difficulté

Adapté aux utilisateurs expérimentés, avec des workflows de complexité moyenne contenant 6-15 nœuds

Auteur
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34