{
  "id": "CQSgQ6KFmEtKsIhU",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Post daily motivational quotes to Telegram using Gemini",
  "tags": [],
  "nodes": [
    {
      "id": "fb1fcd67-26ba-4f43-a5d0-426dad0c33a9",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -32,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 6
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "481e031b-f18e-42d0-a26a-9cb7fcf9c269",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        192,
        224
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8589412d-7e8e-4664-aab6-2235fc4135d1",
      "name": "Generate Daily Quote",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        192,
        0
      ],
      "parameters": {
        "text": "Generate one short, original motivational quote (under 25 words) and a fitting author name (can be a real famous person or a fitting fictional/anonymous attribution like \"Unknown\"). \n\nRespond ONLY in this exact format, nothing else:\nQUOTE: <the quote text>\nAUTHOR: <the author name>",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "b44e23cf-c0b8-4166-a7d4-c756c99b1694",
      "name": "Parse Quote and Author",
      "type": "n8n-nodes-base.code",
      "position": [
        560,
        0
      ],
      "parameters": {
        "jsCode": "const text = $input.first().json.output;\nconst quoteMatch = text.match(/QUOTE:\\s*(.+)/);\nconst authorMatch = text.match(/AUTHOR:\\s*(.+)/);\n\nreturn [{\n  json: {\n    quote: quoteMatch ? quoteMatch[1].trim() : \"Stay focused and keep moving forward.\",\n    author: authorMatch ? authorMatch[1].trim() : \"Unknown\"\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "aaa3e80e-dc6a-49e1-a444-4449ae6f63dc",
      "name": "Render Quote as Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        864,
        0
      ],
      "parameters": {
        "url": "https://api.htmlcsstoimg.com/api/v1/generateImage",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"html_content\": \"<div style=\\\"width:1080px;height:1080px;background:#0a0a0a;display:flex;align-items:center;justify-content:center;padding:80px;font-family:Georgia,serif;\\\"><p style=\\\"color:#fff;font-size:48px;text-align:center;line-height:1.4;\\\">\\\"{{ $json.quote }}\\\"<br><span style=\\\"font-size:28px;color:#999;\\\">\u2014 {{ $json.author }}</span></p></div>\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "CLIENT-API-KEY",
              "value": "YOUR_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.4
    },
    {
      "id": "bf0b87fc-d064-4ff1-8940-07feb29d66b0",
      "name": "Post Quote to Channel",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1248,
        0
      ],
      "parameters": {
        "file": "={{ $json.image_url }}",
        "chatId": "@your_channel_username",
        "operation": "sendPhoto",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "26e3fe3a-c02e-46ae-8463-bf351af00c1d",
      "name": "Sticky Note - Description",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        -480
      ],
      "parameters": {
        "color": 5,
        "width": 480,
        "height": 884,
        "content": "## \ud83c\udf05 Post daily motivational quote images to Telegram using Gemini and HTML to Image\n\n### Who's it for\nCommunity managers, content creators, and anyone running a Telegram channel who wants to automatically post a fresh motivational quote image every day \u2014 no manual design work required.\n\n### How it works\nOn a daily schedule, this workflow asks Google Gemini to generate a short, original motivational quote with an author attribution. The quote is parsed into clean fields, rendered into a styled image using the HTML to Image API, and posted directly to your Telegram channel as a photo.\n\n### How to set up\n1. Create a Telegram bot via @BotFather and add it as an admin to your Telegram channel with permission to post.\n2. Connect your Telegram bot token as a credential in n8n.\n3. Connect your Gemini API credential for quote generation.\n4. Sign up at htmlcsstoimg.com for a free API key, and add it as a Header Auth credential (Name: CLIENT-API-KEY, Value: your key).\n5. Set your channel's @username in the final Telegram node.\n6. Activate the workflow.\n\n### Requirements\n- A Telegram bot token and a Telegram channel (with the bot added as admin)\n- A Gemini API key (free tier available)\n- A free htmlcsstoimg.com API key\n\n### How to customize\n- Edit the HTML/CSS template to change colors, fonts, or layout\n- Adjust the Schedule Trigger to post at a different time or frequency\n- Change the quote generation prompt to target a specific theme (e.g. business, fitness, mindfulness)\n- Swap the image style for a branded template with your logo"
      },
      "typeVersion": 1
    },
    {
      "id": "95423f54-9c06-437d-b706-c44bf0ef6da2",
      "name": "Sticky Note - Schedule",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 80,
        "content": "Runs once per day at\nthe set hour."
      },
      "typeVersion": 1
    },
    {
      "id": "84a13ed9-2138-40f8-8688-8757cc1fc2eb",
      "name": "Sticky Note - Generate",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        192,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 80,
        "content": "Edit this prompt to change\nquote theme or tone."
      },
      "typeVersion": 1
    },
    {
      "id": "3cdb1126-e7ce-4a2c-8d8d-5ff703a6241e",
      "name": "Sticky Note - Parse",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        -96
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 80,
        "content": "Splits the AI output into\nclean quote + author fields."
      },
      "typeVersion": 1
    },
    {
      "id": "aded390a-893e-41c4-8c16-95491571c15a",
      "name": "Sticky Note - Render",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 140,
        "content": "Renders the quote as a\nstyled image via htmlcsstoimg.com.\nRequires CLIENT-API-KEY\nHeader Auth credential."
      },
      "typeVersion": 1
    },
    {
      "id": "ab5fad1a-1f21-439c-8803-b02b6e1be3ba",
      "name": "Sticky Note - Post",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 88,
        "content": "Posts the image to your\nTelegram channel. Set your\nchannel @username here."
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "binaryMode": "separate",
    "callerPolicy": "workflowsFromSameOwner",
    "timeSavedMode": "fixed",
    "availableInMCP": false,
    "executionOrder": "v1",
    "executionTimeout": -1
  },
  "versionId": "4289379c-48b7-4a0c-8123-155c16b8501d",
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Generate Daily Quote",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Daily Quote": {
      "main": [
        [
          {
            "node": "Parse Quote and Author",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Render Quote as Image": {
      "main": [
        [
          {
            "node": "Post Quote to Channel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Quote and Author": {
      "main": [
        [
          {
            "node": "Render Quote as Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Daily Quote",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}