{
  "name": "Social Media Cross-Poster",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "cross-post",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "smcp0001-0001-4000-8000-000000000001",
      "name": "Receive Content Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "resource": "text",
        "operation": "message",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list"
        },
        "messages": {
          "values": [
            {
              "content": "Adapt the following content for two social media platforms. Return valid JSON with keys: 'twitter' (max 280 chars, punchy, with 2-3 hashtags) and 'linkedin' (max 1200 chars, professional tone, 5 hashtags, line breaks for readability).\n\nOriginal content:\n{{ $json.body.content }}\n\nTopic/Context: {{ $json.body.topic || 'general' }}"
            }
          ]
        },
        "options": {
          "temperature": 0.6,
          "responseFormat": "json_object"
        }
      },
      "id": "smcp0001-0002-4000-8000-000000000002",
      "name": "Adapt Content for Each Platform",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [460, 300]
    },
    {
      "parameters": {
        "jsCode": "const platforms = JSON.parse($input.item.json.message.content);\nreturn [{ json: { twitter_text: platforms.twitter, linkedin_text: platforms.linkedin, original_content: $('Receive Content Webhook').item.json.body.content } }];"
      },
      "id": "smcp0001-0003-4000-8000-000000000003",
      "name": "Extract Platform Versions",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [680, 300]
    },
    {
      "parameters": {
        "text": "={{ $json.twitter_text }}",
        "additionalFields": {}
      },
      "id": "smcp0001-0004-4000-8000-000000000004",
      "name": "Post to Twitter",
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 2,
      "position": [900, 200]
    },
    {
      "parameters": {
        "person": "={{ $env.LINKEDIN_PERSON_URN }}",
        "text": "={{ $('Extract Platform Versions').item.json.linkedin_text }}",
        "additionalFields": {}
      },
      "id": "smcp0001-0005-4000-8000-000000000005",
      "name": "Post to LinkedIn",
      "type": "n8n-nodes-base.linkedIn",
      "typeVersion": 1,
      "position": [900, 400]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "field1",
              "name": "status",
              "value": "published",
              "type": "string"
            },
            {
              "id": "field2",
              "name": "platforms",
              "value": "twitter, linkedin",
              "type": "string"
            },
            {
              "id": "field3",
              "name": "published_at",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "smcp0001-0006-4000-8000-000000000006",
      "name": "Confirm Publication",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [1120, 300]
    }
  ],
  "connections": {
    "Receive Content Webhook": {
      "main": [[{ "node": "Adapt Content for Each Platform", "type": "main", "index": 0 }]]
    },
    "Adapt Content for Each Platform": {
      "main": [[{ "node": "Extract Platform Versions", "type": "main", "index": 0 }]]
    },
    "Extract Platform Versions": {
      "main": [
        [{ "node": "Post to Twitter", "type": "main", "index": 0 }],
        [{ "node": "Post to LinkedIn", "type": "main", "index": 0 }]
      ]
    },
    "Post to Twitter": {
      "main": [[{ "node": "Confirm Publication", "type": "main", "index": 0 }]]
    },
    "Post to LinkedIn": {
      "main": [[{ "node": "Confirm Publication", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
