GPT-4を使用して、自動のにLinkedInの投稿を生成し、プロフィールとグループに配信する

中級

これはAI, Marketing分野の自動化ワークフローで、14個のノードを含みます。主にIf, Code, Limit, HttpRequest, GoogleSheetsなどのノードを使用、AI技術を活用したスマート自動化を実現。 GPT-4 を使って LinkedIn の投稿を自動生成してプロフィールとグループへ配信する

前提条件
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報
  • OpenAI API Key
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "meta": {
    "instanceId": "5aaf4236c70e34e423fbdb2c7b754d19253a933bb1476d548f75848a01e473cf",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "f8952f15-2a54-4207-bf1f-ca0eea5401c2",
      "name": "制限",
      "type": "n8n-nodes-base.limit",
      "position": [
        -1880,
        120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "fc809d41-c4c5-4161-bad6-3acda9dac3f3",
      "name": "構造化出力パーサー",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1500,
        340
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"post\": {\n\t\t\t\"type\": \"string\"\n\t\t}\t\t\n\t}\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "649c6459-7a72-4192-b172-3edea35ae770",
      "name": "OpenAI チャットモデル",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1620,
        340
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f90a4f81-216b-470f-9885-bc9df8ca375e",
      "name": "Linkedin-Post-Topic",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -2320,
        120
      ],
      "parameters": {
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8/edit?usp=drivesdk",
          "cachedResultName": "Linkedin Post"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ccea615a-d960-4493-9a87-69ff1b5380c3",
      "name": "Validate-Status",
      "type": "n8n-nodes-base.if",
      "position": [
        -2100,
        120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ddab9b1e-0de2-4eb9-8d7b-b9f0846eb496",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Status }}",
              "rightValue": "Pending"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "6ee612ac-5a46-4c50-b4ca-3620578e8388",
      "name": "Linedin-Post-Creator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1660,
        120
      ],
      "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:\n\nBegin with a compelling hook related to the title\n\nInclude 3-4 paragraphs of informative content\n\nEnd with a question to encourage engagement\n\nInclude 4-6 relevant hashtags\n\nUse appropriate emojis in between\n\nImportant formatting requirements:\n\nFormat all paragraphs with proper newline characters (\\n\\n) between them\n\nEnsure the text is properly escaped for JSON\n\nDo not use double quote (\") in response or any special character\n\nDo not put asterisk\n\nKeep the overall length appropriate for LinkedIn (under 3000 characters)\n\nNow, create a LinkedIn post based on the following title:\n{{ $('Linkedin-Post-Topic').item.json['Linkedin Post Title'] }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.9
    },
    {
      "id": "dad86e35-7fdf-4ad2-999a-39d8d7827769",
      "name": "Format-Content",
      "type": "n8n-nodes-base.code",
      "position": [
        -1280,
        120
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\n\n\n\n//const postData = $('Limit').first().json.ID;\n\n// Store this value in a workflow variable that can be accessed by other nodes\n//$variables.PostId = postData;\n\n//$workflow.setContext('postContent', postData);\n\n// Also store it in a more persistent variable if needed across workflows\n//$variables.set('postData', postData);\n\n\n\n const updatedItems = items.map((item) => {\n  item.json.output.post = JSON.stringify(item.json.output.post);\n  return item;\n});\nreturn updatedItems; \n\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "46baf319-14bd-47fe-8f5b-5eda101ead3a",
      "name": "Linkedin-User-Detail",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1060,
        120
      ],
      "parameters": {
        "url": "https://api.linkedin.com/v2/userinfo",
        "options": {
          "response": {
            "response": {}
          }
        },
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {}
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "50db6b67-e0cc-4c43-accd-9f3ad8517476",
      "name": "Linkedin-post",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -840,
        120
      ],
      "parameters": {
        "url": "https://api.linkedin.com/v2/ugcPosts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"author\": \"urn:li:person:{{ $('Linkedin-User-Detail').item.json.sub }}\",\n  \"lifecycleState\": \"PUBLISHED\",\n  \"specificContent\": {\n    \"com.linkedin.ugc.ShareContent\": {\n      \"shareCommentary\": {\n        \"text\": {{ $('Format-Content').item.json.output.post }}\n      },\n      \"shareMediaCategory\": \"NONE\"\n      }\n  },\n  \"visibility\": {\n    \"com.linkedin.ugc.MemberNetworkVisibility\": \"PUBLIC\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "f798cd8c-289e-493f-9d27-36a37fe72ae8",
      "name": "Get-Group-id",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -620,
        120
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1240468053,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8/edit#gid=1240468053",
          "cachedResultName": "Groups"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8/edit?usp=drivesdk",
          "cachedResultName": "Linkedin Post"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "5YFG2MAT8opHAtTt",
          "name": "Google Sheets account 2"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "049fc19a-9c29-491a-b3a7-fe9aadee6583",
      "name": "Pick 1 by 1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -400,
        120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "bea35dda-9e97-4b02-90a9-ce6f17ba4c5a",
      "name": "Post-Linkedin-Groups",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        -180,
        160
      ],
      "parameters": {
        "url": "https://api.linkedin.com/v2/ugcPosts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"author\": \"urn:li:person:{{ $('Linkedin-User-Detail').item.json.sub }}\",\n  \"containerEntity\": \"urn:li:group:{{ $json.GroupIds }}\",\n  \"lifecycleState\": \"PUBLISHED\",\n  \"specificContent\": {\n    \"com.linkedin.ugc.ShareContent\": {\n      \"shareCommentary\": {\n        \"text\": {{ $('Format-Content').item.json.output.post }}\n      },\n      \"shareMediaCategory\": \"NONE\"\n    }\n  },\n  \"visibility\": {\n    \"com.linkedin.ugc.MemberNetworkVisibility\": \"PUBLIC\"\n  }\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "typeVersion": 4.2
    },
    {
      "id": "9887fef3-d784-446a-877d-297ad835a6ed",
      "name": "Update-Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -180,
        -40
      ],
      "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,
              "required": false,
              "displayName": "Linkedin Post Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image Path",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Image Path",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "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": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/147NIoP4NAZtmXdjciHyKdOWqpPvJ9ifoS8P6HJxikY8/edit?usp=drivesdk",
          "cachedResultName": "Linkedin Post"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "5YFG2MAT8opHAtTt",
          "name": "Google Sheets account 2"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "d2d2d0b1-666d-4cfc-8f3b-e528c1b7d33d",
      "name": "付箋",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3120,
        -360
      ],
      "parameters": {
        "width": 520,
        "height": 1480,
        "content": "LinkedIn AI Agent: Auto-Post Creator & Distributor\nAutomatically generate engaging LinkedIn posts from Google Sheets topics and publish them to your profile and multiple LinkedIn groups. Perfect for:\n✅ Content creators — scale your LinkedIn presence effortlessly\n✅ Marketers — maintain consistent professional posting\n✅ Thought leaders — amplify reach across relevant communities\n\n⚙️ What's Used\nn8n Nodes:\nGoogle Sheets Trigger → AI Agent → OpenAI Chat Model → LinkedIn API → Group Distribution\nExternal Tools:\n\nGoogle Sheets – Store post topics and group IDs\nOpenAI GPT-4 – Generate engaging LinkedIn content\nLinkedIn API – Publish to profile and groups\nCustom Formatting – Ensure proper LinkedIn formatting\n\n\n🔑 Setup – Credentials Needed\n\nGoogle Sheets OAuth2 → Access your content spreadsheet\nOpenAI API Key → For AI content generation\nLinkedIn OAuth2 → Publish posts to your profile and groups\nHTTP Request Auth → LinkedIn API authentication headers\n\n\n📊 Google Sheets Structure Required\nCreate a spreadsheet with two sheets:\nSheet 1 - Main Posts:\n\nID (unique identifier)\nLinkedIn Post Title (topic/title for AI to expand)\nStatus (Pending/Posted)\n\nSheet 2 - Groups:\n\nGroupIds (LinkedIn group IDs you want to post to)\n\nNote: You'll need to collect LinkedIn group IDs from groups you've joined and have posting permissions for.\n\n🚀 Workflow Steps\n\nMonitor Google Sheets\nTrigger watches for new \"Pending\" status posts every minute\nGenerate AI Content\nAI Agent creates engaging LinkedIn posts with:\n\nCompelling hooks\n3-4 informative paragraphs\nEngagement questions\nRelevant hashtags and emojis\n\n\nFormat for LinkedIn\nEnsures proper JSON formatting and character limits\nPublish to Profile\nPosts directly to your personal LinkedIn profile\nDistribute to Groups\nAutomatically shares to all specified LinkedIn groups\nUpdate Status\nMarks the post as \"Posted\" in Google Sheets\n\n\n📝 Content Generation Features\nAI-Powered Writing:\n\nProfessional tone and structure\nProper LinkedIn formatting with newlines\n4-6 relevant hashtags\nStrategic emoji placement\nUnder 3000 character limit\nEngagement-focused questions\n\nSmart Processing:\n\nJSON-safe formatting\nSpecial character handling\nParagraph structure optimization\n\n\n💡 Pro Tips\n\nStart with 3-5 LinkedIn groups to test posting permissions\nUse descriptive post titles in your spreadsheet for better AI generation\nMonitor group engagement rules to avoid spam flags\nSchedule posts by updating status from \"Pending\" at desired times\nKeep a backup of successful post formats for consistency"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Limit": {
      "main": [
        [
          {
            "node": "6ee612ac-5a46-4c50-b4ca-3620578e8388",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "049fc19a-9c29-491a-b3a7-fe9aadee6583": {
      "main": [
        [
          {
            "node": "9887fef3-d784-446a-877d-297ad835a6ed",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "bea35dda-9e97-4b02-90a9-ce6f17ba4c5a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f798cd8c-289e-493f-9d27-36a37fe72ae8": {
      "main": [
        [
          {
            "node": "049fc19a-9c29-491a-b3a7-fe9aadee6583",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "50db6b67-e0cc-4c43-accd-9f3ad8517476": {
      "main": [
        [
          {
            "node": "f798cd8c-289e-493f-9d27-36a37fe72ae8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dad86e35-7fdf-4ad2-999a-39d8d7827769": {
      "main": [
        [
          {
            "node": "46baf319-14bd-47fe-8f5b-5eda101ead3a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ccea615a-d960-4493-9a87-69ff1b5380c3": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "6ee612ac-5a46-4c50-b4ca-3620578e8388",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "f90a4f81-216b-470f-9885-bc9df8ca375e": {
      "main": [
        [
          {
            "node": "ccea615a-d960-4493-9a87-69ff1b5380c3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6ee612ac-5a46-4c50-b4ca-3620578e8388": {
      "main": [
        [
          {
            "node": "dad86e35-7fdf-4ad2-999a-39d8d7827769",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "46baf319-14bd-47fe-8f5b-5eda101ead3a": {
      "main": [
        [
          {
            "node": "50db6b67-e0cc-4c43-accd-9f3ad8517476",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "bea35dda-9e97-4b02-90a9-ce6f17ba4c5a": {
      "main": [
        [
          {
            "node": "049fc19a-9c29-491a-b3a7-fe9aadee6583",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "6ee612ac-5a46-4c50-b4ca-3620578e8388",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 人工知能, マーケティング

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

ワークフロー情報
難易度
中級
ノード数14
カテゴリー2
ノードタイプ11
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Yaron Been

Yaron Been

@yaron-nofluff

Building AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34