{
  "name": "linkedin auto poster",
  "nodes": [
    {
      "parameters": {
        "authentication": "airtableTokenApi",
        "resource": "record",
        "operation": "search",
        "base": {
          "__rl": true,
          "value": "app7AE6FRh8ld0HKh",
          "mode": "list",
          "cachedResultName": "Content Generation Agent",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh"
        },
        "table": {
          "__rl": true,
          "value": "tblWXnI2jiiL1HhKD",
          "mode": "list",
          "cachedResultName": "Content",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh/tblWXnI2jiiL1HhKD"
        },
        "filterByFormula": "AND({Document Link} != '', {Editor Agent} = 'Done')",
        "returnAll": true,
        "options": {},
        "sort": {
          "property": [
            {
              "field": "Generated at",
              "direction": "desc"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        -176,
        -112
      ],
      "id": "d77df354-77a4-4cb6-bdb8-f0980b58670b",
      "name": "Search records",
      "credentials": {
        "airtableTokenApi": {
          "id": "kGC8Mmil3KChvqbU",
          "name": "Airtable"
        }
      }
    },
    {
      "parameters": {
        "preBuiltAgentsCalloutHttpRequest": "",
        "curlImport": "",
        "method": "GET",
        "url": "={{ $json['Document Link'].replace('/edit', '/export').replace(/\\?.*$/, '') + '?format=txt' }}",
        "authentication": "none",
        "provideSslCertificates": false,
        "sendQuery": false,
        "sendHeaders": false,
        "sendBody": false,
        "options": {},
        "infoMessage": ""
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        256,
        -112
      ],
      "id": "b66621f7-21ec-426c-be48-b22428fa87a1",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "maxItems": 1,
        "keep": "lastItems"
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        48,
        -112
      ],
      "id": "1a4ac200-1110-4a25-87d1-891396b0f9dc",
      "name": "Limit"
    },
    {
      "parameters": {
        "aiAgentStarterCallout": "",
        "promptType": "define",
        "text": "=Here is a document with LinkedIn posts:\n\n{{ $json.data }}\n\nExtract every post and return ONLY a JSON array like this, nothing else, no explanation:\n[\n  {\n    \"post_number\": 1,\n    \"title\": \"post title\",\n    \"week\": \"Weeks 1\",\n    \"day\": \"Tuesday\",\n    \"post_type\": \"How-To\",\n    \"content\": \"full post content here\",\n    \"remark\": \"remark text if any\",\n    \"image_url\": \"first image url only\"\n  }\n]",
        "hasOutputParser": false,
        "needsFallback": false,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        496,
        -112
      ],
      "id": "05d63ea5-f176-4990-8a18-d46812a66efc",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "notice": "",
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-5-20250929",
          "cachedResultName": "Claude Sonnet 4.5"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        208,
        80
      ],
      "id": "927b3c13-2029-408d-8058-cac0f3d264d6",
      "name": "Anthropic Chat Model",
      "credentials": {
        "anthropicApi": {
          "id": "o7p1YfpIfOMQeBnO",
          "name": "Anthropic account"
        }
      }
    },
    {
      "parameters": {
        "mode": "runOnceForAllItems",
        "language": "javaScript",
        "jsCode": "// Get the AI output text\nconst aiOutput = $input.first().json.output;\n\n// Remove markdown code blocks\nconst cleaned = aiOutput\n  .replace(/```json/g, '')\n  .replace(/```/g, '')\n  .trim();\n\n// Parse into JSON\nconst posts = JSON.parse(cleaned);\n\n// Remove remark field and return each post as separate item\nreturn posts.map(post => {\n  delete post.remark;\n  return { json: post };\n});",
        "notice": ""
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        864,
        -112
      ],
      "id": "5f986b1d-7324-4073-b215-da604a59915b",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "authentication": "airtableTokenApi",
        "resource": "record",
        "operation": "create",
        "base": {
          "__rl": true,
          "value": "app7AE6FRh8ld0HKh",
          "mode": "list",
          "cachedResultName": "Content Generation Agent",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh"
        },
        "table": {
          "__rl": true,
          "value": "tblrgOaDhIZVYvUKZ",
          "mode": "list",
          "cachedResultName": "test",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh/tblrgOaDhIZVYvUKZ"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "post_number": "={{ $json.post_number }}",
            "title": "={{ $json.title }}",
            "week": "={{ $json.week }}",
            "day": "={{ $json.day }}",
            "post_type": "={{ $json.post_type }}",
            "content": "={{ $json.content }}",
            "image_url": "={{ $json.image_url }}",
            "status": "pending"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "post_number",
              "displayName": "post_number",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "week",
              "displayName": "week",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "day",
              "displayName": "day",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "post_type",
              "displayName": "post_type",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "content",
              "displayName": "content",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "image_url",
              "displayName": "image_url",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        1136,
        -112
      ],
      "id": "8431a675-9f5d-42a9-9eaf-b4097b396e29",
      "name": "Create a record",
      "credentials": {
        "airtableTokenApi": {
          "id": "kGC8Mmil3KChvqbU",
          "name": "Airtable"
        }
      }
    },
    {
      "parameters": {
        "notice": ""
      },
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -432,
        -112
      ],
      "id": "fd15dd83-392a-4147-91f6-cc546bb2b3c7",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "notice": "",
        "rule": {
          "interval": [
            {
              "field": "days",
              "daysInterval": 1,
              "triggerAtHour": 0,
              "triggerAtMinute": 0
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        -384,
        352
      ],
      "id": "ab42c5b8-3804-42bb-a372-2e3028d44526",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "authentication": "airtableTokenApi",
        "resource": "record",
        "operation": "search",
        "base": {
          "__rl": true,
          "value": "app7AE6FRh8ld0HKh",
          "mode": "list",
          "cachedResultName": "Content Generation Agent",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh"
        },
        "table": {
          "__rl": true,
          "value": "tblrgOaDhIZVYvUKZ",
          "mode": "list",
          "cachedResultName": "test",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh/tblrgOaDhIZVYvUKZ"
        },
        "filterByFormula": "={{\"AND({status} = 'Pending', LOWER({day}) = '\" + $now.toFormat(\"cccc\").toLowerCase() + \"')\"}}",
        "returnAll": true,
        "options": {},
        "sort": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        -176,
        352
      ],
      "id": "4bc79ddc-ccff-46cd-ab54-d14ca52e4402",
      "name": "Search records1",
      "credentials": {
        "airtableTokenApi": {
          "id": "kGC8Mmil3KChvqbU",
          "name": "Airtable"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "e2fe40f0-2e12-45e4-af24-7b929e58b02b",
              "leftValue": "={{ $json.title }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": false,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        32,
        352
      ],
      "id": "31370d1f-4875-4880-b373-49ed3b9d53bb",
      "name": "If"
    },
    {
      "parameters": {
        "authentication": "airtableTokenApi",
        "resource": "record",
        "operation": "update",
        "base": {
          "__rl": true,
          "value": "app7AE6FRh8ld0HKh",
          "mode": "list",
          "cachedResultName": "Content Generation Agent",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh"
        },
        "table": {
          "__rl": true,
          "value": "tblrgOaDhIZVYvUKZ",
          "mode": "list",
          "cachedResultName": "test",
          "cachedResultUrl": "https://airtable.com/app7AE6FRh8ld0HKh/tblrgOaDhIZVYvUKZ"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "status": "Published",
            "id": "{{ $json.id }}",
            "post_number": 0
          },
          "matchingColumns": [
            "id",
            "status"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "string",
              "readOnly": true,
              "removed": false
            },
            {
              "id": "post_number",
              "displayName": "post_number",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "number",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "week",
              "displayName": "week",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "day",
              "displayName": "day",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "post_type",
              "displayName": "post_type",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "content",
              "displayName": "content",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "image_url",
              "displayName": "image_url",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "status",
              "displayName": "status",
              "required": false,
              "defaultMatch": false,
              "canBeUsedToMatch": true,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        384,
        336
      ],
      "id": "796c1cc6-f3f3-462c-96a2-83c8e38cf325",
      "name": "Update record",
      "credentials": {
        "airtableTokenApi": {
          "id": "kGC8Mmil3KChvqbU",
          "name": "Airtable"
        }
      }
    },
    {
      "parameters": {
        "errorType": "errorMessage",
        "errorMessage": "No post found for today"
      },
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        240,
        480
      ],
      "id": "13b3aaac-70d3-4165-99b6-dc33a0a4561a",
      "name": "Stop and Error"
    }
  ],
  "connections": {
    "Search records": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Create a record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Search records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Search records1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search records1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Update record",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Stop and Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update record": {
      "main": [
        []
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": [],
  "versionId": "c7ca4361-b57a-4e2b-83fd-b4a2cb467bc5"
}