{
  "name": "Generate product and marketing images using Riverflow 2.0 on Replicate",
  "nodes": [
    {
      "id": "675c3116-a387-435a-8c87-d9094e1ceac1",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        16,
        32
      ]
    },
    {
      "id": "67762d6f-c9d5-4509-aee7-b213cd272558",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        -64
      ],
      "parameters": {
        "width": 544,
        "height": 432,
        "content": "## Image Generation using Riverflow 2.0\n\n### How it works\n- **Input Form**  takes in the necessary data to be used for the image editing/prediction such the initial image, font url & text for any text"
      }
    },
    {
      "id": "2860e54e-bf3a-48f7-8074-e18c053cc38f",
      "name": "Parse inputs given from form",
      "type": "n8n-nodes-base.code",
      "position": [
        224,
        32
      ]
    },
    {
      "id": "d8c9758a-06a2-4f2a-b872-1bd81d7c5c4c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        -16
      ],
      "parameters": {
        "width": 416,
        "height": 224,
        "content": "### Receiving and handling input"
      }
    },
    {
      "id": "73e222fb-5edd-4de4-ae69-e6485364acdf",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        432
      ],
      "parameters": {
        "width": null,
        "height": 320,
        "content": "### Initial Image\n\"make the text on the shampoo bottle say *Riverflow*\"\n![](https://replicate.delivery/pbxt/OVIMHUHWeaGC1B833lZPDdnTbFpVOuixPbT9Gn4WvEPo7xrh/shampoo-bottle-left.webp)"
      }
    },
    {
      "id": "9967ec29-1ed0-481b-bb05-f82bacae1304",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        768
      ],
      "parameters": {
        "width": null,
        "height": 272,
        "content": "### Output Image\n![](https://replicate.delivery/xezq/7hxGQNvBZHbtE1LJ5gui24oQWxxS0VT05VfbByhf0ynuOuCWA/tmp6e9pxgkv.webp)"
      }
    },
    {
      "id": "571ab2a9-81d0-41b7-b67c-defba0b1ccc8",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        384
      ],
      "parameters": {
        "width": 544,
        "height": 672,
        "content": "## Examples\n"
      }
    },
    {
      "id": "04dc45a6-ffdf-4f36-afc5-419f3b1c5394",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        432
      ],
      "parameters": {
        "width": null,
        "height": 368,
        "content": "### Initial Image\n\"Create a landing page mockup for my product\"\n![](https://replicate.delivery/pbxt/OW2cwcgcKYI8R7XRYeNu3wNynKd3lxGDK9xaIMUKxQp5DoSr/Replicate%20x%20Sourceful.png)"
      }
    },
    {
      "id": "a545e4d2-52e3-429a-8a5d-1b97505e3457",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        816
      ],
      "parameters": {
        "width": null,
        "height": 224,
        "content": "### Output Image\n![](https://replicate.delivery/xezq/jO4We5vFXx1NMC7HUPEmU1JSmpK9C6zNehZ0zH0cdcgvjaDWA/tmpz9f0kmsf.webp)"
      }
    },
    {
      "id": "156d2840-d1af-4ac5-a8d9-7aa5034179bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -96
      ],
      "parameters": {
        "width": 368,
        "height": 320,
        "content": "### Sub-Flow\nRuns another work-flow which contains nodes to:\n- send POST request to Replicate \n- do a GET request to check for errors and status. \n- If no errors, the output url is returned."
      }
    },
    {
      "id": "6898f33e-69d2-46bb-ba50-61c34a78170b",
      "name": "Call 'POST + GET requests sub-workflow'",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        544,
        32
      ]
    },
    {
      "id": "b3666735-5c7f-40bb-821d-a09888eb0e31",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1360,
        32
      ]
    },
    {
      "id": "05231dae-c49c-43b4-b793-37f44513540d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        -32
      ],
      "parameters": {
        "width": 944,
        "height": 256,
        "content": "### Polling process id till all complete"
      }
    },
    {
      "id": "5036a475-94cb-4d77-8f84-6a5878915eda",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        0
      ],
      "parameters": {
        "width": 288,
        "height": 192,
        "content": "### Outputing Images"
      }
    },
    {
      "id": "fa5fe18c-5dc0-4ab2-9a2b-b65c20177270",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        256
      ],
      "parameters": {
        "width": 288,
        "height": 144,
        "content": "### Data Table\nData table used as a way to **communicate between the sub-workflows and the parent workflow** so that we can keep track of if they are complete or not."
      }
    },
    {
      "id": "4e66c4f7-00ed-450c-9a44-d2b2019930e6",
      "name": "Isolate 1 process id",
      "type": "n8n-nodes-base.code",
      "position": [
        816,
        32
      ]
    },
    {
      "id": "51940d73-65fb-43ec-85d4-59583c795941",
      "name": "Isolate 1 process id1",
      "type": "n8n-nodes-base.code",
      "position": [
        1184,
        32
      ]
    },
    {
      "id": "0ad01966-9314-449b-8517-e81de1d233dc",
      "name": "Insert empty process id",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        992,
        32
      ]
    },
    {
      "id": "7d9ab06f-d854-4ca5-882f-f90186962e2a",
      "name": "If number of processes is correct",
      "type": "n8n-nodes-base.if",
      "position": [
        1728,
        32
      ]
    },
    {
      "id": "b459d9da-7d42-4ac0-a70b-d5ee44880f96",
      "name": "Output Filtering",
      "type": "n8n-nodes-base.code",
      "position": [
        1936,
        48
      ]
    },
    {
      "id": "6562e051-4d46-4754-b69a-4eedf57b304a",
      "name": "Get how many processes done",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        1536,
        32
      ]
    },
    {
      "id": "58c78e91-3ed6-48ce-b514-ff8a0a5ce0ed",
      "name": "Get image/s",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2080,
        48
      ]
    },
    {
      "id": "580e6124-5950-4e49-b30e-f04852db4fd3",
      "name": "Return output image url",
      "type": "n8n-nodes-base.set",
      "position": [
        1280,
        592
      ]
    },
    {
      "id": "215c3bd8-c541-4a5a-8ff9-613752aeceee",
      "name": "GET Request for Riverflow Predictions",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        848,
        576
      ]
    },
    {
      "id": "2b972b30-0630-48c5-82f9-ad1c51b90809",
      "name": "Check if output is present",
      "type": "n8n-nodes-base.if",
      "position": [
        1056,
        576
      ]
    },
    {
      "id": "b67dab2e-bce1-4e3f-916a-259c1fcf51a0",
      "name": "POST request to Replicate API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        576
      ]
    },
    {
      "id": "36fae70b-0f88-457c-bc84-b21334a85f4d",
      "name": "Start",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        176,
        752
      ]
    },
    {
      "id": "9ecf34f8-09a4-4712-bedd-2b893c51ae98",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        480,
        880
      ]
    },
    {
      "id": "48db880a-d972-4565-a237-16fd627efa58",
      "name": "Code in JavaScript",
      "type": "n8n-nodes-base.code",
      "position": [
        656,
        880
      ]
    },
    {
      "id": "fd0911d7-b9c2-46cd-a9a1-2e27ea2575a7",
      "name": "Insert row",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        864,
        880
      ]
    },
    {
      "id": "ce07d74b-589f-46c5-bf3f-d1cd9e5aedb8",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        640,
        576
      ]
    },
    {
      "id": "113d7671-0501-4dfc-b327-f09acba2a1f3",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        528
      ],
      "parameters": {
        "width": 640,
        "height": 240,
        "content": "### Loop to check get request till status is no longer processing"
      }
    },
    {
      "id": "b4526246-34c4-4ea4-83c9-91c85a0705ef",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        528
      ],
      "parameters": {
        "width": 160,
        "height": 208,
        "content": "### Riverflow 2.0 call "
      }
    },
    {
      "id": "256df2c9-5ab8-42c7-90bb-b9ea53d5500a",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        816
      ],
      "parameters": {
        "width": 320,
        "height": 224,
        "content": "### Gather parameters needed to add to data table"
      }
    },
    {
      "id": "aae84a07-c67a-446a-9a6c-84e06432a4e9",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        816
      ],
      "parameters": {
        "width": 198,
        "height": 224,
        "content": "### Insert into data table for parent workflow"
      }
    },
    {
      "id": "b9c97657-07cd-4166-9b8c-6c5dd2cc78b1",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        464
      ],
      "parameters": {
        "width": 1312,
        "height": 592,
        "content": "## Sub-Workflow: HTTPs Requests for RIverflow 2.0 through Replicate"
      }
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Get how many processes done",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start": {
      "main": [
        [
          {
            "node": "POST request to Replicate API",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "GET Request for Riverflow Predictions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Filtering": {
      "main": [
        [
          {
            "node": "Get image/s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Insert row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Parse inputs given from form",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Isolate 1 process id": {
      "main": [
        [
          {
            "node": "Insert empty process id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Isolate 1 process id1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Insert empty process id": {
      "main": [
        [
          {
            "node": "Isolate 1 process id1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Return output image url": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Check if output is present": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Return output image url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get how many processes done": {
      "main": [
        [
          {
            "node": "If number of processes is correct",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse inputs given from form": {
      "main": [
        [
          {
            "node": "Call 'POST + GET requests sub-workflow'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST request to Replicate API": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If number of processes is correct": {
      "main": [
        [
          {
            "node": "Isolate 1 process id1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Output Filtering",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GET Request for Riverflow Predictions": {
      "main": [
        [
          {
            "node": "Check if output is present",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call 'POST + GET requests sub-workflow'": {
      "main": [
        [
          {
            "node": "Isolate 1 process id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}