AutomationFlowsAI & RAG › Automate Unifi Controller Updates via SSH with Telegram Notifications

Automate Unifi Controller Updates via SSH with Telegram Notifications

ByDominic Spatz @dominic on n8n.io

Automate UniFi Controller updates on self-hosted instances. This workflow checks the official UniFi Debian repo for a fresh release in the last 24 hours and, if found, upgrades the package via SSH. It can also summarize changes and ping you on Telegram. Sticky notes are included…

Cron / scheduled trigger★★★★☆ complexityAI-powered11 nodesHTTP RequestSshOpenAITelegram
AI & RAG Trigger: Cron / scheduled Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #8599 — we link there as the canonical source.

This workflow follows the HTTP Request → OpenAI recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "UniFi Controller: Check & Upgrade on New Release",
  "tags": [
    {
      "name": "SSH"
    }
  ],
  "nodes": [
    {
      "id": "e3552972-d4cd-40fd-8436-39b41a0e4123",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        432,
        288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 13,
              "triggerAtMinute": 13
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "0aa8ec9d-4567-46e0-8271-8cc71c567ead",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        624,
        288
      ],
      "parameters": {
        "url": "https://dl.ui.com/unifi/debian/dists/stable/InRelease",
        "options": {},
        "responseFormat": "string"
      },
      "typeVersion": 4.2
    },
    {
      "id": "2d7e4f46-02ff-48a5-8e2d-3908fd6f04fa",
      "name": "Extract Codename + Date + Time Comparison",
      "type": "n8n-nodes-base.code",
      "position": [
        864,
        288
      ],
      "parameters": {
        "jsCode": "const inReleaseContent = $input.first().json.body || '';\n\n// Extract Codename\nconst codenameMatch = inReleaseContent.match(/^Codename:\\s*(.+)$/m);\nconst codename = codenameMatch ? codenameMatch[1].trim() : null;\n\n// Extract Date\nconst dateMatch = inReleaseContent.match(/^Date:\\s*(.+)$/m);\nconst dateString = dateMatch ? dateMatch[1].trim() : null;\n\nlet releaseTimestamp = null;\nlet changedInLast24h = false;\n\nif (dateString) {\n  const parsedDate = new Date(dateString);\n  if (!isNaN(parsedDate)) {\n    releaseTimestamp = parsedDate.getTime();\n    const now = Date.now();\n    const diffHours = (now - releaseTimestamp) / (1000 * 60 * 60);\n    changedInLast24h = diffHours <= 24;\n  }\n}\n\nreturn [{ json: { codename, releaseDate: dateString, releaseTimestamp, changedInLast24h } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d099755d-88bd-4ded-9206-3c84b0de25db",
      "name": "If: Changed within 24h?",
      "type": "n8n-nodes-base.if",
      "position": [
        1072,
        288
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "35485051-ae36-4332-9e1d-4a73be0a044a",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.changedInLast24h }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "808ecc9c-50d2-442c-ad10-913f67e1b240",
      "name": "Update package lists",
      "type": "n8n-nodes-base.ssh",
      "position": [
        432,
        512
      ],
      "parameters": {
        "cwd": "/root",
        "command": "apt-get --allow-releaseinfo-change update",
        "authentication": "privateKey"
      },
      "typeVersion": 1
    },
    {
      "id": "b1f8686a-7c72-4283-baa4-3e43fe3e4ec9",
      "name": "Upgrade UniFi",
      "type": "n8n-nodes-base.ssh",
      "position": [
        624,
        512
      ],
      "parameters": {
        "cwd": "/root",
        "command": "apt-get upgrade -y unifi",
        "authentication": "privateKey"
      },
      "typeVersion": 1
    },
    {
      "id": "1b892e4e-9f71-4537-abc1-4e135cac0f2c",
      "name": "Message a model",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        464,
        768
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-nano",
          "cachedResultName": "GPT-4.1-NANO"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=Please concisely summarize the performed UniFi update and what's new in this release.\n\nCodename: {{ $('Extract Codename + Date + Time Comparison').item.json.codename }}\nRelease date: {{ $('Extract Codename + Date + Time Comparison').item.json.releaseDate }}\n\napt-get update exit code: {{ $('Update package lists').item.json.code }}\napt-get upgrade exit code/stdout: {{ $('Upgrade UniFi').item.json.code }} / {{ $('Upgrade UniFi').item.json.stdout }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "8439a184-315b-4282-a8fd-3bce2025ee8e",
      "name": "Notify via Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        800,
        768
      ],
      "parameters": {
        "text": "=UniFi package updated:\n{{ $json.message && $json.message.content ? $json.message.content : 'Upgrade finished.' }}\n[Web interface](https://unifi.ui.com)",
        "chatId": "={{ $env.TELEGRAM_CHAT_ID }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1951d673-d0ed-4a1f-bd7d-dc1a24dd7d07",
      "name": "Sticky Note: Trigger & Check",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        240
      ],
      "parameters": {
        "color": 5,
        "width": 796,
        "height": 220,
        "content": "Trigger workflow and check if UniFi repo has updated within the last 24 hours"
      },
      "typeVersion": 1
    },
    {
      "id": "c9e311b8-b821-40ef-b014-c0a0a7552507",
      "name": "Sticky Note: Upgrade",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        480
      ],
      "parameters": {
        "color": 4,
        "width": 572,
        "height": 220,
        "content": "Issue package upgrade via SSH (controller host needs apt access and SSH key configured)"
      },
      "typeVersion": 1
    },
    {
      "id": "691981f1-b61c-4b36-af6b-8ccdc92c57df",
      "name": "Sticky Note: Notify",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        736
      ],
      "parameters": {
        "width": 572,
        "height": 220,
        "content": "Inform via Telegram about the update (optional LLM for a short summary)\nRequire env var TELEGRAM_CHAT_ID and credentials binding."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Extract Codename + Date + Time Comparison",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upgrade UniFi": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Notify via Telegram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update package lists": {
      "main": [
        [
          {
            "node": "Upgrade UniFi",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If: Changed within 24h?": {
      "main": [
        [
          {
            "node": "Update package lists",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Extract Codename + Date + Time Comparison": {
      "main": [
        [
          {
            "node": "If: Changed within 24h?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Automate UniFi Controller updates on self-hosted instances. This workflow checks the official UniFi Debian repo for a fresh release in the last 24 hours and, if found, upgrades the package via SSH. It can also summarize changes and ping you on Telegram. Sticky notes are included…

Source: https://n8n.io/workflows/8599/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

AI Institutional Stock Valuation Engine with Risk Scoring & Scenario Targets

Google Sheets, XML, HTTP Request +3
AI & RAG

Overview This is a production-grade, fully automated stock analysis system built entirely in n8n. It combines institutional-level financial analysis, dual AI model consensus, and a self-improving back

Google Sheets, XML, HTTP Request +3
AI & RAG

A professional AI equity analysis automation built on n8n that transforms structured financial data and real-time news into disciplined, risk-adjusted price targets and actionable BUY/HOLD/SELL signal

Google Sheets, OpenAI, XML +3
AI & RAG

This n8n workflow is a comprehensive crypto intelligence system that monitors multiple data sources simultaneously to identify alpha opportunities, whale movements, and emerging trends before they bec

Reddit, HTTP Request, OpenAI +1
AI & RAG

Takes a product image from Google Sheets, adds frozen effect with Gemini, generates ASMR video with Veo3, writes captions with GPT-4o, and posts to 4 platforms automatically. Schedule trigger picks fi

HTTP Request, Google Sheets, OpenAI +2