{
  "name": "AI Social Media Post Creator",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * 1-5"
            }
          ]
        }
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000001",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "your-content-calendar-sheet-id"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "ContentCalendar"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Status",
              "lookupValue": "Pending"
            }
          ]
        },
        "options": {
          "range": "A:F"
        }
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000002",
      "name": "Read Content Calendar",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.2,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "resource": "chat",
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "content": "Create social media posts for the following topic. Generate platform-specific versions:\n1. Twitter (max 280 chars, include 2-3 hashtags)\n2. LinkedIn (professional tone, 150-300 words, include call-to-action)\n\nTopic: {{ $json.Topic }}\nKey points: {{ $json.KeyPoints }}\nTarget audience: {{ $json.Audience }}\n\nReturn JSON with keys: twitterPost, linkedinPost"
            }
          ]
        },
        "options": {
          "temperature": 0.8
        }
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000003",
      "name": "OpenAI Generate Posts",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.3,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const response = JSON.parse($input.first().json.message.content);\nreturn [{\n  json: {\n    twitterPost: response.twitterPost,\n    linkedinPost: response.linkedinPost,\n    topic: $input.first().json.Topic,\n    generatedAt: new Date().toISOString()\n  }\n}];"
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000004",
      "name": "Parse Posts",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1000,
        300
      ]
    },
    {
      "parameters": {
        "text": "={{ $json.twitterPost }}",
        "additionalFields": {}
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000005",
      "name": "Post to Twitter",
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 2,
      "position": [
        1250,
        200
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.linkedin.com/v2/ugcPosts",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ author: 'urn:li:person:YOUR_PERSON_ID', lifecycleState: 'PUBLISHED', specificContent: { 'com.linkedin.ugc.ShareContent': { shareCommentary: { text: $json.linkedinPost }, shareMediaCategory: 'NONE' } }, visibility: { 'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC' } }) }}"
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000006",
      "name": "Post to LinkedIn",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1250,
        400
      ]
    },
    {
      "parameters": {
        "channel": "#social-media",
        "text": ":mega: Social posts published!\n*Topic:* {{ $json.topic }}\n*Twitter:* Posted\n*LinkedIn:* Posted\n*Time:* {{ $json.generatedAt }}",
        "otherOptions": {}
      },
      "id": "a1b2c3d4-1002-4000-8000-000000000007",
      "name": "Slack Notification",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.1,
      "position": [
        1500,
        300
      ]
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Read Content Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Content Calendar": {
      "main": [
        [
          {
            "node": "OpenAI Generate Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Generate Posts": {
      "main": [
        [
          {
            "node": "Parse Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Posts": {
      "main": [
        [
          {
            "node": "Post to Twitter",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Twitter": {
      "main": [
        [
          {
            "node": "Slack Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to LinkedIn": {
      "main": [
        [
          {
            "node": "Slack Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}