{
  "name": "Publish Java Short Video",
  "nodes": [
    {
      "parameters": {},
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "url": "https://www.googleapis.com/upload/youtube/v3/videos?part=snippet,status",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "snippet.title",
              "value": "={{ $json.title }}"
            },
            {
              "name": "snippet.description",
              "value": "={{ $json.description }}"
            },
            {
              "name": "snippet.tags",
              "value": "={{ $json.hashtags }}"
            },
            {
              "name": "status.privacyStatus",
              "value": "public"
            }
          ]
        }
      },
      "name": "YouTube Shorts",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        500,
        200
      ]
    },
    {
      "parameters": {
        "url": "https://api.linkedin.com/v2/ugcPosts",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "author",
              "value": "={{ $json.authorUrn }}"
            },
            {
              "name": "lifecycleState",
              "value": "PUBLISHED"
            },
            {
              "name": "specificContent.shareContent.media[0].status",
              "value": "READY"
            },
            {
              "name": "specificContent.shareContent.media[0].media",
              "value": "={{ $json.video_url }}"
            },
            {
              "name": "specificContent.shareContent.shareCommentary.text",
              "value": "={{ $json.title + '\\n\\n' + $json.description }}"
            },
            {
              "name": "visibility.com.companyLinkedInPage",
              "value": "PUBLIC"
            }
          ]
        }
      },
      "name": "LinkedIn",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        500,
        500
      ]
    },
    {
      "parameters": {
        "url": "https://api.twitter.com/2/tweets",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "={{ $json.title + '\\n\\n' + $json.description }}"
            },
            {
              "name": "media.media_ids[0]",
              "value": "={{ $json.media_id }}"
            }
          ]
        }
      },
      "name": "X/Twitter",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        500,
        800
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.platform }}",
              "value2": "youtube"
            }
          ]
        }
      },
      "name": "Route: YouTube",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        400,
        200
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.platform }}",
              "value2": "linkedin"
            }
          ]
        }
      },
      "name": "Route: LinkedIn",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        400,
        500
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.platform }}",
              "value2": "twitter"
            }
          ]
        }
      },
      "name": "Route: X/Twitter",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        400,
        800
      ]
    },
    {
      "parameters": {
        "text": "\u2705 Published!\\nYouTube: {{ $node['YouTube Shorts'].json.id }}\\nLinkedIn: {{ $node['LinkedIn'].json.id }}\\nX: {{ $node['X/Twitter'].json.data.id }}"
      },
      "name": "Log Result",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        750,
        500
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Route: YouTube",
            "type": "main"
          }
        ]
      ]
    },
    "Route: YouTube": {
      "main": [
        [
          {
            "node": "YouTube Shorts",
            "type": "main"
          }
        ],
        [
          {
            "node": "Route: LinkedIn",
            "type": "main"
          }
        ]
      ]
    },
    "Route: LinkedIn": {
      "main": [
        [
          {
            "node": "LinkedIn",
            "type": "main"
          }
        ],
        [
          {
            "node": "Route: X/Twitter",
            "type": "main"
          }
        ]
      ]
    },
    "YouTube Shorts": {
      "main": [
        [
          {
            "node": "Log Result",
            "type": "main"
          }
        ]
      ]
    },
    "LinkedIn": {
      "main": [
        [
          {
            "node": "Log Result",
            "type": "main"
          }
        ]
      ]
    },
    "X/Twitter": {
      "main": [
        [
          {
            "node": "Log Result",
            "type": "main"
          }
        ]
      ]
    }
  }
}