{
  "id": "HzEgM7TZBf7ies0X",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Post on linkedin copy-n8n",
  "tags": [
    {
      "id": "Z7L0f1AkNk8PRVAq",
      "name": "n8n",
      "createdAt": "2025-12-11T04:51:48.351Z",
      "updatedAt": "2025-12-11T04:51:48.351Z"
    }
  ],
  "nodes": [
    {
      "id": "a6c58232-1101-4110-a656-edb45279e267",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -688,
        16
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4251c778-ef04-45e6-af25-d5061a605323",
      "name": "Get Linked Post",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ba95e214-dc5d-47df-8c6c-a7385ecf27b1",
              "name": "linkedinData",
              "type": "string",
              "value": "={{ $json.output[0].content[0].text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "06f89c5a-426b-4506-afff-2d5fb0d7cac5",
      "name": "Generate an image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        688,
        -96
      ],
      "parameters": {
        "prompt": "=Professional realistic photograph of modern AI automation and workflow systems, backend and frontend communication, cloud servers, data flow visualization, realistic office environment, clean minimal tech style, high resolution, photorealistic, LinkedIn quality, no people, no animation, no illustration, no text overlay\n\n{{ $('Get Latest Topics').item.json.items[0].title }}",
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "cf9284a8-87e5-45a2-bc17-0546cd4ab2f1",
      "name": "Set context",
      "type": "n8n-nodes-base.set",
      "position": [
        -480,
        16
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3a4f7e00-286e-4b9a-9e78-99bfab5436ca",
              "name": "role",
              "type": "string",
              "value": "Full Stack Developer & AI Automation Specialist"
            },
            {
              "id": "9913e8f0-8e7e-4cd3-9ff7-21d8befc30a5",
              "name": "core_focus",
              "type": "string",
              "value": "AI automation, n8n workflows, backend APIs, frontend systems, analytics"
            },
            {
              "id": "1adc235b-7a48-495c-b0fd-d93e5cd54a03",
              "name": "experience_level",
              "type": "string",
              "value": "Hands-on implementation for real businesses"
            },
            {
              "id": "d688a7d2-edad-40ee-b737-37195376ab86",
              "name": "audience",
              "type": "string",
              "value": "Founders, business owners, developers, product teams"
            },
            {
              "id": "91abd673-966c-4f83-95b9-aa0eb4aad7c5",
              "name": "content_rules",
              "type": "string",
              "value": "No motivation, no unrelated tech, only real-world experience"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "db990f03-e066-467b-9583-b5faa9af1a77",
      "name": "Get Latest Topics",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -272,
        16
      ],
      "parameters": {
        "url": "https://api.rss2json.com/v1/api.json?rss_url=https://medium.com/feed/tag/automation",
        "options": {}
      },
      "typeVersion": 4.3
    },
    {
      "id": "1dd1ad4c-1ba6-4dcf-a567-d1e7c95e4329",
      "name": "Relevant Insights",
      "type": "n8n-nodes-base.code",
      "position": [
        -64,
        16
      ],
      "parameters": {
        "jsCode": "const data = $input.all() || [];\nconst items = data[0].json.items;\nconst keywords = [\n  'automation',\n  'AI',\n  'workflow',\n  'backend',\n  'API',\n  'RAG',\n  'LLM',\n  'n8n'\n];\nconst relevant = items.filter(i => {\n const title = (i.title || '').toLowerCase();\n  const description = (i.description || '').toLowerCase();\n\n  return keywords.some(k =>\n    title.includes(k) || description.includes(k)\n                       );\n});\nconsole.log(relevant)\nreturn [{\n  json: {\n    latestInsight: relevant.length \n    ?\n      `${relevant[0].title}. ${relevant[0].description.substring(0, 2000)}`\n      : \"Recent trend in AI driven automation and workflow optimazition\"\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "390fde23-3290-4995-9641-e640c28b61eb",
      "name": "Generate LinkedIn Post",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        144,
        16
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=Write a LinkedIn post ONLY about:\n- AI automation\n- n8n workflows\n- backend/frontend systems\n- real business automation experience\n\nCombine:\n1. Latest industry update\n2. Practical hands-on experience\n3. Clear value for founders and developers\n\nRules:\n- No motivational content\n- No unrelated tech\n- Human, professional tone\n- 6\u201310 short lines\n- Max 3 hashtags\n- Sound like personal experience\n\nLatest update:\n\n {{ $json.latestInsight }}"
            },
            {
              "role": "system",
              "content": "You are a senior Full Stack Developer and AI Automation expert.\nYou write from real-world experience only.\n"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "fd9f86ec-79bb-4992-a3db-de25e7c1da7b",
      "name": "Check Post Result",
      "type": "n8n-nodes-base.if",
      "position": [
        784,
        448
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ffc1701d-ab38-49be-9426-1277b5fa69fb",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.urn }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a66f7682-c499-4d13-baba-9196ed84103b",
      "name": "Binary format",
      "type": "n8n-nodes-base.code",
      "position": [
        1088,
        -96
      ],
      "parameters": {
        "jsCode": "return [{\n  json:{\n    binary: $items(\"Generate an image\")[0].binary.data\n  }\n}]"
      },
      "typeVersion": 2
    },
    {
      "id": "94f4e43e-44e2-4cd6-b6ac-b89bd46d64ee",
      "name": "Check Image condition",
      "type": "n8n-nodes-base.if",
      "position": [
        1328,
        -96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "bd6606f5-0b0b-4c57-8b0f-5ce61349454c",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.binary.data }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "21c88208-c6e7-4fe5-87d8-d0927a482f3b",
      "name": "Check Generated post",
      "type": "n8n-nodes-base.if",
      "position": [
        1328,
        128
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "8753e775-6bc0-47c0-b493-b38c769f1583",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.linkedinData }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3cfa5858-99ba-42e1-ad42-a9b95ae56214",
      "name": "Merge both Results",
      "type": "n8n-nodes-base.merge",
      "position": [
        1664,
        96
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "dee98f00-70fc-4deb-9c05-5a4226001bfb",
      "name": "Convert to LinkedIn format",
      "type": "n8n-nodes-base.code",
      "position": [
        144,
        448
      ],
      "parameters": {
        "jsCode": "const imageBinary = $input.all()[0].json;\nconst linkedinPost = $input.all()[1].json;\n\nreturn {\n  json:{\n     json: {\n      post: linkedinPost.linkedinData\n    },\n    binary: {\n      image:{\n         data: imageBinary.binary.data,\n         mimeType: \"image/png\"\n      }\n     \n    }\n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "85a71c66-04e1-49b7-b9af-f0c9ee1a96de",
      "name": "Post to LinkedIn",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        448,
        448
      ],
      "parameters": {
        "text": "={{ $json.json.post }}",
        "postAs": "organization",
        "additionalFields": {},
        "binaryPropertyName": "={{ $json.binary.image }}",
        "shareMediaCategory": "IMAGE"
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1f5652f3-53d4-4243-bfa3-dfc9b545ed24",
      "name": "Send Alert Email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1056,
        368
      ],
      "parameters": {
        "text": "=Hi ,\n\nYour LinkedIn post has been published successfully.\n\nPost Summary:\n\n\u2022 Post Type: Image Post\n\u2022 Status: Live on LinkedIn\n\n\nYou can view the post here:\nhttps://www.linkedin.com/feed/update/{{ $json.urn }}\n\nThis post was published automatically via your AI-powered n8n workflow.\n\nIf you need to make any updates or schedule another post, feel free to proceed.\n\nBest regards,  \nAI Automation System",
        "options": {},
        "subject": "Linked post successfully",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "e20d6d35-2aa7-466a-a2fc-a0d936b2af2b",
      "name": "Send alert email",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1056,
        512
      ],
      "parameters": {
        "text": "Hi ,\n\nYour LinkedIn post has not published successfully.\n\nVerify your workflow and try again.\n\nIf you need to make any updates or schedule another post, feel free to proceed.\n\n",
        "options": {},
        "subject": "LinkedIn Post Status",
        "toEmail": "user@example.com",
        "fromEmail": "user@example.com",
        "emailFormat": "text"
      },
      "credentials": {
        "smtp": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "507b5e52-9118-4e57-a1fc-254197bbf6e7",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        -272
      ],
      "parameters": {
        "width": 496,
        "height": 704,
        "content": "## Overall Description\n\nThis n8n workflow fully automates the process of creating and publishing professional LinkedIn posts based on real-world experience in AI automation and workflow engineering, enriched with latest industry insights from the internet, and paired with a relevant high-quality image.\n\n## Workflow Logic (High-Level)\n\n- Trigger workflow manually\n- Define posting context (your expertise)\n- Fetch latest AI/automation trends from the web\n- Filter insights relevant to your field\n- Generate a LinkedIn-ready post using AI\n- Generate a professional image related to the post\n- Validate image and text quality\n- Merge approved text + image\n- Convert content into LinkedIn format\n- Publish post on LinkedIn\n- Send email notification on success or failure\n\n## Credentials\n\n1. OpenAI API (GPT & DALLe-3) or HuggingFace Key (Free)\n2. LinkedIn API Key\n3. SMTP ClientId"
      },
      "typeVersion": 1
    },
    {
      "id": "f00a9b0c-7059-49b6-b8fc-d7f3eb3dd1eb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        -416
      ],
      "parameters": {
        "color": 7,
        "width": 592,
        "height": 848,
        "content": "## Context and Relevant Insights\n\nSet the trigger based on your time period to post (daily, weekly or custom date)\n\nDefines your professional identity and posting scope\nSet Fields:- AI automation, n8n workflow, backend/frontend systems.\n\nGet Latest topic from medium or relevant sources.\nSearch with your parameter that defines only what matters to your field."
      },
      "typeVersion": 1
    },
    {
      "id": "1790569c-4a90-4879-8118-ef4972540960",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        160,
        -560
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 432,
        "content": "## Generate LinkedIn Post\n\nGenerate human friendly professional LinkedIn post by combining real world experience with current industry insights\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f88c92a6-292a-4edb-a766-302ac409e137",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -608
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 432,
        "content": "## Generate Image for Post\n\nCreates a professional, LinkedIn-ready image using OpenAI API that visually represents AI automation, workflows, and scalable systems.\n\nset the prompt based on your post topic.\n\nBinary format that Converts the generated image into binary format required for publishing image posts on LinkedIn.\n\nCheck Image Condition (IF Node)\n\nValidates the generated image by checking its availability, format, and readiness before posting."
      },
      "typeVersion": 1
    },
    {
      "id": "5f72f59b-ba76-4968-95ee-27aaa4bd066a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 432,
        "content": "## Merge Both Results\n\nCombines the approved LinkedIn post text and the validated image into a single item for LinkedIn posting."
      },
      "typeVersion": 1
    },
    {
      "id": "10ac4e33-4fab-4675-8f83-dd247b1aa021",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 592,
        "content": "## Convert to LinkedIn Format (Code Node)\n\nStructures the final payload by attaching the post text to JSON and preserving the image as binary for LinkedIn compatibility.\n\n\n     json: {\n      post: linkedinPost.linkedinData\n    },\n    binary: {\n      image:{\n         data: imageBinary.binary.data,\n         mimeType: \"image/png\"\n      }     \n    }\n\n\n### Post to LinkedIn\nPublishes the final image post to LinkedIn using the prepared text and image."
      },
      "typeVersion": 1
    },
    {
      "id": "35d6165f-6607-48bd-9bb3-14fb1f1c5cc8",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        656
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 592,
        "content": "## Check Post Result (IF Node)\n\nVerifies whether the LinkedIn post was successfully published\n\nSend Alert Email\n\nSends an automated email notification confirming successful posting or alerting in case of failure."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e731440e-8c5d-4692-be06-ac10b1a5db1b",
  "connections": {
    "Set context": {
      "main": [
        [
          {
            "node": "Get Latest Topics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Binary format": {
      "main": [
        [
          {
            "node": "Check Image condition",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Linked Post": {
      "main": [
        [
          {
            "node": "Check Generated post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to LinkedIn": {
      "main": [
        [
          {
            "node": "Check Post Result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send alert email": {
      "main": [
        []
      ]
    },
    "Check Post Result": {
      "main": [
        [
          {
            "node": "Send Alert Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send alert email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an image": {
      "main": [
        [
          {
            "node": "Binary format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Latest Topics": {
      "main": [
        [
          {
            "node": "Relevant Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Relevant Insights": {
      "main": [
        [
          {
            "node": "Generate LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge both Results": {
      "main": [
        [
          {
            "node": "Convert to LinkedIn format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Generated post": {
      "main": [
        [
          {
            "node": "Merge both Results",
            "type": "main",
            "index": 1
          }
        ],
        []
      ]
    },
    "Check Image condition": {
      "main": [
        [
          {
            "node": "Merge both Results",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate LinkedIn Post": {
      "main": [
        [
          {
            "node": "Get Linked Post",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to LinkedIn format": {
      "main": [
        [
          {
            "node": "Post to LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}