{
  "name": "WordPress to Social Media Auto-Post",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "social-post",
        "responseMode": "responseNode",
        "options": {}
      },
      "name": "Webhook - New Post",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{$json[\"auto_post_social\"]}}",
              "value2": true
            }
          ]
        }
      },
      "name": "Check Auto-Post Enabled",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "operation": "create",
        "text": "=New blog post: {{$json[\"post_title\"]}}\n\nRead more: https://your-nextjs-site.com/blog/{{$json[\"post_name\"]}}",
        "additionalFields": {}
      },
      "name": "Post to Twitter/X",
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 1,
      "position": [
        650,
        200
      ],
      "credentials": {
        "twitterOAuth1Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "resource": "post",
        "operation": "create",
        "pageId": "YOUR_FACEBOOK_PAGE_ID",
        "message": "=New blog post: {{$json[\"post_title\"]}}\n\n{{$json[\"excerpt\"]}}\n\nRead more: https://your-nextjs-site.com/blog/{{$json[\"post_name\"]}}",
        "additionalFields": {
          "link": "=https://your-nextjs-site.com/blog/{{$json[\"post_name\"]}}"
        }
      },
      "name": "Post to Facebook",
      "type": "n8n-nodes-base.facebook",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "credentials": {
        "facebookGraphApi": "<your credential>"
      }
    },
    {
      "parameters": {
        "url": "https://api.linkedin.com/v2/shares",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "linkedInOAuth2Api",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "jsonParameters": true,
        "bodyParametersJson": "={\n  \"content\": {\n    \"contentEntities\": [\n      {\n        \"entityLocation\": \"https://your-nextjs-site.com/blog/{{$json[\"post_name\"]}}\"\n      }\n    ],\n    \"title\": \"{{$json[\"post_title\"]}}\"\n  },\n  \"distribution\": {\n    \"linkedInDistributionTarget\": {}\n  },\n  \"text\": {\n    \"text\": \"{{$json[\"excerpt\"]}}\"\n  }\n}",
        "options": {}
      },
      "name": "Post to LinkedIn",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        400
      ],
      "credentials": {
        "linkedInOAuth2Api": "<your credential>"
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={\"success\": true, \"message\": \"Posted to social media\"}",
        "options": {}
      },
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        850,
        300
      ]
    }
  ],
  "connections": {
    "Webhook - New Post": {
      "main": [
        [
          {
            "node": "Check Auto-Post Enabled",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Auto-Post Enabled": {
      "main": [
        [
          {
            "node": "Post to Twitter/X",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to Facebook",
            "type": "main",
            "index": 0
          },
          {
            "node": "Post to LinkedIn",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Twitter/X": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to Facebook": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to LinkedIn": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}