{
  "nodes": [
    {
      "id": "8f6d83d3-4eb2-4331-b1d7-54b083c91221",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 640,
        "content": "## Muhammad Farooq Iqbal - Automation Expert & n8n Creator\n\nI am a passionate automation expert and recognized n8n Creator specializing in intelligent workflow automation. With extensive experience in n8n, AI automation, Zapier, and Make.com, I have created innovative workflow templates with 500+ downloads across the global automation community\n\n### Expertise\n- **Workflow Automation**: n8n, Zapier, Make.com, AI automation\n- **AI Integration**: Gemini AI, API integration, data processing\n- **Platform Mastery**: Google Sheets, Google Drive, custom scripts\n\n## Need Help with This Workflow?\n\nIf you face any issues with this workflow or need customization support, feel free to reach out:\n\n**\ud83d\udce7 Email**: mfarooqiqbal143@gmail.com  \n**\ud83d\udcf1 Phone**: +923036991118  \n**\ud83d\udcbc LinkedIn**: [Connect with me](https://linkedin.com/in/muhammadfarooqiqbal)  \n**\ud83c\udf10 Portfolio**: [View my work](https://mfarooqone.github.io/n8n/)\n\n*I'm always excited to help with automation challenges and workflow optimization!*\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bdecaa10-9a1e-40ba-bd58-82bd9e7df108",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -240,
        -112
      ],
      "parameters": {
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 538465532,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit#gid=538465532",
          "cachedResultName": "Posts"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit?usp=drivesdk",
          "cachedResultName": "Linkedin Post"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "aa796cf1-ee54-4a34-adf7-4094bfb148ef",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -48,
        -112
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bc74b0c2-aa46-4bcd-91f3-1eb6b0720167",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Status }}",
              "rightValue": "pending"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "56d0954f-146e-4066-a5d7-114f5357629d",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        192,
        -128
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "8e8d4211-4ad2-4cb3-8e7c-c50b0021cb93",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -272,
        80
      ],
      "parameters": {
        "text": "=You are a LinkedIn post writer. You will be given a title and your task is to create an engaging LinkedIn post based on that title.\n\nYour post should:\n1. Begin with a compelling hook related to the title\n2. Include 3-4 paragraphs of informative content\n3. End with a question to encourage engagement\n4. Include 4-6 relevant hashtags\n5. Use appropiate emojis in between \n\nImportant formatting requirements:\n- Format all paragraphs with proper newline characters (\\n\\n) between them\n- Ensure the text is properly escaped for JSON\n- Do not use double quote (\"\") in response or any special character\n- Do not put asterisk\n- Keep the overall length appropriate for LinkedIn (under 3000 characters)\n\n\nNow, create a LinkedIn post based on the following title:\n{{ $json['LinkedIn Post Title'] }}\n\nRespond only with a JSON object in exactly this format:\n{\n  \"title\": \"{{ $json['LinkedIn Post Title'] }}\",\n  \"post\": \"<your LinkedIn post here>\"\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "a7a0a36f-63e6-4049-98dc-11e9fa8957ff",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        80,
        80
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst updatedItems = items.map((item) => {\n  if (\n    item.json &&\n    item.json.output &&\n    typeof item.json.output.post === \"string\"\n  ) {\n    item.json.output.post = item.json.output.post.replace(/\\n/g, \"\\\\n\");\n  }\n  return item;\n});\nreturn updatedItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "b330ab12-c413-4a90-9084-3b128464b9c0",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        528
      ],
      "parameters": {
        "url": "https://api.linkedin.com/v2/userinfo",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6018a559-73ef-4535-8034-cfb9d4fe9271",
      "name": "Register Image Upload",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -128,
        528
      ],
      "parameters": {
        "url": "https://api.linkedin.com/v2/assets?action=registerUpload",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"registerUploadRequest\": {\n        \"recipes\": [\n            \"urn:li:digitalmediaRecipe:feedshare-image\"\n        ],\n        \"owner\": \"urn:li:person:{{ $('HTTP Request').item.json.sub }}\",\n        \"serviceRelationships\": [\n            {\n                \"relationshipType\": \"OWNER\",\n                \"identifier\": \"urn:li:userGeneratedContent\"\n            }\n        ]\n    }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "321d3cde-0d14-4de7-8c68-e9f6540e9a3e",
      "name": "Upload Image to LinkedIn",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        160,
        528
      ],
      "parameters": {
        "url": "={{$node[\"Register Image Upload\"].json.value.uploadMechanism[\"com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest\"].uploadUrl}}\n",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "={{$binary.data.mimeType || 'image/png'}}"
            }
          ]
        },
        "inputDataFieldName": "data"
      },
      "typeVersion": 4.2
    },
    {
      "id": "b4aef13c-7975-4ffd-b647-df255598d0ea",
      "name": "HTTP Request2",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        304,
        528
      ],
      "parameters": {
        "url": "https://api.linkedin.com/v2/ugcPosts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"author\": \"urn:li:person:{{ $('HTTP Request').item.json.sub }}\",\n    \"lifecycleState\": \"PUBLISHED\",\n    \"specificContent\": {\n        \"com.linkedin.ugc.ShareContent\": {\n            \"shareCommentary\": {\n                \"text\": \"{{ $('Code').item.json.output.post }}\"\n            },\n            \"shareMediaCategory\": \"IMAGE\",\n            \"media\": [\n                {\n                    \"status\": \"READY\",\n                    \"description\": {\n                        \"text\": \"{{ $('AI Agent').item.json.output.title }}\"\n                    },\n                    \"media\": \"{{ $('Register Image Upload').item.json.value.asset }}\",\n                    \"title\": {\n                        \"text\": \"{{ $('AI Agent').item.json.output.title }}\"\n                    }\n                }\n            ]\n        }\n    },\n    \"visibility\": {\n        \"com.linkedin.ugc.MemberNetworkVisibility\": \"PUBLIC\"\n    }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dc3dc05f-0413-45c6-8ef5-b7492574f120",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -128,
        288
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": { \"type\": \"string\" },\n    \"post\":  { \"type\": \"string\" }\n  },\n  \"required\": [\"title\",\"post\"],\n  \"additionalProperties\": false\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a4ef3985-f1df-4332-a355-a2e24ef8f15d",
      "name": "Update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        448,
        528
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('Limit').item.json.ID }}",
            "Status": "posted"
          },
          "schema": [
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Linkedin Post Title",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Linkedin Post Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 538465532,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEgF5p_eefPrOR1hXLM/edit#gid=538465532",
          "cachedResultName": "Posts"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit?usp=drivesdk",
          "cachedResultName": "Linkedin Post"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "retryOnFail": false,
      "typeVersion": 4.5,
      "alwaysOutputData": false
    },
    {
      "id": "7e7eae07-0299-42aa-8007-756d8312e831",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -272,
        288
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "316accc7-8e09-4452-bbd0-b876e97a3640",
      "name": "Generate Image with Gemini",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        272,
        80
      ],
      "parameters": {
        "prompt": "=Create a high-quality, visually engaging image for a social media post based on the following text:\n\n\"{{ $json.output.post }}\"\n\nThe image should:\n\u2022 Depict a modern workspace with a person actively coding on a sleek MacBook laptop.\n\u2022 Surround the scene with Flutter development elements: Flutter logo-inspired shapes, Dart language motifs, mobile app UI mockups, performance graphs, and cross-platform design cues.\n\u2022 Show a bright, tech-focused environment with clean lighting and soft depth-of-field, suggesting focus and productivity.\n\u2022 Include subtle mobile development visuals such as smartphones, tablets, or floating app interface elements near the screen.\n\u2022 Use a professional, modern design aesthetic suitable for LinkedIn and Twitter audiences.\n\u2022 Apply a vibrant color palette with blues, whites, and gradients, inspired by Flutter\u2019s branding, without using any copyrighted brand images.\n\u2022 Maintain a 16:9 aspect ratio, high resolution, and balanced composition.\n\u2022 **Do not include any text, captions, or lettering in the image under any circumstances.**\n",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.0-flash-exp-image-generation",
          "cachedResultName": "models/gemini-2.0-flash-exp-image-generation"
        },
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "72da3779-6353-4f66-8114-7ba72562005b",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        32,
        320
      ],
      "parameters": {
        "name": "=linkedin_{{$now.format('YYYYMMDD_HHmmss')}}.{{$binary.data.fileExtension || 'png'}}\n",
        "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": "19Q1PPe07QoE6hNXakiQ2nNU66MH85w5f",
          "cachedResultUrl": "https://drive.google.com/drive/folders/19Q1PPe07QoE6hNXakiQ2nNU66MH85w5f",
          "cachedResultName": "linkedin images"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "c36dbc71-2d8f-49bf-979e-70222972db9c",
      "name": "Share file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        176,
        320
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "94b9008b-06fe-4e7c-a4cb-8b3d4725db49",
      "name": "Update row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        320,
        320
      ],
      "parameters": {
        "columns": {
          "value": {
            "ID": "={{ $('If').item.json.ID }}",
            "imageUrl": "={{$node[\"Upload file\"].json.webViewLink}}"
          },
          "schema": [
            {
              "id": "ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "LinkedIn Post Title",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "LinkedIn Post Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "imageUrl",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "imageUrl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 538465532,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit#gid=538465532",
          "cachedResultName": "Posts"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WhpYF60_oOtWxDlBAEQfgBiNpEgF5p_eefPrOR1hXLM/edit?usp=drivesdk",
          "cachedResultName": "Linkedin Post"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "76a809e7-5781-46be-887f-f068ea97fa44",
      "name": "Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        16,
        528
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "url",
          "value": "={{ $('Update row in sheet1').item.json.imageUrl }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Generate Image with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share file": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Share file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Register Image Upload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download file": {
      "main": [
        [
          {
            "node": "Upload Image to LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet1": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Register Image Upload": {
      "main": [
        [
          {
            "node": "Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Upload Image to LinkedIn": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image with Gemini": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}