{
  "id": "Q6ZNayFnmOka43AY",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Daily Motivational Tweets",
  "tags": [],
  "nodes": [
    {
      "id": "9c7637cb-90aa-4967-9aac-9555fcf9a778",
      "name": "Parse Quotes",
      "type": "n8n-nodes-base.function",
      "position": [
        -624,
        32
      ],
      "parameters": {
        "functionCode": "// Get the raw text from LLM Chain\nlet output = items[0].json.text;\n\nif (!output) {\n  throw new Error(\"No output from LLM Chain. Check your Gemini node.\");\n}\n\n// Remove Markdown-style ```json ... ``` if present\noutput = output.replace(/```json\\s*|\\s*```/g, '').trim();\n\n// Parse the JSON array\nconst quotes = JSON.parse(output);\n\n// Return each quote as a separate item\nreturn quotes.map(q => ({\n  json: { quote: q.trim() }\n}));\n"
      },
      "typeVersion": 1
    },
    {
      "id": "45218bea-1692-4f76-a982-bc9efa1709cf",
      "name": "Remove Duplicates",
      "type": "n8n-nodes-base.function",
      "position": [
        -464,
        32
      ],
      "parameters": {
        "functionCode": "const posted = new Set(items.map(i => i.json.value));\nreturn $items(\"Parse Quotes\").filter(i => !posted.has(i.json.quote));"
      },
      "typeVersion": 1
    },
    {
      "id": "422f9f79-0070-4f55-8240-7b2edd32549f",
      "name": "Wait Between Tweets",
      "type": "n8n-nodes-base.wait",
      "position": [
        176,
        144
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "024b8525-a23e-4c37-9f1d-5409e6039e5c",
      "name": "Post Tweet",
      "type": "n8n-nodes-base.twitter",
      "position": [
        0,
        144
      ],
      "parameters": {
        "text": "={{$json.quote}} ",
        "additionalFields": {}
      },
      "credentials": {
        "twitterOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "aeeb7984-7c96-4f4c-8a94-21aabbb14a5e",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -992,
        224
      ],
      "parameters": {
        "options": {
          "topP": 0.8
        }
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1ce7c940-9316-484c-be56-28a2ebde683b",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1184,
        32
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "c26e7bf5-9076-4400-a060-4b526cd5a437",
      "name": "Generate Quotes",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -992,
        32
      ],
      "parameters": {
        "text": "Generate exactly 3 pieces of motivational content for Twitter/X.\n\nEach of the 3 outputs must be DIFFERENT in both style and length:\n\n1\ufe0f\u20e3 One very short, punchy line (under 80 characters)\n2\ufe0f\u20e3 One medium-length motivational thought (120\u2013180 characters)\n3\ufe0f\u20e3 One slightly longer reflective or action-driven message (180\u2013220 characters)\n\nRules:\n- Use simple, human language\n- Sound authentic and emotionally engaging\n- Avoid clich\u00e9s and overused phrases\n- No hashtags, no emojis\n- No quotation marks\n- No markdown\n- No lists or numbering in the output text\n- Each item must feel distinct in tone (e.g. bold, reflective, encouraging)\n\nFormat:\nReturn ONLY a valid JSON array of strings.\nNo explanations.\n",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "8cce527e-afad-4243-a157-20352355e55c",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -176,
        32
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "4546eaf9-9d09-4b39-a947-7d3117b78bc0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1776,
        -240
      ],
      "parameters": {
        "width": 480,
        "height": 688,
        "content": "## Daily Motivational Tweets (Gemini + LLM Chain)\n\nThis workflow automatically generates and posts 3 motivational quotes daily on Twitter/X using Google Gemini AI. It is ideal for content creators, solopreneurs, or anyone wanting to maintain a consistent social media presence with minimal effort.\n\n### How it works\n- Triggers daily using a schedule node.\n- Uses Gemini AI to generate 3 unique motivational quotes.\n- Parses the AI output into separate tweets.\n- Posts each quote to Twitter/X with a configurable delay (via Loop Over Items and Wait node).\n\n### Setup steps\n1. Connect your **Google Gemini API key** to the Gemini Chat Model node.\n2. Connect your **Twitter/X account** to the Post Tweet node.\n3. Adjust the **Cron node** for the first posting time and the **Wait node** for spacing between tweets.\n\n### Customization\n- Change the prompt to generate different quote styles or lengths.\n- Adjust the Loop and Wait settings for different posting intervals.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bcadfcc5-5fb3-4ab5-ad95-790247a4c3da",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 480,
        "content": "## 1. Quote Generation\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5b1af05c-68c2-40b0-96c0-91971d833ac9",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 368,
        "height": 480,
        "content": "## 2. Data Processing\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ccbb3cde-d755-4d25-9c62-fa7e95c10202",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -64
      ],
      "parameters": {
        "color": 7,
        "width": 624,
        "height": 480,
        "content": "## 3. Tweet Posting\n"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1d006651-25a0-47a7-97c3-7a468b4e8a65",
  "connections": {
    "Post Tweet": {
      "main": [
        [
          {
            "node": "Wait Between Tweets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Quotes": {
      "main": [
        [
          {
            "node": "Remove Duplicates",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Quotes": {
      "main": [
        [
          {
            "node": "Parse Quotes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Post Tweet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Generate Quotes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Duplicates": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Between Tweets": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Quotes",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}