{
  "name": "[CloudFly] Import Workflows, Credentials",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Kh\u00f4i ph\u1ee5c Workflows, Credentials ",
        "formDescription": "Form h\u1ed7 tr\u1ee3 import Workflows, Credentials t\u1eeb file export.\n\nGhi ch\u00fa:\n- H\u1ed7 tr\u1ee3 import nhi\u1ec1u file c\u00f9ng l\u00fac\n- Ch\u1ecdn Ghi \u0111\u00e8 th\u00ec h\u1ec7 th\u1ed1ng s\u1ebd ghi \u0111\u00e8 Workflows, Credentials c\u00f3 c\u00f9ng ID\n- N\u1ebfu ch\u1ecdn \"kh\u00f4ng\" h\u1ec7 th\u1ed1ng s\u1ebd import th\u00e0nh Workflows, Credentials m\u1edbi",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Lo\u1ea1i file",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Workflows"
                  },
                  {
                    "option": "Credentials"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "File *.json",
              "fieldType": "file",
              "acceptFileTypes": ".json",
              "requiredField": true
            },
            {
              "fieldLabel": "Ghi \u0111\u00e8",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "C\u00f3"
                  },
                  {
                    "option": "Kh\u00f4ng"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "options": {
          "appendAttribution": false,
          "customCss": ":root {\n\t--font-family: 'Open Sans', sans-serif;\n\t--font-weight-normal: 400;\n\t--font-weight-bold: 600;\n\t--font-size-body: 12px;\n\t--font-size-label: 14px;\n\t--font-size-test-notice: 12px;\n\t--font-size-input: 14px;\n\t--font-size-header: 20px;\n\t--font-size-paragraph: 14px;\n\t--font-size-link: 12px;\n\t--font-size-error: 12px;\n\t--font-size-html-h1: 28px;\n\t--font-size-html-h2: 20px;\n\t--font-size-html-h3: 16px;\n\t--font-size-html-h4: 14px;\n\t--font-size-html-h5: 12px;\n\t--font-size-html-h6: 10px;\n\t--font-size-subheader: 14px;\n\n\t/* Colors */\n\t--color-background: #fbfcfe;\n\t--color-test-notice-text: #e6a23d;\n\t--color-test-notice-bg: #fefaf6;\n\t--color-test-notice-border: #f6dcb7;\n\t--color-card-bg: #ffffff;\n\t--color-card-border: #dbdfe7;\n\t--color-card-shadow: rgba(99, 77, 255, 0.06);\n\t--color-link: #7e8186;\n\t--color-header: #525356;\n\t--color-label: #555555;\n\t--color-input-border: #dbdfe7;\n\t--color-input-text: #71747A;\n\t--color-focus-border: rgb(90, 76, 194);\n\t--color-submit-btn-bg: #ff6d5a;\n\t--color-submit-btn-text: #ffffff;\n\t--color-error: #ea1f30;\n\t--color-required: #ff6d5a;\n\t--color-clear-button-bg: #7e8186;\n\t--color-html-text: #555;\n\t--color-html-link: #ff6d5a;\n\t--color-header-subtext: #7e8186;\n\n\t/* Border Radii */\n\t--border-radius-card: 8px;\n\t--border-radius-input: 6px;\n\t--border-radius-clear-btn: 50%;\n\t--card-border-radius: 8px;\n\n\t/* Spacing */\n\t--padding-container-top: 24px;\n\t--padding-card: 24px;\n\t--padding-test-notice-vertical: 12px;\n\t--padding-test-notice-horizontal: 24px;\n\t--margin-bottom-card: 16px;\n\t--padding-form-input: 12px;\n\t--card-padding: 24px;\n\t--card-margin-bottom: 16px;\n\n\t/* Dimensions */\n\t--container-width: 448px;\n\t--submit-btn-height: 48px;\n\t--checkbox-size: 18px;\n\n\t/* Others */\n\t--box-shadow-card: 0px 4px 16px 0px var(--color-card-shadow);\n\t--opacity-placeholder: 0.5;\n}\n\n.form-header p {\n  text-align: left;\n}"
        }
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        0,
        740
      ],
      "id": "036f094b-8cb7-4771-a9d9-66e44c676bb7",
      "name": "Form import Workflows, Credentials"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('Form import Workflows, Credentials').item.json['Lo\u1ea1i file'] }}",
                    "rightValue": "Workflows",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "20f18328-de46-42bd-ad12-0daf34ec844c"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "ddb3a508-40fe-4f0d-9aa8-b2b9355e3cd5",
                    "leftValue": "={{ $('Form import Workflows, Credentials').item.json['Lo\u1ea1i file'] }}",
                    "rightValue": "Credentials",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        2420,
        740
      ],
      "id": "25704024-bd1d-4ea2-b895-fc1efccb35a8",
      "name": "Switch"
    },
    {
      "parameters": {
        "executeOnce": false,
        "command": "=n8n import:workflow --input=/tmp/import-{{ new Date($('Form import Workflows, Credentials').item.json.submittedAt).getTime() }}_{{$node[\"Loop Over Items\"].context[\"currentRunIndex\"];}}.json"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        2640,
        640
      ],
      "id": "30e59049-6a95-4e11-b26f-7fef465d1968",
      "name": "Restore Workflows"
    },
    {
      "parameters": {
        "executeOnce": false,
        "command": "=n8n import:credentials --input=/tmp/import-{{ new Date($('Form import Workflows, Credentials').item.json.submittedAt).getTime() }}_{{$node[\"Loop Over Items\"].context[\"currentRunIndex\"];}}.json"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        2640,
        840
      ],
      "id": "824e9b2b-5542-4575-a2b4-36024b4c3fcb",
      "name": "Restore Credentials"
    },
    {
      "parameters": {
        "chatId": "0",
        "text": "=B\u1ea1n \u0111\u00e3 import th\u00e0nh c\u00f4ng {{ $('Form import Workflows, Credentials').item.json['File *.json'].length }} file {{ $('Form import Workflows, Credentials').item.json['Lo\u1ea1i file'] }} !",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        880,
        520
      ],
      "id": "d4f145dd-82f8-4493-9421-63b82facfd3f",
      "name": "Telegram",
      "executeOnce": true
    },
    {
      "parameters": {
        "operation": "write",
        "fileName": "=/tmp/import-{{ new Date($('Form import Workflows, Credentials').item.json.submittedAt).getTime() }}_{{$node[\"Loop Over Items\"].context[\"currentRunIndex\"];}}.json",
        "dataPropertyName": "=data",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        2200,
        760
      ],
      "id": "c98e1096-daba-456c-8e84-b2fa69fbc522",
      "name": "Write Files to Disk"
    },
    {
      "parameters": {
        "operation": "completion",
        "completionTitle": "T\u1ea3i l\u00ean th\u00e0nh c\u00f4ng !",
        "completionMessage": "=B\u1ea1n \u0111\u00e3 t\u1ea3i l\u00ean file import th\u00e0nh c\u00f4ng, h\u1ec7 th\u1ed1ng s\u1ebd t\u1ef1 \u0111\u1ed9ng import v\u00e0 th\u00f4ng b\u00e1o sau khi ho\u00e0n th\u00e0nh ! ",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 1,
      "position": [
        220,
        740
      ],
      "id": "c8f62a91-6881-4b25-9b32-6f01ac793dc2",
      "name": "Form"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        660,
        740
      ],
      "id": "552b4bd5-2673-4724-af2c-3dc71339304b",
      "name": "Loop Over Items",
      "notesInFlow": false,
      "alwaysOutputData": false
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.1,
      "position": [
        2860,
        820
      ],
      "id": "2388ed50-7957-4d96-806a-7db647a71c36",
      "name": "Merge"
    },
    {
      "parameters": {
        "jsCode": "const data = $input.last().json\nconst binaryData = $input.last().binary\n\nlet output = []\n\nObject.keys(binaryData).forEach( b => {\n  output.push({\n    json: data,\n    binary: { data: binaryData[b]}\n  })\n})\n\nreturn output"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        440,
        740
      ],
      "id": "f261c603-0985-4de7-bb6d-1b98c36aaf15",
      "name": "Code"
    },
    {
      "parameters": {
        "operation": "fromJson",
        "options": {}
      },
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        1100,
        640
      ],
      "id": "54832a94-f0f4-49d1-a9e3-9b27048f4a39",
      "name": "Extract from File"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "64147178-2b4f-4d0c-8d7a-aa4517d80c23",
              "leftValue": "={{ $('Form').item.json['Ghi \u0111\u00e8'] }}",
              "rightValue": "Kh\u00f4ng",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        880,
        740
      ],
      "id": "c047ebe4-da6c-4b3f-a814-78268a1a0095",
      "name": "If"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "4b20db54-4b05-4753-9647-866b6708a795",
              "name": "data.name",
              "value": "={{ $json.data.name }} - {{ $json.data.id.split('')\n    .sort(() => Math.random() - 0.5)\n    .join('') }}",
              "type": "string"
            },
            {
              "id": "519634ba-80c6-4593-99ac-1b6551f1695d",
              "name": "data.id",
              "value": "={{ $json.data.id.split('')\n    .sort(() => Math.random() - 0.5)\n    .join('') }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {
          "stripBinary": true
        }
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1320,
        640
      ],
      "id": "595b7f41-04a0-45e4-a417-96adaee70dce",
      "name": "Edit Fields",
      "notesInFlow": true,
      "notes": "Thay \u0111\u1ed5i th\u00f4ng tin name v\u00e0 id c\u0169 \u0111\u1ec3 kh\u00f4ng ghi \u0111\u00e8"
    },
    {
      "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {
          "format": true
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1960,
        500
      ],
      "id": "ce4616f7-bb68-422e-96dc-7cde0d49e104",
      "name": "Convert to File"
    },
    {
      "parameters": {
        "jsCode": "return $input.first().json.data"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1520,
        640
      ],
      "id": "47b67c96-27fa-40db-9fdb-d1d6e1601d10",
      "name": "Tr\u1ea3 v\u1ec1 data file khi x\u1eed l\u00fd"
    },
    {
      "parameters": {
        "content": "## H\u01b0\u1edbng d\u1eabn s\u1eed d\u1ee5ng\n\n**Double click** v\u00e0o Form import **Workflows**, **Credentials**  \nCh\u1ecdn tab **\"Production URL\"** v\u00e0 copy link, m\u1edf qua tab m\u1edbi. B\u1ea1n s\u1ebd nh\u1eadn \u0111\u01b0\u1ee3c m\u00e0n h\u00ecnh nh\u01b0 sau:\n![M\u00e0n h\u00ecnh import](https://media.cloudfly.vn/posts/image_2025-05-28_09-03-13.png) \nT\u1ea3i l\u00ean file v\u00e0 h\u1ec7 th\u1ed1ng s\u1ebd t\u1ef1 \u0111\u1ed9ng import **Workflows** v\u00e0 **Credentials**.\nChi ch\u00fa:\n- B\u1ea1n c\u00f3 th\u1ec3 c\u1ea5u h\u00ecnh node Telegram \u0111\u1ec3 nh\u1eadn th\u00f4ng b\u00e1o sau khi import th\u00e0nh c\u00f4ng",
        "height": 700,
        "width": 540
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "35d5ad83-c2e0-4235-9771-dd466bd9dc47",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "4213bcd8-01fd-491f-b8e1-940423ed4aa7",
              "leftValue": "={{ $('Form').item.json['Lo\u1ea1i file'] }}",
              "rightValue": "Credentials",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1720,
        600
      ],
      "id": "f1f5c0e9-8abf-4614-936b-85aee51fb834",
      "name": "If1"
    },
    {
      "parameters": {
        "operation": "toJson",
        "options": {
          "format": true
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1960,
        660
      ],
      "id": "be136657-f7d5-47d9-92a9-711230dbedf8",
      "name": "Convert to File1"
    }
  ],
  "connections": {
    "Form import Workflows, Credentials": {
      "main": [
        [
          {
            "node": "Form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Restore Workflows",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Restore Credentials",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Restore Workflows": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Restore Credentials": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Write Files to Disk": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Telegram",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Write Files to Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Tr\u1ea3 v\u1ec1 data file khi x\u1eed l\u00fd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Write Files to Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tr\u1ea3 v\u1ec1 data file khi x\u1eed l\u00fd": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File1": {
      "main": [
        [
          {
            "node": "Write Files to Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9dc37cf2-4ed0-43b2-97e5-510281f2799c",
  "id": "Bcb01InZHR0Le0aI",
  "tags": []
}