{
  "name": "Twitter Manager",
  "nodes": [
    {
      "parameters": {
        "modelName": "models/gemini-2.5-pro",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -176,
        -2608
      ],
      "id": "4271bb39-f4cb-4aaf-9648-93c631b4aefa",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "text": "={{ $json.output }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.twitter",
      "typeVersion": 2,
      "position": [
        176,
        -2832
      ],
      "id": "ed0b8b3a-3812-4710-90af-c3f3e5f43979",
      "name": "Create Tweet",
      "retryOnFail": true,
      "waitBetweenTries": 5000,
      "notesInFlow": false,
      "credentials": {
        "twitterOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        -848,
        -2624
      ],
      "id": "dcaffef8-4be0-4c1d-8671-156bce2e82bc",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "url": "={{ $('Loop Over Items').item.json.link }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.2,
      "position": [
        -48,
        -2608
      ],
      "id": "b5e38d29-d254-4ba1-bf8f-b28304ab83bd",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "url": "https://wordpress.org/news/feed/",
        "options": {}
      },
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.2,
      "position": [
        -1520,
        -2848
      ],
      "id": "fa7e1877-7713-4fbd-91db-588fe112fd4f",
      "name": "WP News Feed"
    },
    {
      "parameters": {
        "url": "https://wordpress.com/blog/feed/",
        "options": {}
      },
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.2,
      "position": [
        -1520,
        -2464
      ],
      "id": "650c5d82-d3bc-470e-aaae-3628bf589509",
      "name": "WP Blog Feed"
    },
    {
      "parameters": {
        "url": "https://developer.wordpress.org/news/feed/",
        "options": {}
      },
      "type": "n8n-nodes-base.rssFeedRead",
      "typeVersion": 1.2,
      "position": [
        -1520,
        -2656
      ],
      "id": "df27e47f-cfbf-4668-aa12-3aaa7c9e7aea",
      "name": "WP Dev Feed"
    },
    {
      "parameters": {
        "numberInputs": 3
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        -1072,
        -2640
      ],
      "id": "e41e6c79-b392-4c5f-8921-c2fc672f8e8e",
      "name": "Merge1"
    },
    {
      "parameters": {
        "dataTableId": {
          "__rl": true,
          "value": "yIUGWKl7DnOz9JEM",
          "mode": "list",
          "cachedResultName": "wp-org-shared-links",
          "cachedResultUrl": "/projects/pR65GbzAV0flw95Q/datatables/yIUGWKl7DnOz9JEM"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "link": "={{ $('Loop Over Items').item.json.link }}",
            "tweetText": "={{ $('Twitter Specialist').item.json.output }}"
          },
          "matchingColumns": [
            "link"
          ],
          "schema": [
            {
              "id": "link",
              "displayName": "link",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "tweetText",
              "displayName": "tweetText",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": false
            },
            {
              "id": "linkedinPostText",
              "displayName": "linkedinPostText",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "readOnly": false,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        400,
        -2832
      ],
      "id": "4a74b3dd-60aa-43d4-8d59-fe85a86c8639",
      "name": "Record tweet"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "884de1a6-4f9d-42ba-8332-82b9a21dad44",
              "leftValue": "={{ $json.link }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -400,
        -2832
      ],
      "id": "c5aedc5a-dc49-4a37-939d-609ddf79df3c",
      "name": "If already tweeted"
    },
    {
      "parameters": {
        "operation": "rowNotExists",
        "dataTableId": {
          "__rl": true,
          "value": "yIUGWKl7DnOz9JEM",
          "mode": "list",
          "cachedResultName": "wp-org-shared-links",
          "cachedResultUrl": "/projects/pR65GbzAV0flw95Q/datatables/yIUGWKl7DnOz9JEM"
        },
        "matchType": "allConditions",
        "filters": {
          "conditions": [
            {
              "keyName": "link",
              "keyValue": "={{ $json.link }}"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.dataTable",
      "typeVersion": 1,
      "position": [
        -624,
        -2832
      ],
      "id": "4e616557-b4b9-41ee-9f00-8c19dc437275",
      "name": "Check database",
      "alwaysOutputData": true,
      "notesInFlow": false,
      "retryOnFail": false,
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Generate a tweet using the prompt above based on the following news data:\n\n**News title:** {{ $('Loop Over Items').item.json.title }}\n**Content excerpt:** {{ $('Loop Over Items').item.json['content:encoded'] }}\n**News URL:** {{ $('Loop Over Items').item.json.link }}\n",
        "options": {
          "systemMessage": "=## WordPress + WooCommerce Developer Tweet Generator (Humanized Pro Version)\n\n### Role\nYou are a **WordPress/WooCommerce developer and community contributor** who posts insightful, authentic tweets that resonate with other developers, store owners, and builders. Your tweets sound natural, informed, and human \u2014 never corporate or robotic.\n\n### Objective\nGenerate exactly **1 tweet** reacting to or commenting on the provided WordPress or WooCommerce news article.  \nThe tweet should capture personal insight or reaction, deliver developer value, and invite real conversation \u2014 all within the **280-character limit**.\n\n### Voice & Style Rules\n\n- **Sound Human, Not Scripted:** Write like a real dev sharing thoughts with peers, using expressive phrasing \u2014 e.g. \u201cFinally!\u201d, \u201cThis one\u2019s huge for us devs\u201d, \u201cCurious how this\u2019ll play out\u201d, \u201cLove this direction\u201d.\n- **Add Perspective:** Offer a quick insight, skepticism, or excitement \u2014 something that shows you\u2019re paying attention. (\u201cThis could make custom checkout flows much simpler \ud83d\udc4f\u201d).\n- **Contextual Emotion:** If it\u2019s a big feature or security release, show emotion or urgency naturally \u2014 don\u2019t overdo exclamation marks.\n- **Micro-Stories or Use Cases:** When possible, connect news to practice. (\u201cBeen waiting for a reliable scaling guide since we hit 500+ orders/hour.\u201d).\n- **Authentic Engagement:** Ask organic questions \u2014 \u201cAnyone tested this yet?\u201d, \u201cCould this replace your current flow?\u201d, \u201cWould love to see use cases.\u201d\n- **Hashtags:** Use a max of **two highly relevant** ones (#WordPress, #WooCommerce, #WebDev, #eCommerce, #AI, #Security). Skip hashtags if they sound forced.\n- **No Repetitive CTAs:** Avoid \u201cFollow for more tips\u201d, \u201cShare your thoughts\u201d, and similar templates.\n\n### WooCommerce-Specific Guidelines\nWhen the input source is WooCommerce-related:\n- Focus on **store impact**, dev workflow improvement, or client benefits \u2014 performance gains, checkout UX, conversion boosts, or extension updates.\n- Mention real-world developer thoughts: \u201cMakes managing high-VAT stores so much easier\u201d, \u201cFinally better API docs for payments!\u201d.\n- If relevant, nod to WooCommerce merchants \u2014 \u201cThis one\u2019s a quiet win for shop owners.\u201d\n\n### WordPress-Specific Guidelines\nWhen the input is WordPress-related:\n- Highlight **core progress**, ecosystem growth, or interesting developments (AI, FSE, performance, or contributors).\n- Reference community context \u2014 \u201cLoved seeing this discussed at WCUS.\u201d\n- Blend developer benefits with appreciation for open source and collaboration.\n\n### Critical Character Limit Rule\n\u26a0\ufe0f **MANDATORY:** The full tweet (text + hashtags + URL) **must be 280 characters or fewer**.\n\n- URLs count as **23 characters**.\n- Include all spaces, punctuation, emojis, and hashtags in the count.\n- If longer than 280 characters, rewrite concisely while keeping tone and authenticity.\n- Never exceed 280 characters.\n\n### Output Format\n[Tweet text with hashtags \u2014 maximum 280 characters total including the news URL]\n\n---\n\n**Goal:**  \nProduce tweets that sound spontaneous and personal \u2014 reflecting how Ahmad Wael would naturally comment as a developer, not as a marketer. Each post should blend insight, relevance, and personality while staying concise and precise.\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        -176,
        -2832
      ],
      "id": "ab1becc8-e9b5-48ad-8480-f4f68abe9393",
      "name": "Twitter Specialist"
    },
    {
      "parameters": {
        "maxItems": 2
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        -1296,
        -2848
      ],
      "id": "dc5d095b-35d6-45b3-ba19-bb67939fdd35",
      "name": "Limit to 2 items1"
    },
    {
      "parameters": {
        "maxItems": 2
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        -1296,
        -2656
      ],
      "id": "863389f1-bbe8-41c9-8759-d23cb70b96e5",
      "name": "Limit to 2 items2"
    },
    {
      "parameters": {
        "maxItems": 2
      },
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        -1296,
        -2464
      ],
      "id": "3e09d76e-ef34-4507-a90e-10d60853c0b1",
      "name": "Limit to 2 items3"
    },
    {
      "parameters": {
        "amount": 45,
        "unit": "minutes"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        624,
        -2704
      ],
      "id": "556a2638-046e-4b84-a5d0-f91e7b86c8e2",
      "name": "Wait 45 minutes"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 18
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -1744,
        -2576
      ],
      "id": "037693d8-d327-4051-8ef5-594d5a661849",
      "name": "Twitter Schedule"
    }
  ],
  "connections": {
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Twitter Specialist",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Check database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Tweet": {
      "main": [
        [
          {
            "node": "Record tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "ai_tool": [
        [
          {
            "node": "Twitter Specialist",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "WP News Feed": {
      "main": [
        [
          {
            "node": "Limit to 2 items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WP Blog Feed": {
      "main": [
        [
          {
            "node": "Limit to 2 items3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "WP Dev Feed": {
      "main": [
        [
          {
            "node": "Limit to 2 items2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge1": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Record tweet": {
      "main": [
        [
          {
            "node": "Wait 45 minutes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If already tweeted": {
      "main": [
        [
          {
            "node": "Twitter Specialist",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check database": {
      "main": [
        [
          {
            "node": "If already tweeted",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Twitter Specialist": {
      "main": [
        [
          {
            "node": "Create Tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit to 2 items1": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit to 2 items2": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Limit to 2 items3": {
      "main": [
        [
          {
            "node": "Merge1",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Wait 45 minutes": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Twitter Schedule": {
      "main": [
        [
          {
            "node": "WP News Feed",
            "type": "main",
            "index": 0
          },
          {
            "node": "WP Dev Feed",
            "type": "main",
            "index": 0
          },
          {
            "node": "WP Blog Feed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "timezone": "Africa/Cairo",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "timeSavedPerExecution": 10
  },
  "versionId": "01cb0ec5-3a9b-4f61-a3e5-320e31a9256f",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "3GrhkZ3xkmtEECRh",
  "tags": []
}