Skip to content
7.7 KB
Raw Blame
{
  "name": "Fal.ai nanobanana subworkflow",
  "nodes": [
    {
      "parameters": {
        "workflowInputs": {
          "values": [
            {
              "name": "prompt"
            },
            {
              "name": "image_base64"
            },
            {
              "name": "aspect_ratio"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "typeVersion": 1.1,
      "position": [
        -800,
        16
      ],
      "id": "5a780d4e-7b05-4c44-9fbe-54494e175c45",
      "name": "When Executed by Another Workflow"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -384,
        16
      ],
      "id": "228de5ae-5779-46ed-947e-2fa728f748eb",
      "name": "Wait for seed image",
      "webhookId": "c2af0d99-26e3-43ab-84fd-62b58465d2cd"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "COMPLETED",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "6fc5bea4-1567-474b-bfca-5394eb303217"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "COMPLETED"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "0882f634-2472-4d24-a1c3-a39f0cd94855",
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "IN_PROGRESS",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "IN_PROGRESS"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "e6c8b207-13ac-4537-8c5c-677039bc2fef",
                    "leftValue": "={{ $json.status }}",
                    "rightValue": "IN_QUEUE",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "IN_QUEUE"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        0,
        0
      ],
      "id": "ec58f2e5-d428-4311-a136-99e5723897e7",
      "name": "Seed image status"
    },
    {
      "parameters": {
        "url": "={{ $json.images[0].url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        384,
        16
      ],
      "id": "aab68f6e-7cb3-4f42-b22a-033943b79e7b",
      "name": "Download the image"
    },
    {
      "parameters": {
        "url": "={{ $('⚠️ Generate image').item.json.response_url }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        208,
        16
      ],
      "id": "dd549932-2f18-4585-9680-bf1c238a3307",
      "name": "Get the image",
      "alwaysOutputData": false,
      "retryOnFail": true,
      "credentials": {
        "httpHeaderAuth": {
          "id": "BUYuOe8V0hqLtA02",
          "name": "fal.ai"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $('⚠️ Generate image').item.json.status_url }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -192,
        16
      ],
      "id": "aa27d033-85ac-4274-807f-c65162117b13",
      "name": "⚠️ Get status of the image",
      "credentials": {
        "httpHeaderAuth": {
          "id": "BUYuOe8V0hqLtA02",
          "name": "fal.ai"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://queue.fal.run/fal-ai/nano-banana/edit",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{\n  JSON.stringify({\n    prompt: $json.prompt,\n    image_urls: [\n      $json.image_base64\n    ],\n    aspect_ratio: $json.aspect_ratio\n  }, null, 2)\n}}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -608,
        16
      ],
      "id": "015fa544-00b4-4ed4-b208-5b549786bffb",
      "name": "⚠️ Generate image",
      "credentials": {
        "httpHeaderAuth": {
          "id": "BUYuOe8V0hqLtA02",
          "name": "fal.ai"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "⚠️ Generate image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for seed image": {
      "main": [
        [
          {
            "node": "⚠️ Get status of the image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Seed image status": {
      "main": [
        [
          {
            "node": "Get the image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for seed image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for seed image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the image": {
      "main": [
        [
          {
            "node": "Download the image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚠️ Get status of the image": {
      "main": [
        [
          {
            "node": "Seed image status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚠️ Generate image": {
      "main": [
        [
          {
            "node": "Wait for seed image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7a21c335-849d-4f2e-969d-15cc1a62e21c",
  "meta": {
    "instanceId": "636db6b6ab21a21c6458e2137f340e33dc3e49f5a1c560c8d1e2372c227cf40e"
  },
  "id": "qENpKJWFtOASEV54",
  "tags": []
}