8
n8n 中文网amn8n.com

GOAPI - MJ图像生成器

高级

这是一个AI领域的自动化工作流,包含 18 个节点。主要使用 If, Set, Wait, Discord, Telegram 等节点,结合人工智能技术实现智能自动化。 通过Telegram和GoAPI的Midjourney图像生成器

前置要求
  • Discord Bot Token 或 Webhook
  • Telegram Bot Token
  • 可能需要目标 API 的认证凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "5vMPZ14K9UsUERpr",
  "meta": {
    "instanceId": "b35ccbdb9bc4a47681cbf851781510a8ad80dc6d034e832a0621fa8d3517f3e4",
    "templateCredsSetupCompleted": true
  },
  "name": "GOAPI - MJ 图像生成器",
  "tags": [],
  "nodes": [
    {
      "id": "24695c33-e016-4df2-b31c-259c4dba4efe",
      "name": "Telegram 触发器",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        60,
        165
      ],
      "webhookId": "523361db-02c3-4434-9beb-0bf272e249ae",
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "id": "ia3cN9ufG9KhvT3V",
          "name": "your_bot_name"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "bc21ef50-c305-4f27-895d-019ecc5ec3f7",
      "name": "任务",
      "type": "n8n-nodes-base.set",
      "position": [
        500,
        165
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7a7bba3d-2761-44a9-97a1-c7ed9f849cfb",
              "name": "chatInput",
              "type": "string",
              "value": "={{ $json.message.text }}"
            },
            {
              "id": "2d103541-f87c-4780-acf1-43f0fb7a488a",
              "name": "sessionId",
              "type": "string",
              "value": "={{ $json.message.from.username }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3ade84ce-e582-445b-b9aa-42b85d763d8a",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        1600,
        265
      ],
      "webhookId": "b878dae2-db3c-410a-8ef1-359699b31298",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "309a8c7e-74e8-4e0b-9022-be9b524261d7",
      "name": "生成图像",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        720,
        165
      ],
      "parameters": {
        "url": "https://api.goapi.ai/api/v1/task",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"midjourney\",\n  \"task_type\": \"imagine\",\n  \"input\": {\n    \"prompt\": \"{{ $json.chatInput }}\",\n    \"aspect_ratio\": \"12:16\",\n    \"process_mode\": \"fast\",\n    \"skip_prompt_check\": false,\n    \"bot_id\": 0\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "0UXrjhCwxcOJzsxi",
          "name": "dhruv21 - GoAPI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dbbc2387-0d6e-4ef5-b777-b6a5d95db5ee",
      "name": "放大",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1820,
        40
      ],
      "parameters": {
        "url": "=https://api.goapi.ai/api/v1/task",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"model\": \"midjourney\",\n    \"task_type\": \"upscale\",\n    \"input\": {\n        \"origin_task_id\": \"{{ $('Generate Image').item.json.data.task_id }}\",\n        \"index\": \"{{ $json.data[\"Image Index\"] }}\"\n    }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "0UXrjhCwxcOJzsxi",
          "name": "dhruv21 - GoAPI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f48fbeff-71fd-45ca-abec-7decbab1e524",
      "name": "获取放大结果",
      "type": "n8n-nodes-base.if",
      "position": [
        2480,
        -110
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "48d40457-1a52-4a14-b02b-a87254996224",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "84c2c579-39ed-4940-9ded-9b9056a12767",
      "name": "通知生成",
      "type": "n8n-nodes-base.telegram",
      "position": [
        940,
        165
      ],
      "webhookId": "6e431244-2f6b-49b4-b2e1-d858d3fa270e",
      "parameters": {
        "text": "=🖼 Generating Image ...",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "ia3cN9ufG9KhvT3V",
          "name": "your_bot_name"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "42506f9c-b2af-425d-8a5b-7f0fb8046d1c",
      "name": "通知放大",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2040,
        40
      ],
      "webhookId": "6e431244-2f6b-49b4-b2e1-d858d3fa270e",
      "parameters": {
        "text": "=↗ Upscaling Image ...",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "ia3cN9ufG9KhvT3V",
          "name": "your_bot_name"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dac78f7a-02d6-4592-ae2a-ca6b6c01e9e4",
      "name": "等待1",
      "type": "n8n-nodes-base.wait",
      "position": [
        2700,
        140
      ],
      "webhookId": "3d915e34-f435-4143-9465-8dd305c1cb0a",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "15c49101-d579-44ae-baed-3d01522a1d96",
      "name": "状态 = 完成",
      "type": "n8n-nodes-base.if",
      "position": [
        1380,
        90
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "48d40457-1a52-4a14-b02b-a87254996224",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c22de90c-3d63-47c9-a2f1-3363d261ba1f",
      "name": "获取待放大索引",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1600,
        40
      ],
      "webhookId": "04f9a46d-91b7-4dae-8fc2-d820bd1e64f8",
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "message": "={{ $json.data.output.image_url }}",
        "options": {
          "appendAttribution": false,
          "messageButtonLabel": "Select Image to Upscale"
        },
        "operation": "sendAndWait",
        "formFields": {
          "values": [
            {
              "fieldType": "number",
              "fieldLabel": "Image Index"
            }
          ]
        },
        "responseType": "customForm"
      },
      "credentials": {
        "telegramApi": {
          "id": "ia3cN9ufG9KhvT3V",
          "name": "your_bot_name"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a02dac7e-365f-46f6-bc2e-8b4a9c3e8376",
      "name": "Discord - 生成日志",
      "type": "n8n-nodes-base.discord",
      "position": [
        2700,
        -260
      ],
      "webhookId": "e4b991b2-3f62-4986-87d4-3a7d38e48d49",
      "parameters": {
        "content": "=### All Render Image\n\n{{ $('Get Generation Task').item.json.data.output.image_url }}\n\n### Individual Render Image\n\n{{ $('Get Generation Task').item.json.data.output.temporary_image_urls.join('\\n\\n') }}\n\n### Final Upscaled Image\n\n{{ $json.data.output.image_url }}\n",
        "guildId": {
          "__rl": true,
          "mode": "list",
          "value": "697416344865472593",
          "cachedResultUrl": "https://discord.com/channels/697416344865472593",
          "cachedResultName": "server"
        },
        "options": {
          "flags": [
            "SUPPRESS_EMBEDS",
            "SUPPRESS_NOTIFICATIONS"
          ]
        },
        "resource": "message",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "1385916790785314836",
          "cachedResultUrl": "https://discord.com/channels/697416344865472593/1385916790785314836",
          "cachedResultName": "goapi-mj-image-log"
        }
      },
      "credentials": {
        "discordBotApi": {
          "id": "uwNeLNyglDNBio3d",
          "name": "Discord Bot - Korex Automation Bot"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "5a91e49a-449c-453a-a3b5-a7a74f7eeaae",
      "name": "主日志",
      "type": "n8n-nodes-base.telegram",
      "position": [
        2700,
        -60
      ],
      "webhookId": "6e431244-2f6b-49b4-b2e1-d858d3fa270e",
      "parameters": {
        "text": "={{ $json.data.output.image_url }}",
        "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "ia3cN9ufG9KhvT3V",
          "name": "your_bot_name"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3c144117-29a9-4ee9-9b55-a94daf6c7a98",
      "name": "获取提示",
      "type": "n8n-nodes-base.if",
      "position": [
        280,
        165
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "9e365352-039b-451f-940d-d87ed138e432",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.message.from.username }}",
              "rightValue": "username"
            },
            {
              "id": "40df18a4-0f52-481c-8885-094d1f793b05",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.message.text }}",
              "rightValue": "/start"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c80a05ba-51ce-44b7-9c28-3ea20ea96fa0",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -180
      ],
      "parameters": {
        "width": 420,
        "height": 240,
        "content": "## 设置说明"
      },
      "typeVersion": 1
    },
    {
      "id": "bf94e126-8d22-4e12-bfc7-081867ae4e29",
      "name": "获取生成任务",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1160,
        165
      ],
      "parameters": {
        "url": "=https://api.goapi.ai/api/v1/task/{{ $('Generate Image').item.json.data.task_id }}\n",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "0UXrjhCwxcOJzsxi",
          "name": "dhruv21 - GoAPI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b37fb1b0-4227-4ab9-a211-64120706dd54",
      "name": "获取放大任务",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2260,
        40
      ],
      "parameters": {
        "url": "=https://api.goapi.ai/api/v1/task/{{ $('Upscale').item.json.data.task_id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "0UXrjhCwxcOJzsxi",
          "name": "dhruv21 - GoAPI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "aa413bd6-0468-4497-9b27-2b55bd4ecbf7",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2620,
        -360
      ],
      "parameters": {
        "width": 360,
        "height": 240,
        "content": "### 可选日志。"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "XqrFvCFdlyFR3Uza",
    "executionOrder": "v1"
  },
  "versionId": "37d45c4b-5176-45dd-9493-8fc354552a59",
  "connections": {
    "Task": {
      "main": [
        [
          {
            "node": "Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get Generation Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Get Upscale Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upscale": {
      "main": [
        [
          {
            "node": "Notify Upscaling",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Prompt": {
      "main": [
        [
          {
            "node": "Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Upscale": {
      "main": [
        [
          {
            "node": "Main Log",
            "type": "main",
            "index": 0
          },
          {
            "node": "Discord - Generation Log",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Notify Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Upscale Task": {
      "main": [
        [
          {
            "node": "Get Upscale",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Upscaling": {
      "main": [
        [
          {
            "node": "Get Upscale Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Get Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Generation": {
      "main": [
        [
          {
            "node": "Get Generation Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Status = complete": {
      "main": [
        [
          {
            "node": "Get Index to Upscale",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Generation Task": {
      "main": [
        [
          {
            "node": "Status = complete",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Index to Upscale": {
      "main": [
        [
          {
            "node": "Upscale",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 人工智能

需要付费吗?

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

工作流信息
难度等级
高级
节点数量18
分类1
节点类型8
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Dhruv Dalsaniya

Dhruv Dalsaniya

@ddm21

IT Professional & Freelance Automation Consultant specializing in AI-driven automation and business process optimization

外部链接
在 n8n.io 查看

分享此工作流