{
  "name": "News Post to Twitter (Image)",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [{}]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [600, 140],
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "url": "https://www.theguardian.com/sitemaps/news.xml"
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [800, 140],
      "name": "Fetch News XML"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.xml",
      "typeVersion": 1,
      "position": [1000, 140],
      "name": "Parse XML"
    },
    {
      "parameters": {
        "mode": "raw",
        "jsonOutput": "={\n  \"title\": \"{{ $json.urlset.url[0]['news:news']['news:title'] }}\"\n}"
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [1200, 140],
      "name": "Extract Title"
    },
    {
      "parameters": {
        "resource": "imageGeneration",
        "operation": "htmlToImage",
        "image_html_content": "=<!DOCTYPE html>\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<link href=\"https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800;900&display=swap\" rel=\"stylesheet\">\n<style>\n* { margin:0; padding:0; box-sizing:border-box; font-family:'Inter', sans-serif; }\nhtml, body { width:1080px; height:1350px; }\n.container {\n  width:1080px; height:1350px;\n  background: linear-gradient(135deg,#020617,#0f172a);\n  color:white; display:flex; flex-direction:column;\n  justify-content:space-between; padding:80px;\n}\n.title { font-size:72px; font-weight:900; line-height:1.1; }\n.brand { font-size:28px; color:#38bdf8; font-weight:800; }\n.footer { font-size:20px; color:#94a3b8; }\n</style>\n</head>\n<body>\n<div class=\"container\">\n  <div class=\"brand\">GreatestNews</div>\n  <div class=\"title\">{{ $json.title }}</div>\n  <div class=\"footer\">Follow for updates</div>\n</div>\n</body>\n</html>",
        "image_output_format": "file",
        "image_width": 1080,
        "image_height": 1350
      },
      "type": "n8n-nodes-pdf-api-hub.pdfSplitMerge",
      "typeVersion": 1,
      "position": [1400, 140],
      "name": "Generate Image",
      "credentials": {
        "pdfapihubApi": {
          "name": "YOUR_PDF_API_CREDENTIAL"
        }
      }
    },
    {
      "parameters": {
        "text": "={{ $json.title }}"
      },
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 2,
      "position": [1600, 140],
      "name": "Post Tweet",
      "credentials": {
        "twitterOAuth2Api": {
          "name": "YOUR_TWITTER_CREDENTIAL"
        }
      }
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [[{ "node": "Fetch News XML", "type": "main", "index": 0 }]]
    },
    "Fetch News XML": {
      "main": [[{ "node": "Parse XML", "type": "main", "index": 0 }]]
    },
    "Parse XML": {
      "main": [[{ "node": "Extract Title", "type": "main", "index": 0 }]]
    },
    "Extract Title": {
      "main": [[{ "node": "Generate Image", "type": "main", "index": 0 }]]
    },
    "Generate Image": {
      "main": [[{ "node": "Post Tweet", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  }
}