8
n8n 中文网amn8n.com

随机字符串生成器

中级

这是一个Engineering, Building Blocks领域的自动化工作流,包含 8 个节点。主要使用 Set, Form, Html, Crypto, Summarize 等节点。 通过交互式表单生成可自定义的随机字符串

前置要求
  • 无特殊前置要求,导入即可使用
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "43hulIlfnB1UAXxn",
  "meta": {
    "instanceId": "135b9ed6d0f8a3f531d9011b0173000ad0dac1ffc90258e867f38c270f30c9dc",
    "templateCredsSetupCompleted": true
  },
  "name": "随机字符串生成器",
  "tags": [],
  "nodes": [
    {
      "id": "9025bee8-18c5-4e9f-be2d-50ec77ba1730",
      "name": "生成随机字符串",
      "type": "n8n-nodes-base.crypto",
      "position": [
        200,
        -20
      ],
      "parameters": {
        "action": "generate",
        "encodingType": "base64",
        "stringLength": "={{ $('rand_generator_form').item.json.length }}"
      },
      "executeOnce": false,
      "retryOnFail": false,
      "typeVersion": 1,
      "alwaysOutputData": true
    },
    {
      "id": "f82ca3f1-25b8-4d84-8dc9-055364aac3a7",
      "name": "随机生成器表单",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -240,
        -20
      ],
      "webhookId": "7e236f55-0d8a-4f7f-b4a2-ac0ae7db691d",
      "parameters": {
        "options": {
          "buttonLabel": "Generate now"
        },
        "formTitle": "rand pass generator",
        "formFields": {
          "values": [
            {
              "fieldType": "number",
              "fieldLabel": "length",
              "placeholder": "16",
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "copies",
              "placeholder": "5",
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode"
      },
      "typeVersion": 2.2
    },
    {
      "id": "042211a5-364c-43d5-a4e1-d3842c3c90d3",
      "name": "显示结果",
      "type": "n8n-nodes-base.form",
      "position": [
        1080,
        -20
      ],
      "webhookId": "0bfef085-f443-41ff-84da-811f21e7200e",
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "={{ $json.html }}"
      },
      "typeVersion": 1
    },
    {
      "id": "2d8f8a46-8260-4f03-b48a-aff708c17297",
      "name": "格式化为HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        860,
        -20
      ],
      "parameters": {
        "html": "<!DOCTYPE html>\n\n<html>\n<head>\n  <meta charset=\"UTF-8\" />\n  <title>random strings</title>\n</head>\n<body>\n  <div class=\"container\">\n  <h2>{{ $('rand_generator_form').item.json.copies }}X {{ $('rand_generator_form').item.json.length }}-char random strings</H2>\n  \n  <ul>{{ $json.concatenated_data }}</ul>\n  </div>\n</body>\n</html>\n\n<style>\ncontainer {\n  background-color: #ffffff;\n  text-align: center;\n  padding: 16px;\n  border-radius: 8px;\n}\n\nh1 {\n  color: #ff6d5a;\n  font-size: 24px;\n  font-weight: bold;\n  padding: 8px;\n}\n\nh2 {\n  color: #909399;\n  font-size: 18px;\n  font-weight: bold;\n  padding: 8px;\n}\n</style>\n\n<script>\nconsole.log(\"Hello World!\");\n</script>"
      },
      "typeVersion": 1.2
    },
    {
      "id": "8a133d07-aad9-4b34-94f2-dfe624602a3d",
      "name": "连接项目",
      "type": "n8n-nodes-base.summarize",
      "position": [
        640,
        -20
      ],
      "parameters": {
        "options": {},
        "fieldsToSummarize": {
          "values": [
            {
              "field": "data",
              "separateBy": "\n",
              "aggregation": "concatenate"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "5373a3a2-fe56-4278-95f5-ddee17ad2e5c",
      "name": "格式化项目",
      "type": "n8n-nodes-base.set",
      "position": [
        420,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ac0116d7-11bb-4a51-8660-d4c276e52ba3",
              "name": "data",
              "type": "string",
              "value": "=<li>{{ $json.data }}</li>"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2a9c823c-8fdc-42a3-8787-384373cb695d",
      "name": "重复项",
      "type": "n8n-nodes-base.set",
      "position": [
        -20,
        -20
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": []
        },
        "duplicateItem": true,
        "duplicateCount": "={{ $json.copies -1}}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "fdcbc663-20b4-4d19-ad61-a28b92f1c137",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -180
      ],
      "parameters": {
        "width": 1640,
        "height": 600,
        "content": "## 随机字符串生成器"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b5495b3b-4ce9-4050-a952-6403342eb547",
  "connections": {
    "duplicates": {
      "main": [
        [
          {
            "node": "Generate a random string",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "format an item": {
      "main": [
        [
          {
            "node": "concatenate items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "format into html": {
      "main": [
        [
          {
            "node": "Display results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "concatenate items": {
      "main": [
        [
          {
            "node": "format into html",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "rand_generator_form": {
      "main": [
        [
          {
            "node": "duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate a random string": {
      "main": [
        [
          {
            "node": "format an item",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 工程, 构建模块

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量8
分类2
节点类型7
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Ger Longstacks

Ger Longstacks

@dims3body

DevOps expert passionate with automation, be it infrastructure provisioning, cloud operation, or workflow.

外部链接
在 n8n.io 查看

分享此工作流