{
  "id": "ofGuSG7LMa4Qd3n5",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Viral Selfie Image With Celebrities",
  "tags": [],
  "nodes": [
    {
      "id": "67327651-323e-4e31-8a8f-c9fb8d12970b",
      "name": "Get status clip",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1312,
        800
      ],
      "parameters": {
        "url": "=https://api.runpod.ai/v2/nano-banana-pro-edit/status/{{ $json.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d53584f6-ab01-46f6-8793-3d89ec0cf68a",
      "name": "Completed?",
      "type": "n8n-nodes-base.if",
      "position": [
        1504,
        800
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "383d112e-2cc6-4dd4-8985-f09ce0bd1781",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "COMPLETED"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "546f631a-3d7f-44a6-b705-053315c06ff8",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        352,
        800
      ],
      "parameters": {
        "options": {},
        "formTitle": "Selfie with Celebrities",
        "formFields": {
          "values": [
            {
              "fieldName": "IMAGE_URL",
              "fieldLabel": "Your selfie",
              "requiredField": true
            },
            {
              "fieldName": "PROMPT",
              "fieldLabel": "The prompt",
              "defaultValue": "Ultra-realistic viral AI photo, based on the uploaded reference image of me. Scene set in a modern television studio with professional lighting, cinematic look. Half-body shot (medium close-up), realistic proportions. Next to me is LeBron James, standing confidently with one hand resting naturally on my shoulder, friendly and iconic presence. My facial expression is changed: confident, slightly surprised and charismatic, natural smile, expressive eyes. Both subjects are perfectly integrated with matching lighting, shadows, and depth of field. Photorealistic skin texture, sharp focus, high detail, studio camera quality, 4K resolution. Looks like an authentic behind-the-scenes TV moment, viral social media style, no distortion, no extra people, no artifacts.",
              "requiredField": true
            },
            {
              "fieldName": "FORMAT",
              "fieldType": "dropdown",
              "fieldLabel": "Aspect Ratio",
              "defaultValue": "9:16",
              "fieldOptions": {
                "values": [
                  {
                    "option": "1:1"
                  },
                  {
                    "option": "4:3"
                  },
                  {
                    "option": "9:16"
                  },
                  {
                    "option": "16:9"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "32adfa42-d4d3-4352-ba42-8b8137d4a81e",
      "name": "Upload to Postiz",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2432,
        800
      ],
      "parameters": {
        "url": "https://api.postiz.com/public/v1/upload",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "file",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "data"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dbda859c-37bd-44a8-8d39-1cf3797290c7",
      "name": "Upload to Social",
      "type": "n8n-nodes-postiz.postiz",
      "position": [
        2688,
        800
      ],
      "parameters": {
        "date": "={{ $now.format('yyyy-LL-dd') }}T{{ $now.format('HH:ii:ss') }}",
        "posts": {
          "post": [
            {
              "value": {
                "contentItem": [
                  {
                    "image": {
                      "imageItem": [
                        {
                          "id": "={{ $json.id }}",
                          "path": "={{ $json.path }}"
                        }
                      ]
                    },
                    "content": "={{ $('Merge').item.json.content.parts[0].text }}"
                  }
                ]
              },
              "integrationId": "XXX"
            }
          ]
        },
        "shortLink": true
      },
      "credentials": {
        "postizApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c1451a41-1377-4a34-a294-59544ea2a330",
      "name": "Set data",
      "type": "n8n-nodes-base.set",
      "position": [
        592,
        800
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "73ca64f8-cb9f-4ef4-a7b0-5378cffb85a2",
              "name": "image_url",
              "type": "string",
              "value": "={{ $json.IMAGE_URL }}"
            },
            {
              "id": "9505e1ad-57f3-4585-adc5-66063200c0aa",
              "name": "prompt",
              "type": "string",
              "value": "={{ $json.PROMPT }}"
            },
            {
              "id": "bb744599-c219-4638-90e6-9b203826fd61",
              "name": "aspect_ratio",
              "type": "string",
              "value": "={{ $json.FORMAT }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "bd15727f-a546-4dfc-9f1e-f6ae826b7440",
      "name": "Generate selfie",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        848,
        800
      ],
      "parameters": {
        "url": "https://api.runpod.ai/v2/nano-banana-pro-edit/run",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"input\": {\n    \"prompt\": \"{{ $json.prompt }}\",\n    \"images\": [\n      \"{{ $json.image_url }}\"\n    ],\n    \"resolution\": \"1k\",\n    \"output_format\": \"jpeg\",\n    \"enable_base64_output\": false,\n    \"enable_sync_mode\": false,\n    \"aspect_ratio\": \"{{ $json.aspect_ratio }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "d5236f81-7dda-40be-9298-f4c727bd98ba",
      "name": "Wait 20 sec.",
      "type": "n8n-nodes-base.wait",
      "position": [
        1120,
        800
      ],
      "parameters": {
        "amount": 20
      },
      "typeVersion": 1.1
    },
    {
      "id": "6d55b4eb-b9ad-45fd-b7cc-b43251fcb96f",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2208,
        800
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "9574f218-294f-44c4-b5a7-c6eb976886d6",
      "name": "Get image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1840,
        1120
      ],
      "parameters": {
        "url": "={{ $json.output.result }}",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "398fd4f2-1ec6-4e54-95a8-1060ff510d61",
      "name": "SMC Agent",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1840,
        784
      ],
      "parameters": {
        "text": "=You are a viral social media content creator and visual analyst specialized in Instagram growth.\nYour task is to **analyze the uploaded image in detail** and generate a **highly engaging, viral Instagram post**.\n\nFollow these steps strictly:\n\n1. **Analyze the image**\n\n   * Identify people, setting, emotions, body language, facial expressions, clothing, and overall mood.\n   * Detect if the image feels authentic, cinematic, casual, exclusive, or behind-the-scenes.\n   * Understand what makes the image emotionally or socially impactful.\n\n2. **Define the viral angle**\n\n   * Choose the strongest hook (status, surprise, confidence, success, inspiration, irony, exclusivity).\n   * Frame the image as a moment people would want to comment on, share, or save.\n\n3. **Write the Instagram caption**\n\n   * Start with a **strong hook in the first line** (scroll-stopping).\n   * Keep the tone natural, confident, and relatable.\n   * Use short paragraphs or line breaks for readability.\n   * Include subtle storytelling or a bold statement.\n   * End with a **call to action** (comment, tag, react, or share).\n\n4. **Add hashtags**\n\n   * Include 5\u201310 relevant hashtags.\n   * Mix broad viral hashtags with niche and contextual ones.\n   * Avoid spammy or generic hashtag overload.\n\n5. **Style guidelines**\n\n   * Do NOT mention that the image is AI-generated.\n   * Do NOT use emojis excessively (max 2\u20133).\n   * Sound human, authentic, and platform-native.\n   * Optimize for engagement and virality.\n\nOutput only:\n\n* The final Instagram caption\n* The hashtags (on a new line)\n",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "options": {},
        "resource": "image",
        "imageUrls": "={{ $json.output.result }}",
        "operation": "analyze"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "42f65603-641e-4621-a90e-759b37ce17c4",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2432,
        1120
      ],
      "parameters": {
        "name": "=image_{{ $now.format('yyyyLLddHHiiss') }}_{{$binary.data.fileName}}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1xT3rJm2PMjOTsSQFk6QP_Tt6J8z2R0x4",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1xT3rJm2PMjOTsSQFk6QP_Tt6J8z2R0x4",
          "cachedResultName": "Runpod"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "781153ff-5cea-46b6-94e9-e68a4fb077f3",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        48
      ],
      "parameters": {
        "width": 752,
        "height": 560,
        "content": "## Viral Selfie Image With Celebrities using Nano Banana Pro & upload to Instagram\n\nThis workflow automates the creation of **AI-generated viral selfie images with celebrities** using **Nano Banana Pro Edit** via [RunPod](https://get.runpod.io/n3witalia), generates engaging social media captions, and publishes the content to **Instagram** via [Postiz](https://affiliate.postiz.com/n3witalia). It starts with a form submission where the user provides an image URL, a custom prompt, and an aspect ratio. \n\n### **How it works:**\n\nThis workflow automates AI selfie generation and Instagram posting. When a user submits a form with an image URL, prompt, and aspect ratio, the data is sent to RunPod\u2019s Nano Banana Pro Edit API for AI image creation. The workflow monitors progress until the image is ready, then uses Google Gemini to craft an engaging caption and hashtags. The completed image is stored on Google Drive and published via Postiz to Instagram. Conditional logic, wait nodes, and error handling ensure smooth execution from upload to publishing.\n\n\n### **Setup steps:**\n\nConfigure required API credentials for RunPod (HTTP Bearer), Google Gemini, Postiz, and Google Drive (OAuth2). Prepare the Form Trigger node with `IMAGE_URL`, `PROMPT`, and `FORMAT` fields. Update endpoint URLs and folder IDs in relevant nodes, and replace placeholder Postiz integration IDs. Test the workflow using the provided form data, activate it, and monitor the execution log in n8n to confirm all nodes complete successfully.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "54669f7a-36c1-493a-abf5-e21d7328301d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        48
      ],
      "parameters": {
        "color": 6,
        "width": 384,
        "height": 560,
        "content": "## START\n![image](https://n3wstorage.b-cdn.net/n3witalia/result3.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "59d8aa21-bcbb-4140-8b95-d601d34f5a8c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        48
      ],
      "parameters": {
        "color": 6,
        "width": 352,
        "height": 560,
        "content": "## RESULT\n![image](https://n3wstorage.b-cdn.net/n3witalia/result_lbj.jpeg)"
      },
      "typeVersion": 1
    },
    {
      "id": "a66ce1a5-8945-45fc-9eff-88a8f16c82ff",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 320,
        "content": "## STEP 1 -  Set prompt and your selfie\nSends the image and prompt"
      },
      "typeVersion": 1
    },
    {
      "id": "56c3a895-a522-49de-a774-843dd81c18d8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 320,
        "content": "## STEP 2 - Generate image with celebrities\nAdd [RunPod API](https://get.runpod.io/n3witalia) credentials under `httpBearerAuth`"
      },
      "typeVersion": 1
    },
    {
      "id": "3e937676-e351-45c9-83d4-bc99f5890f65",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 320,
        "content": "## STEP 3 - Social Media Content Agent\nAgenerate a viral-ready Instagram caption and hashtags"
      },
      "typeVersion": 1
    },
    {
      "id": "e1b2d45a-4134-4a5f-841f-5296dc9e55c7",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2384,
        1008
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 272,
        "content": "## STEP 5 - Upload to Drive\nUpload the image to Google Drive"
      },
      "typeVersion": 1
    },
    {
      "id": "2e388c4a-f198-4946-9e58-f01bad6e3d38",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2384,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 304,
        "content": "## STEP 5 - Upload to Instagram\nCreate a FREE account on [Postiz](https://postiz.com/?ref=n3witalia) and Set Channel_ID from your Dashboard"
      },
      "typeVersion": 1
    },
    {
      "id": "f8cca55d-e183-42b9-a629-a7a6c1db89ab",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1808,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 736,
        "height": 736,
        "content": "## MY NEW YOUTUBE CHANNEL\n\ud83d\udc49 [Subscribe to my new **YouTube channel**](https://youtube.com/@n3witalia). Here I\u2019ll share videos and Shorts with practical tutorials and **FREE templates for n8n**.\n\n[![image](https://n3wstorage.b-cdn.net/n3witalia/youtube-n8n-cover.jpg)](https://youtube.com/@n3witalia)"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "d9f3df55-d674-466e-8cfe-b51d0df58354",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Upload to Postiz",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set data": {
      "main": [
        [
          {
            "node": "Generate selfie",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get image": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          },
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SMC Agent": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed?": {
      "main": [
        [
          {
            "node": "Get image",
            "type": "main",
            "index": 0
          },
          {
            "node": "SMC Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 20 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 20 sec.": {
      "main": [
        [
          {
            "node": "Get status clip",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate selfie": {
      "main": [
        [
          {
            "node": "Wait 20 sec.",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get status clip": {
      "main": [
        [
          {
            "node": "Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload to Postiz": {
      "main": [
        [
          {
            "node": "Upload to Social",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Set data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}