Automated UniFi Controller Patching and Notification - n8n Workflow

Use this powerful n8n workflow to automatically check for new UniFi controller software releases daily, perform necessary SSH upgrades, and notify administrators via Telegram with an AI-generated summary. Perfect for DevOps.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Network Administrators: Who manage self-hosted UniFi controllers and need timely, automated updates.

  • DevOps Professionals: Seeking reliable, scheduled maintenance n8n templates for remote server management.

  • Users of n8n: Looking for advanced examples of combining scheduled automation, SSH scripting, and AI summarization in a single n8n workflow.

  • Automation Engineers: Needing a specialized n8n node combination to handle remote server interaction and conditional logic.

Overview

Managing network infrastructure requires constant vigilance, especially regarding security patches and software updates. This sophisticated n8n workflow eliminates manual intervention by automating the entire update lifecycle for a self-hosted UniFi controller.

It leverages a scheduled n8n trigger to periodically inspect the official UniFi Debian repository. If a recent update is detected (within the last 24 hours), the n8n workflow securely connects via SSH to the controller host. It executes the necessary apt-get update and apt-get upgrade commands. Furthermore, it utilizes the power of an OpenAI n8n node to generate a concise summary of the update and its results, delivering the final status directly to an administrator via Telegram. This level of automation showcases the strength and flexibility of the n8n platform, making it one of the most practical n8n templates available for remote system administration.

How it Works

The entire process is initiated by a scheduled n8n trigger, set to run daily at 13:
13.


  1. Release Check: The Schedule Trigger activates the HTTP Request n8n node, which fetches the InRelease manifest file from the stable UniFi Debian repository.

  2. Date Extraction & Comparison: A Code n8n node analyzes the manifest. It extracts the release date and calculates if the repository has changed within the last 24 hours. This conditional logic prevents unnecessary upgrades.

  3. Conditional Execution: The If n8n node checks the output. If changedInLast24h is true, the n8n workflow proceeds down the 'True' path.

  4. Secure Upgrade via SSH: Two consecutive SSH n8n nodes are executed: first, to update the local package lists (apt-get update), and second, to perform the actual UniFi package upgrade (apt-get upgrade -y unifi). Private key authentication ensures security.

  5. AI Summarization: An OpenAI n8n node (Langchain) receives the results, including the exit codes and standard output from the SSH commands, along with the extracted codename and release date. It uses GPT to generate a user-friendly summary of the performed update.

  6. Notification: Finally, the Telegram n8n node sends the comprehensive, AI-generated summary, confirming the successful deployment of this critical n8n workflow.

Installation Guide

To deploy this specialized n8n workflow, follow these steps:


  1. Import the n8n template: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Configure Credentials:

SSH Credentials: Set up SSH credentials (Private Key authentication is used) to allow the n8n node to connect to your UniFi controller host with root or sudo access.
OpenAI Credentials: Ensure your OpenAI API key is configured for the Message a model n8n node.
* Telegram Credentials: Set up the required Telegram API credentials.

  1. Environment Variables: You must define the environment variable TELEGRAMCHATID in your n8n environment configuration. This is used by the Notify via Telegram n8n node.

  2. Activate the n8n Trigger: Set the Schedule Trigger n8n node to 'Active' to ensure the workflow runs automatically at the configured time (13:13 daily).

  3. Review SSH Commands: Verify that the apt-get commands used in the SSH n8n nodes are correct for your specific Debian/Ubuntu environment.

Node Details

This n8n workflow relies on several powerful n8n nodes for complex task execution:

Schedule Trigger (n8n trigger): The starting point of this n8n workflow, set to run once daily to check for updates.
HTTP Request (n8n node): Fetches the critical release information from the UniFi repository URL (https://dl.ui.com/unifi/debian/dists/stable/InRelease).
Code (n8n node): Extract Codename + Date + Time Comparison. This custom JavaScript n8n node parses the text output to extract the release date and determines if the changes occurred within the last 24 hours, feeding the logic into the If node.
If (n8n node): If: Changed within 24h?. Provides conditional flow control, ensuring the SSH upgrade only runs when necessary.
SSH (n8n node): Used twice, first for apt-get update and second for apt-get upgrade -y unifi. It uses private key authentication for secure, remote execution, central to this n8n template.
OpenAI (n8n node): Message a model. Uses Langchain capabilities to generate a concise, intelligible summary report from the raw technical output of the preceding SSH n8n nodes.


  • Telegram (n8n node): Notify via Telegram. The final action, delivering the AI-summarized status report to the user, complete with a link to the UniFi web interface.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

Featured*