Generación de imágenes con OpenAI GPT-Image-1 y compartición a través de Telegram

Avanzado

Este es unDesign, AI, Marketingflujo de automatización del dominio deautomatización que contiene 18 nodos.Utiliza principalmente nodos como Set, Switch, Telegram, FormTrigger, GoogleDrive, combinando tecnología de inteligencia artificial para lograr automatización inteligente. Generar y editar imágenes con OpenAI GPT-Image-1 y compartir por Telegram

Requisitos previos
  • Bot Token de Telegram
  • Credenciales de API de Google Drive
  • Pueden requerirse credenciales de autenticación para la API de destino
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "meta": {
    "instanceId": "2fa7acc0cd134988fb8b40b8d8b56c9f29ee37789503fef505450e2733dc2bdf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "0b66ad6f-d216-41f3-a6dc-61cf15a2044a",
      "name": "Establecer permisos de acceso",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -2220,
        -1000
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "vM5RNejQ9XDoP6Ld",
          "name": "Google Sheets n8n dev service account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "724b14c0-6763-47f5-87a1-ed0dde7e8a9e",
      "name": "Editar imagen (OpenAI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3060,
        -1000
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/images/edits",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "image",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "={{ $json[\"input image url\"].isEmpty()?\"input_image\":\"data\"}}"
            },
            {
              "name": "prompt",
              "value": "={{ $json.Promt }}"
            },
            {
              "name": "model",
              "value": "gpt-image-1"
            },
            {
              "name": "n",
              "value": "1"
            },
            {
              "name": "size",
              "value": "1024x1024"
            },
            {
              "name": "quality",
              "value": "={{ $json.quality }}"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "3ff0w5x5tfolokJ7",
          "name": "OpenAi account mingles new dev user"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "071f9711-3b73-411d-9962-b540f0b418c7",
      "name": "Convertir binario json a archivo",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -2740,
        -620
      ],
      "parameters": {
        "options": {
          "fileName": "={{ $now.format('yyyy-MM-dd_HHmmss')+\".png\" }}",
          "mimeType": "image/png"
        },
        "operation": "toBinary",
        "sourceProperty": "data[0].b64_json"
      },
      "typeVersion": 1.1
    },
    {
      "id": "e22377ef-1bbf-4288-a625-d07a97d5667d",
      "name": "Convertir binario json a archivo final",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        -2740,
        -1000
      ],
      "parameters": {
        "options": {
          "fileName": "={{ $now.format('yyyy-MM-dd_HHmmss')+\".png\" }}",
          "mimeType": "image/png"
        },
        "operation": "toBinary",
        "sourceProperty": "data[0].b64_json"
      },
      "typeVersion": 1.1
    },
    {
      "id": "5aabd61e-5407-4be7-b6c9-ab77c7cadad7",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3140,
        -780
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "height": 340,
        "content": "### 🎨 Image Generation (OpenAI)\nSends a POST request to the OpenAI `/v1/images/generations` endpoint.\n\n- Uses `gpt-image-1` model"
      },
      "typeVersion": 1
    },
    {
      "id": "93be8801-7fb4-42d7-af2d-1047b8c60d6e",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2840,
        -1200
      ],
      "parameters": {
        "color": 5,
        "width": 300,
        "height": 760,
        "content": "### 🧾 Convert base64 to File\nConverts the `b64_json` field into a binary PNG file to use in the next step.\n\n📤 Output: Final binary image\n"
      },
      "typeVersion": 1
    },
    {
      "id": "aeafd971-28ad-4c5c-8d26-0d81f82fac01",
      "name": "Nota adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3140,
        -1200
      ],
      "parameters": {
        "color": 3,
        "width": 280,
        "height": 360,
        "content": "### ✏️ Image to image generation (OpenAI)\nSends the binary image to OpenAI’s `/v1/images/edits` endpoint with a descriptive prompt.\n\n- Model: `gpt-image-1`"
      },
      "typeVersion": 1
    },
    {
      "id": "930bba79-34c4-40da-b22f-4f42b9894705",
      "name": "Al enviar formulario",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -3860,
        -840
      ],
      "webhookId": "e3e1e092-d5fb-4e15-911e-3bc98e916c9f",
      "parameters": {
        "options": {},
        "formTitle": "GPT image to image",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Promt",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "quality",
              "fieldOptions": {
                "values": [
                  {
                    "option": "low"
                  },
                  {
                    "option": "medium"
                  },
                  {
                    "option": "high"
                  }
                ]
              },
              "requiredField": true
            },
            {
              "fieldType": "file",
              "fieldLabel": "input image",
              "multipleFiles": false,
              "acceptFileTypes": ".png,.jpg,.jpeg"
            },
            {
              "fieldLabel": "input image url"
            }
          ]
        },
        "responseMode": "lastNode",
        "authentication": "basicAuth"
      },
      "credentials": {
        "httpBasicAuth": {
          "id": "EzEYGeSYuNmHnrQn",
          "name": "reels maker auth"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "abb8a008-0dcb-427c-a00a-7c850790cf4f",
      "name": "Subir imagen resultante a imgbb",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -2220,
        -640
      ],
      "parameters": {
        "url": "https://api.imgbb.com/1/upload",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "image",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            },
            {
              "name": "key",
              "value": "={{ $json.IMGBB_API_KEY }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ec0fc073-15f9-4cdf-a2f4-19de2c2b3261",
      "name": "Subir imagen resultante a Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -2440,
        -1000
      ],
      "parameters": {
        "name": "={{ $input.item.binary.data.fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultUrl": "https://drive.google.com/drive",
          "cachedResultName": "/ (Root folder)"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "vM5RNejQ9XDoP6Ld",
          "name": "Google Sheets n8n dev service account"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "7487229b-5e94-48d4-b84c-a5725e529e23",
      "name": "Enlace de archivo",
      "type": "n8n-nodes-base.set",
      "position": [
        -2020,
        -1000
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "df673a7d-7ff2-4c7e-835f-7c65e58c5ad4",
              "name": "ViewLink",
              "type": "string",
              "value": "={{ $('Upload Result Image to Google Drive').item.json.webViewLink }}"
            },
            {
              "id": "c3447718-d652-45d7-9c6f-6a1d4f29a68d",
              "name": "ContentLink",
              "type": "string",
              "value": "={{ $('Upload Result Image to Google Drive').item.json.webContentLink }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f4f2a07d-4a5e-45d9-96d6-0f5eb1359d6f",
      "name": "Obtener imagen de entrada por URL",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3360,
        -840
      ],
      "parameters": {
        "url": "={{ $json['input image url'] }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "613aa7b5-8f63-490f-9026-de4971619e41",
      "name": "CONFIGURAR CLAVE API",
      "type": "n8n-nodes-base.set",
      "position": [
        -2440,
        -640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f0df22ed-6c69-4204-8cfb-8dae51ea8fd4",
              "name": "IMGBB_API_KEY",
              "type": "string",
              "value": "IMGBB_API_KEY"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "5e276d4c-05c0-4aa2-9f3c-88669c2d259a",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2500,
        -1200
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 760,
        "content": "## Upload result file to Google Drive OR to [imgbb](https://api.imgbb.com/)"
      },
      "typeVersion": 1
    },
    {
      "id": "38760191-c39a-4a62-a222-324e5cd83590",
      "name": "Generación de imagen",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -3060,
        -620
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/images/generations",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "predefinedCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "gpt-image-1"
            },
            {
              "name": "prompt",
              "value": "={{ $json.Promt }}"
            },
            {
              "name": "n",
              "value": "={{Number(1)}}"
            },
            {
              "name": "size",
              "value": "1024x1024"
            },
            {
              "name": "moderation",
              "value": "low"
            },
            {
              "name": "background",
              "value": "auto"
            },
            {
              "name": "quality",
              "value": "={{ $json.quality }}"
            }
          ]
        },
        "nodeCredentialType": "openAiApi"
      },
      "credentials": {
        "openAiApi": {
          "id": "3ff0w5x5tfolokJ7",
          "name": "OpenAi account mingles new dev user"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6abaccab-b49b-41ab-86cd-8bf562472f9d",
      "name": "Enlace de archivo1",
      "type": "n8n-nodes-base.set",
      "position": [
        -2000,
        -640
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "df673a7d-7ff2-4c7e-835f-7c65e58c5ad4",
              "name": "ViewLink",
              "type": "string",
              "value": "={{ $json.data.url }}"
            },
            {
              "id": "c3447718-d652-45d7-9c6f-6a1d4f29a68d",
              "name": "ContentLink",
              "type": "string",
              "value": "={{ $json.data.image.url }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7443a6f2-3d0c-4fef-9dbe-56948ea8c17c",
      "name": "Enviar a Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1740,
        -840
      ],
      "webhookId": "150d64ce-d278-4459-b9b9-5d0dfb3afbd1",
      "parameters": {
        "file": "={{ $json.ContentLink }}",
        "chatId": "YOUR_CHAT_ID",
        "operation": "sendPhoto",
        "additionalFields": {
          "caption": "={{ $('On form submission').item.json.Promt }}\n{{ $('On form submission').item.json.quality }}\n\n[Result]({{ $json.ViewLink }})",
          "parse_mode": "MarkdownV2"
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "ar7qqwMS6eFB8SaY",
          "name": "NyroSikAIbot"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "efe008a1-1dea-41f8-8778-1556cf0bbbea",
      "name": "Cambiar modo",
      "type": "n8n-nodes-base.switch",
      "position": [
        -3640,
        -840
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "file",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6c2e2793-96f4-4d15-af76-926d1fdcee71",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json['input image'] !== null && $json['input image url'].isNotEmpty() }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "file_url",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9d464a07-f5fe-48af-b524-6ca60479fda6",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "leftValue": "={{ $json['input image url'] !== null && $json['input image url'].isNotEmpty() }}",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "typeVersion": 3.2
    }
  ],
  "pinData": {},
  "connections": {
    "7487229b-5e94-48d4-b84c-a5725e529e23": {
      "main": [
        [
          {
            "node": "7443a6f2-3d0c-4fef-9dbe-56948ea8c17c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6abaccab-b49b-41ab-86cd-8bf562472f9d": {
      "main": [
        [
          {
            "node": "7443a6f2-3d0c-4fef-9dbe-56948ea8c17c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "efe008a1-1dea-41f8-8778-1556cf0bbbea": {
      "main": [
        [
          {
            "node": "724b14c0-6763-47f5-87a1-ed0dde7e8a9e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "f4f2a07d-4a5e-45d9-96d6-0f5eb1359d6f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "38760191-c39a-4a62-a222-324e5cd83590",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "613aa7b5-8f63-490f-9026-de4971619e41": {
      "main": [
        [
          {
            "node": "abb8a008-0dcb-427c-a00a-7c850790cf4f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "38760191-c39a-4a62-a222-324e5cd83590": {
      "main": [
        [
          {
            "node": "071f9711-3b73-411d-9962-b540f0b418c7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "930bba79-34c4-40da-b22f-4f42b9894705": {
      "main": [
        [
          {
            "node": "efe008a1-1dea-41f8-8778-1556cf0bbbea",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "724b14c0-6763-47f5-87a1-ed0dde7e8a9e": {
      "main": [
        [
          {
            "node": "e22377ef-1bbf-4288-a625-d07a97d5667d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f4f2a07d-4a5e-45d9-96d6-0f5eb1359d6f": {
      "main": [
        [
          {
            "node": "724b14c0-6763-47f5-87a1-ed0dde7e8a9e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0b66ad6f-d216-41f3-a6dc-61cf15a2044a": {
      "main": [
        [
          {
            "node": "7487229b-5e94-48d4-b84c-a5725e529e23",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "071f9711-3b73-411d-9962-b540f0b418c7": {
      "main": [
        [
          {
            "node": "613aa7b5-8f63-490f-9026-de4971619e41",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "abb8a008-0dcb-427c-a00a-7c850790cf4f": {
      "main": [
        [
          {
            "node": "6abaccab-b49b-41ab-86cd-8bf562472f9d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e22377ef-1bbf-4288-a625-d07a97d5667d": {
      "main": [
        [
          {
            "node": "ec0fc073-15f9-4cdf-a2f4-19de2c2b3261",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec0fc073-15f9-4cdf-a2f4-19de2c2b3261": {
      "main": [
        [
          {
            "node": "0b66ad6f-d216-41f3-a6dc-61cf15a2044a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Avanzado - Diseño, Inteligencia Artificial, Marketing

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Avanzado
Número de nodos18
Categoría3
Tipos de nodos8
Descripción de la dificultad

Adecuado para usuarios avanzados, flujos de trabajo complejos con 16+ nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34