{
  "id": 5097,
  "name": "Midjourney Image Generator via Telegram and GoAPI",
  "description": "This workflow connects Telegram to Midjourney through GoAPI, enabling automated image generation and upscaling directly from chat.\n\n### How it Works\n* **Telegram Command Trigger**: The workflow activates upon receiving a message in Telegram.\n* **Image Generation**: Your prompt is sent to GoAPI, which then generates an image using Midjourney.\n* **Upscale Selection**: You receive the generated image and select an option for upscaling.\n* **Image Upscaling**: The selected image is upscaled via GoAPI.\n* **Notifications and Logs**: Progress updates are sent to Telegram, and all images are logged in Discord.\n\n### Set Up Steps\n1.  Create a Telegram Bot and update credentials in Telegram nodes.\n2.  Create a GoAPI account, obtain an API key, and update the three HTTP nodes: \"Get Generation Task,\" \"Upscale,\" and \"Get Upscale Task\".\n3.  (Optional) Configure the Discord node for logging if desired.\n\nSetup takes approximately 10-15 minutes. Detailed descriptions are available in sticky notes within the workflow.",
  "categories": [
    {
      "id": 31,
      "name": "Content Creation"
    },
    {
      "id": 51,
      "name": "Multimodal AI"
    }
  ],
  "totalViews": 2798,
  "createdAt": "2025-06-21T10:28:50.863Z",
  "workflow": {
    "id": "5vMPZ14K9UsUERpr",
    "meta": {
      "instanceId": "b35ccbdb9bc4a47681cbf851781510a8ad80dc6d034e832a0621fa8d3517f3e4",
      "templateCredsSetupCompleted": true
    },
    "name": "GOAPI - MJ Image Generator",
    "tags": [],
    "nodes": [
      {
        "id": "24695c33-e016-4df2-b31c-259c4dba4efe",
        "name": "Telegram Trigger",
        "type": "n8n-nodes-base.telegramTrigger",
        "position": [
          60,
          165
        ],
        "webhookId": "523361db-02c3-4434-9beb-0bf272e249ae",
        "parameters": {
          "updates": [
            "message"
          ],
          "additionalFields": {}
        },
        "credentials": {
          "telegramApi": {
            "id": "credential-id",
            "name": "telegramApi Credential"
          }
        },
        "typeVersion": 1.2
      },
      {
        "id": "bc21ef50-c305-4f27-895d-019ecc5ec3f7",
        "name": "Task",
        "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": "Wait",
        "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": "Generate Image",
        "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": "credential-id",
            "name": "httpHeaderAuth Credential"
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "dbbc2387-0d6e-4ef5-b777-b6a5d95db5ee",
        "name": "Upscale",
        "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": "credential-id",
            "name": "httpHeaderAuth Credential"
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "f48fbeff-71fd-45ca-abec-7decbab1e524",
        "name": "Get Upscale",
        "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": "Notify Generation",
        "type": "n8n-nodes-base.telegram",
        "position": [
          940,
          165
        ],
        "webhookId": "6e431244-2f6b-49b4-b2e1-d858d3fa270e",
        "parameters": {
          "text": "=\ud83d\uddbc Generating Image ...",
          "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
          "additionalFields": {
            "appendAttribution": false
          }
        },
        "credentials": {
          "telegramApi": {
            "id": "credential-id",
            "name": "telegramApi Credential"
          }
        },
        "typeVersion": 1.2
      },
      {
        "id": "42506f9c-b2af-425d-8a5b-7f0fb8046d1c",
        "name": "Notify Upscaling",
        "type": "n8n-nodes-base.telegram",
        "position": [
          2040,
          40
        ],
        "webhookId": "6e431244-2f6b-49b4-b2e1-d858d3fa270e",
        "parameters": {
          "text": "=\u2197 Upscaling Image ...",
          "chatId": "={{ $('Telegram Trigger').item.json.message.chat.id }}",
          "additionalFields": {
            "appendAttribution": false
          }
        },
        "credentials": {
          "telegramApi": {
            "id": "credential-id",
            "name": "telegramApi Credential"
          }
        },
        "typeVersion": 1.2
      },
      {
        "id": "dac78f7a-02d6-4592-ae2a-ca6b6c01e9e4",
        "name": "Wait1",
        "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": "Status = complete",
        "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": "Get Index to Upscale",
        "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": "credential-id",
            "name": "telegramApi Credential"
          }
        },
        "typeVersion": 1.2
      },
      {
        "id": "a02dac7e-365f-46f6-bc2e-8b4a9c3e8376",
        "name": "Discord - Generation Log",
        "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": "credential-id",
            "name": "discordBotApi Credential"
          }
        },
        "typeVersion": 2
      },
      {
        "id": "5a91e49a-449c-453a-a3b5-a7a74f7eeaae",
        "name": "Main Log",
        "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": "credential-id",
            "name": "telegramApi Credential"
          }
        },
        "typeVersion": 1.2
      },
      {
        "id": "3c144117-29a9-4ee9-9b55-a94daf6c7a98",
        "name": "Get Prompt",
        "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": "Sticky Note",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          80,
          -180
        ],
        "parameters": {
          "width": 420,
          "height": 240,
          "content": "## Setup Instructions\n- Create a Telegram Bot and get the [Token](https://help.zoho.com/portal/en/kb/desk/support-channels/instant-messaging/telegram/articles/telegram-integration-with-zoho-desk#How_to_find_a_token_for_an_existing_Telegram_Bot).\n- Create a Telegram Connection and Update the Credentials in all Telegram Nodes.\n- Create [GoAPI](https://goapi.ai/) Account and [Get the API Key](https://goapi.ai/dashboard/key) and Update the 3 HTTP Nodes \n  - `Get Generation Task`, \n  - `Upscale`, \n  - `Get Upscale Task`"
        },
        "typeVersion": 1
      },
      {
        "id": "bf94e126-8d22-4e12-bfc7-081867ae4e29",
        "name": "Get Generation Task",
        "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": "credential-id",
            "name": "httpHeaderAuth Credential"
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "b37fb1b0-4227-4ab9-a211-64120706dd54",
        "name": "Get Upscale Task",
        "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": "credential-id",
            "name": "httpHeaderAuth Credential"
          }
        },
        "typeVersion": 4.2
      },
      {
        "id": "aa413bd6-0468-4497-9b27-2b55bd4ecbf7",
        "name": "Sticky Note1",
        "type": "n8n-nodes-base.stickyNote",
        "position": [
          2620,
          -360
        ],
        "parameters": {
          "width": 360,
          "height": 240,
          "content": "### Optional Log.\nDelete this Node if you don't want to get Logs in Discord."
        },
        "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
            }
          ]
        ]
      }
    }
  },
  "workflowInfo": {
    "nodeCount": 18,
    "nodeTypes": {
      "n8n-nodes-base.if": {
        "count": 3
      },
      "n8n-nodes-base.set": {
        "count": 1
      },
      "n8n-nodes-base.wait": {
        "count": 2
      },
      "n8n-nodes-base.discord": {
        "count": 1
      },
      "n8n-nodes-base.telegram": {
        "count": 4
      },
      "n8n-nodes-base.stickyNote": {
        "count": 2
      },
      "n8n-nodes-base.httpRequest": {
        "count": 4
      },
      "n8n-nodes-base.telegramTrigger": {
        "count": 1
      }
    }
  },
  "nodes": [
    "Telegram Trigger",
    "Task",
    "Wait",
    "Generate Image",
    "Upscale",
    "Get Upscale",
    "Notify Generation",
    "Notify Upscaling",
    "Wait1",
    "Status = complete",
    "Get Index to Upscale",
    "Discord - Generation Log",
    "Main Log",
    "Get Prompt",
    "Sticky Note",
    "Get Generation Task",
    "Get Upscale Task",
    "Sticky Note1"
  ],
  "nodeTypes": [
    "n8n-nodes-base.httpRequest",
    "n8n-nodes-base.telegramTrigger",
    "n8n-nodes-base.wait",
    "n8n-nodes-base.stickyNote",
    "n8n-nodes-base.telegram",
    "n8n-nodes-base.if",
    "n8n-nodes-base.set",
    "n8n-nodes-base.discord"
  ]
}