{
  "workflow": {
    "id": 2925,
    "name": "Send email if server has upgradable packages",
    "views": 12227,
    "recentViews": 1,
    "totalViews": 12227,
    "createdAt": "2025-02-17T15:03:19.594Z",
    "description": "This workflow automates the routine check for upgradable packages on your Ubuntu server, ensuring you stay updated with the latest software patches and security improvements. By running a daily script, it efficiently monitors any available package upgrades and promptly notifies you via email, saving you time and enhancing your server’s security.\n\nHow It Works:\n- **Daily Monitoring**: The workflow is configured to execute a script daily that connects to your Ubuntu server and checks for any upgradable packages.\n- **Email Notification**: If any upgradable packages are detected during the check, the workflow triggers an alert mechanism that automatically sends you a notification email detailing the available updates.\n\nSet Up Steps:\n- **SSH Credentials**: Provide the SSH login credentials for your Ubuntu server. This will allow the workflow to securely connect and perform checks for software updates.\n- **SMTP Credentials**: Provide SMTP login details for your email account. These credentials are used to configure the email notifications system, enabling it to send alerts about the upgradable packages.\n\nBenefits:\n- **Timeliness**: Receive prompt updates on critical software upgrades to maintain the optimal performance and security of your server.\n- **Automation**: Reduces the need for manual checks, allowing you to focus on other critical tasks with peace of mind.\n- **Customizable**: Easily adjust the checking frequency or update the notification settings according to your preferences.",
    "workflow": {
      "nodes": [
        {
          "id": "4ca55c6e-cf2e-4239-82a9-88d0a201e761",
          "name": "List upgradable packages",
          "type": "n8n-nodes-base.ssh",
          "notes": "apt list --upgradable",
          "position": [
            -280,
            0
          ],
          "parameters": {
            "command": "apt list --upgradable"
          },
          "credentials": {
            "sshPassword": {
              "id": "credential-id",
              "name": "sshPassword Credential"
            }
          },
          "notesInFlow": true,
          "typeVersion": 1,
          "alwaysOutputData": false
        },
        {
          "id": "ae1f0a55-31aa-494b-baa6-822dc606188e",
          "name": "Send Email through SMTP",
          "type": "n8n-nodes-base.emailSend",
          "position": [
            380,
            0
          ],
          "webhookId": "8073c571-b36f-4330-a510-ca2ff2924fbf",
          "parameters": {
            "html": "=The following packages can be updated on your server:\n\n{{ $json.htmlList }}\n\nPlease login and perform upgrade.",
            "options": {},
            "subject": "Server needs updates",
            "toEmail": "user@example.com",
            "fromEmail": "user@example.com"
          },
          "credentials": {
            "smtp": {
              "id": "credential-id",
              "name": "smtp Credential"
            }
          },
          "typeVersion": 2.1
        },
        {
          "id": "e1d76671-d94c-40d5-9364-623db9319f11",
          "name": "Run workflow every day",
          "type": "n8n-nodes-base.scheduleTrigger",
          "position": [
            -540,
            0
          ],
          "parameters": {
            "rule": {
              "interval": [
                {}
              ]
            }
          },
          "typeVersion": 1.2
        },
        {
          "id": "ec4d722a-b88c-42da-971c-28ad5774596d",
          "name": "Format as HTML list",
          "type": "n8n-nodes-base.code",
          "position": [
            -60,
            0
          ],
          "parameters": {
            "jsCode": "function formatStdoutAsHtmlList(stdoutData) {\n\n    // Split the stdout into lines and map to HTML list items\n    const htmlListItems = stdoutData.split('\\n').map((line) => {\n        if (line.trim() && line !== \"Listing...\") { // Optionally skip empty lines or headers\n            return `<li>${line.trim()}</li>`;\n        }\n    }).filter(item => item); // Remove any undefined items due to empty lines or skipped headers\n\n    // Wrap the list items in a <ul> tag\n    const htmlList = `<ul>${htmlListItems.join('')}</ul>`;\n\n    // Return the formatted HTML list as part of an object\n    return { \"htmlList\": htmlList };\n}\n\nreturn formatStdoutAsHtmlList($input.first().json.stdout);"
          },
          "typeVersion": 2
        },
        {
          "id": "6f14eb02-c505-4f83-a5bb-68094e763fd9",
          "name": "Check if there are updates",
          "type": "n8n-nodes-base.if",
          "position": [
            140,
            0
          ],
          "parameters": {
            "options": {},
            "conditions": {
              "options": {
                "version": 2,
                "leftValue": "",
                "caseSensitive": true,
                "typeValidation": "strict"
              },
              "combinator": "and",
              "conditions": [
                {
                  "id": "db66d892-26fb-406c-a0ac-2e4b8a60310a",
                  "operator": {
                    "type": "string",
                    "operation": "notEquals"
                  },
                  "leftValue": "={{ $json.htmlList }}",
                  "rightValue": "<ul></ul>"
                }
              ]
            }
          },
          "typeVersion": 2.2
        },
        {
          "id": "3924c696-5b0e-4ae2-b2e2-435fed344028",
          "name": "Sticky Note",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            -740,
            -180
          ],
          "parameters": {
            "width": 300,
            "content": "## VPS upgrade notify \nThis workflow will everyday check if server has upgradable packages and inform you by email if there is."
          },
          "typeVersion": 1
        },
        {
          "id": "bb8ade2a-4ffe-4c79-91eb-55af568eb1b1",
          "name": "Sticky Note1",
          "type": "n8n-nodes-base.stickyNote",
          "position": [
            380,
            -180
          ],
          "parameters": {
            "width": 300,
            "content": "## Update email addresses\nUpdate From and To email addresses in this node to receive notifications"
          },
          "typeVersion": 1
        }
      ],
      "connections": {
        "Format as HTML list": {
          "main": [
            [
              {
                "node": "Check if there are updates",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Run workflow every day": {
          "main": [
            [
              {
                "node": "List upgradable packages",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Send Email through SMTP": {
          "main": [
            []
          ]
        },
        "List upgradable packages": {
          "main": [
            [
              {
                "node": "Format as HTML list",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Check if there are updates": {
          "main": [
            [
              {
                "node": "Send Email through SMTP",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    },
    "lastUpdatedBy": 16,
    "workflowInfo": {
      "nodeCount": 7,
      "nodeTypes": {
        "n8n-nodes-base.if": {
          "count": 1
        },
        "n8n-nodes-base.ssh": {
          "count": 1
        },
        "n8n-nodes-base.code": {
          "count": 1
        },
        "n8n-nodes-base.emailSend": {
          "count": 1
        },
        "n8n-nodes-base.stickyNote": {
          "count": 2
        },
        "n8n-nodes-base.scheduleTrigger": {
          "count": 1
        }
      }
    },
    "status": "published",
    "readyToDemo": null,
    "user": {
      "name": "Hostinger",
      "username": "hostinger",
      "bio": "Hostinger aims to make online presence accessible to everyone worldwide – from developers to aspiring bloggers and business owners. With our fast hosting technology, AI-powered Website Builder, and easy-to-operate hPanel you can succeed online faster and easier.",
      "verified": true,
      "links": [
        "https://www.hostinger.com/vps/n8n-hosting"
      ],
      "avatar": "https://gravatar.com/avatar/be87ae832a10297a42d8d92ade9b7b680e2e0cdd81c519603277b10956e46c86?r=pg&d=retro&size=200"
    },
    "nodes": [
      {
        "id": 11,
        "icon": "fa:envelope",
        "name": "n8n-nodes-base.emailSend",
        "codex": {
          "data": {
            "alias": [
              "SMTP",
              "email",
              "human",
              "form",
              "wait",
              "hitl",
              "approval"
            ],
            "resources": {
              "generic": [
                {
                  "url": "https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/",
                  "icon": "☀️",
                  "label": "2021: The Year to Automate the New You with n8n"
                },
                {
                  "url": "https://n8n.io/blog/build-your-own-virtual-assistant-with-n8n-a-step-by-step-guide/",
                  "icon": "👦",
                  "label": "Build your own virtual assistant with n8n: A step by step guide"
                }
              ],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.sendemail/"
                }
              ],
              "credentialDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/credentials/sendemail/"
                }
              ]
            },
            "categories": [
              "Communication",
              "HITL",
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "HITL": [
                "Human in the Loop"
              ]
            }
          }
        },
        "group": "[\"output\"]",
        "defaults": {
          "name": "Send Email",
          "color": "#00bb88"
        },
        "iconData": {
          "icon": "envelope",
          "type": "icon"
        },
        "displayName": "Send Email",
        "typeVersion": 2,
        "nodeCategories": [
          {
            "id": 6,
            "name": "Communication"
          },
          {
            "id": 9,
            "name": "Core Nodes"
          },
          {
            "id": 28,
            "name": "HITL"
          }
        ]
      },
      {
        "id": 20,
        "icon": "fa:map-signs",
        "name": "n8n-nodes-base.if",
        "codex": {
          "data": {
            "alias": [
              "Router",
              "Filter",
              "Condition",
              "Logic",
              "Boolean",
              "Branch"
            ],
            "details": "The IF node can be used to implement binary conditional logic in your workflow. You can set up one-to-many conditions to evaluate each item of data being inputted into the node. That data will either evaluate to TRUE or FALSE and route out of the node accordingly.\n\nThis node has multiple types of conditions: Bool, String, Number, and Date & Time.",
            "resources": {
              "generic": [
                {
                  "url": "https://n8n.io/blog/learn-to-automate-your-factorys-incident-reporting-a-step-by-step-guide/",
                  "icon": "🏭",
                  "label": "Learn to Automate Your Factory's Incident Reporting: A Step by Step Guide"
                },
                {
                  "url": "https://n8n.io/blog/2021-the-year-to-automate-the-new-you-with-n8n/",
                  "icon": "☀️",
                  "label": "2021: The Year to Automate the New You with n8n"
                },
                {
                  "url": "https://n8n.io/blog/why-business-process-automation-with-n8n-can-change-your-daily-life/",
                  "icon": "🧬",
                  "label": "Why business process automation with n8n can change your daily life"
                },
                {
                  "url": "https://n8n.io/blog/create-a-toxic-language-detector-for-telegram/",
                  "icon": "🤬",
                  "label": "Create a toxic language detector for Telegram in 4 step"
                },
                {
                  "url": "https://n8n.io/blog/no-code-ecommerce-workflow-automations/",
                  "icon": "store",
                  "label": "6 e-commerce workflows to power up your Shopify s"
                },
                {
                  "url": "https://n8n.io/blog/how-to-build-a-low-code-self-hosted-url-shortener/",
                  "icon": "🔗",
                  "label": "How to build a low-code, self-hosted URL shortener in 3 steps"
                },
                {
                  "url": "https://n8n.io/blog/automate-your-data-processing-pipeline-in-9-steps-with-n8n/",
                  "icon": "⚙️",
                  "label": "Automate your data processing pipeline in 9 steps"
                },
                {
                  "url": "https://n8n.io/blog/how-to-get-started-with-crm-automation-and-no-code-workflow-ideas/",
                  "icon": "👥",
                  "label": "How to get started with CRM automation (with 3 no-code workflow ideas"
                },
                {
                  "url": "https://n8n.io/blog/5-tasks-you-can-automate-with-notion-api/",
                  "icon": "⚡️",
                  "label": "5 tasks you can automate with the new Notion API "
                },
                {
                  "url": "https://n8n.io/blog/automate-google-apps-for-productivity/",
                  "icon": "💡",
                  "label": "15 Google apps you can combine and automate to increase productivity"
                },
                {
                  "url": "https://n8n.io/blog/automation-for-maintainers-of-open-source-projects/",
                  "icon": "🏷️",
                  "label": "How to automatically manage contributions to open-source projects"
                },
                {
                  "url": "https://n8n.io/blog/how-uproc-scraped-a-multi-page-website-with-a-low-code-workflow/",
                  "icon": " 🕸️",
                  "label": "How uProc scraped a multi-page website with a low-code workflow"
                },
                {
                  "url": "https://n8n.io/blog/5-workflow-automations-for-mattermost-that-we-love-at-n8n/",
                  "icon": "🤖",
                  "label": "5 workflow automations for Mattermost that we love at n8n"
                },
                {
                  "url": "https://n8n.io/blog/why-this-product-manager-loves-workflow-automation-with-n8n/",
                  "icon": "🧠",
                  "label": "Why this Product Manager loves workflow automation with n8n"
                },
                {
                  "url": "https://n8n.io/blog/sending-automated-congratulations-with-google-sheets-twilio-and-n8n/",
                  "icon": "🙌",
                  "label": "Sending Automated Congratulations with Google Sheets, Twilio, and n8n "
                },
                {
                  "url": "https://n8n.io/blog/how-to-set-up-a-ci-cd-pipeline-with-no-code/",
                  "icon": "🎡",
                  "label": "How to set up a no-code CI/CD pipeline with GitHub and TravisCI"
                },
                {
                  "url": "https://n8n.io/blog/benefits-of-automation-and-n8n-an-interview-with-hubspots-hugh-durkin/",
                  "icon": "🎖",
                  "label": "Benefits of automation and n8n: An interview with HubSpot's Hugh Durkin"
                },
                {
                  "url": "https://n8n.io/blog/aws-workflow-automation/",
                  "label": "7 no-code workflow automations for Amazon Web Services"
                }
              ],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.if/"
                }
              ]
            },
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Flow"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "If",
          "color": "#408000"
        },
        "iconData": {
          "icon": "map-signs",
          "type": "icon"
        },
        "displayName": "If",
        "typeVersion": 2,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 490,
        "icon": "fa:terminal",
        "name": "n8n-nodes-base.ssh",
        "codex": {
          "data": {
            "alias": [
              "remote"
            ],
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.ssh/"
                }
              ]
            },
            "categories": [
              "Core Nodes",
              "Development"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": [
              "Helpers"
            ]
          }
        },
        "group": "[\"input\"]",
        "defaults": {
          "name": "SSH",
          "color": "#000000"
        },
        "iconData": {
          "icon": "terminal",
          "type": "icon"
        },
        "displayName": "SSH",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 5,
            "name": "Development"
          },
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 565,
        "icon": "fa:sticky-note",
        "name": "n8n-nodes-base.stickyNote",
        "codex": {
          "data": {
            "alias": [
              "Comments",
              "Notes",
              "Sticky"
            ],
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Helpers"
              ]
            }
          }
        },
        "group": "[\"input\"]",
        "defaults": {
          "name": "Sticky Note",
          "color": "#FFD233"
        },
        "iconData": {
          "icon": "sticky-note",
          "type": "icon"
        },
        "displayName": "Sticky Note",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 834,
        "icon": "file:code.svg",
        "name": "n8n-nodes-base.code",
        "codex": {
          "data": {
            "alias": [
              "cpde",
              "Javascript",
              "JS",
              "Python",
              "Script",
              "Custom Code",
              "Function"
            ],
            "details": "The Code node allows you to execute JavaScript in your workflow.",
            "resources": {
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.code/"
                }
              ]
            },
            "categories": [
              "Development",
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0",
            "subcategories": {
              "Core Nodes": [
                "Helpers",
                "Data Transformation"
              ]
            }
          }
        },
        "group": "[\"transform\"]",
        "defaults": {
          "name": "Code"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jxyZWN0IHdpZHRoPSI1MTIiIGhlaWdodD0iNTEyIiBmaWxsPSJ3aGl0ZSIvPgo8L2NsaXBQYXRoPgo8L2RlZnM+Cjwvc3ZnPgo="
        },
        "displayName": "Code",
        "typeVersion": 2,
        "nodeCategories": [
          {
            "id": 5,
            "name": "Development"
          },
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      },
      {
        "id": 839,
        "icon": "fa:clock",
        "name": "n8n-nodes-base.scheduleTrigger",
        "codex": {
          "data": {
            "alias": [
              "Time",
              "Scheduler",
              "Polling",
              "Cron",
              "Interval"
            ],
            "resources": {
              "generic": [],
              "primaryDocumentation": [
                {
                  "url": "https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger/"
                }
              ]
            },
            "categories": [
              "Core Nodes"
            ],
            "nodeVersion": "1.0",
            "codexVersion": "1.0"
          }
        },
        "group": "[\"trigger\",\"schedule\"]",
        "defaults": {
          "name": "Schedule Trigger",
          "color": "#31C49F"
        },
        "iconData": {
          "icon": "clock",
          "type": "icon"
        },
        "displayName": "Schedule Trigger",
        "typeVersion": 1,
        "nodeCategories": [
          {
            "id": 9,
            "name": "Core Nodes"
          }
        ]
      }
    ],
    "categories": [
      {
        "id": 16,
        "name": "DevOps"
      }
    ],
    "image": []
  }
}