🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

OpenAI + Telegram: smarter VPS security alerts

Lisa Granqvist Partner Workflow Automation Expert

Your VPS is “fine” until it isn’t. The problem is the in-between: noisy monitoring alerts you stop trusting, plus the slow, manual routine of SSH-ing in to run checks when something feels off.

Sysadmins feel it during on-call weeks. A DevOps lead gets it when production is busy and attention is fragmented. And a small-business owner running a Linux server on the side gets burned by it, too. This OpenAI Telegram alerts automation turns raw SSH output into clear, actionable security messages.

You’ll see what the workflow does, what you’ll need, and how it cuts down false alarms without missing the real problems.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: OpenAI + Telegram: smarter VPS security alerts

The Problem: VPS SSH checks create noise, not clarity

Most VPS monitoring is either too shallow (CPU high, disk low, memory spiking) or too spammy (every blip becomes a ping). So you end up doing the same “security sanity check” by hand: SSH in, run ps, scan a long process list, then run ss and squint at open ports. On a calm day it’s annoying. On a busy day, it’s how suspicious activity slips through. And frankly, the worst part is cognitive load. You’re not just reading data. You’re deciding what matters, fast, with incomplete context.

The friction compounds. Here’s where it breaks down.

  • You end up checking “just to be safe,” which quietly eats about 20 minutes each time.
  • Raw process and socket output is high-volume, so important anomalies blend in with normal system churn.
  • Traditional alerts often trigger on symptoms (CPU, memory) rather than likely causes (a suspicious process or odd outbound connection).
  • When you do spot something, writing a clear incident note for your team still takes extra time you don’t have.

The Solution: AI-reviewed SSH security alerts to Telegram

This n8n workflow runs on a schedule and connects to your Linux VPS over SSH to collect two things: your top running processes and your active network connections. It captures that output using a single command (ps aux --sort=-%cpu,-%mem && ss -tulpn), then passes the results into an OpenAI-based assessment step. Instead of dumping logs into your chat, the AI looks for suspicious patterns, malware-like behavior, unusual ports, strange outbound connections, and resource spikes that don’t match normal activity. The workflow then parses the AI’s response into structured fields and uses simple decision checks to classify what it found. Finally, it only messages you on Telegram when something looks malicious or suspicious, with an explanation you can act on.

The workflow starts with a scheduled checkpoint trigger. Then it collects metrics over SSH and sends them through an AI threat assessment. Based on the report, it routes to either a “malicious” alert or a “suspicious” notice, which keeps your chat quiet until it needs to speak up.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you manage 3 small VPS boxes for client sites. Without automation, a “quick check” is usually SSH in (2 minutes), run commands, scan output, and sanity-check ports (maybe 15 minutes per server). That’s roughly 50 minutes per round, and most teams do it a few times a week. With this workflow, the scheduled trigger runs the checks automatically and you only spend time when Telegram flags something. Many weeks, your time cost is basically zero beyond a quick read.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • OpenAI for analyzing SSH output for threats
  • Telegram to receive security alerts in chat
  • OpenAI API key (get it from the OpenAI dashboard)

Skill level: Intermediate. You’ll paste credentials, adjust a schedule, and be comfortable testing a workflow run end-to-end.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A scheduled check runs automatically. The workflow uses a schedule trigger so your VPS gets checked hourly, daily, or on whatever cadence matches your risk tolerance.

Your server is queried over SSH. n8n connects to the VPS and executes a command that returns a prioritized process list plus active listening ports and connections, so you’re not blind to what the machine is doing right now.

OpenAI reviews the output for suspicious behavior. The AI threat assessment looks for patterns humans typically hunt for manually: unexpected services, weird port usage, high-resource processes with odd names, and network activity that doesn’t fit.

Telegram gets a message only when it matters. Two simple checks route the report: malicious goes to an urgent alert, suspicious goes to a softer notice, and “looks normal” stays quiet.

You can easily modify the monitoring frequency to fit your environment based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Scheduled Trigger

Set up the schedule that kicks off the server security check cycle.

  1. Add the Scheduled Checkpoint Trigger node.
  2. Set the schedule rule to run every 6 hours by configuring Interval to hours and Hours Interval to 6.
  3. Optionally keep Flowpast Branding as a visual reference note (no configuration required).

Step 2: Connect Runtime Configuration Setup

Define the server name and alert destination used across downstream nodes.

  1. Add the Runtime Configuration Setup node after Scheduled Checkpoint Trigger.
  2. Set admin_telegram_id to YOUR_TELEGRAM_CHAT_ID.
  3. Set server_name to Production VPS.
  4. Set alert_level to high.

⚠️ Common Pitfall: If admin_telegram_id is left as YOUR_TELEGRAM_CHAT_ID, Telegram alerts will fail to deliver.

Step 3: Connect SSH Collect System Metrics

Gather process and network data from your server via SSH.

  1. Add the SSH Collect System Metrics node after Runtime Configuration Setup.
  2. Credential Required: Connect your sshPassword credentials.
  3. Set Working Directory (cwd) to /root.
  4. Set Command to ps aux --sort=-%cpu,-%mem && ss -tulpn > /vps_process_report.txt.

Step 4: Set Up AI Threat Assessment

Analyze the SSH output with an LLM and parse the structured results.

  1. Add the AI Threat Assessment node after SSH Collect System Metrics.
  2. Set Prompt Type to define and paste the full prompt into Text, including {{ $json.stdout }}.
  3. Connect OpenAI Mini Model as the language model for AI Threat Assessment.
  4. Credential Required: Connect your openAiApi credentials in OpenAI Mini Model.
  5. Enable the output parser by connecting Parse Threat Report to AI Threat Assessment as the structured output parser.
  6. Keep the Parse Threat Report schema as provided to parse malicious, malicious_explain, suspicious, suspicious_explain, and status.

Tip: Parse Threat Report is an AI sub-node. Credentials should be added to OpenAI Mini Model, not to the parser itself.

Step 5: Configure Parallel Routing Logic

Split the AI output into malicious and suspicious alert paths.

  1. Add Detect Malicious Indicators and Flag Suspicious Indicators after AI Threat Assessment.
  2. In Detect Malicious Indicators, set the condition to check {{ $json.output.malicious }} with operator notEmpty.
  3. In Flag Suspicious Indicators, set the condition to check {{ $json.output.suspicious }} with operator notEmpty.
  4. AI Threat Assessment outputs to both Detect Malicious Indicators and Flag Suspicious Indicators in parallel.

Step 6: Configure Output Alerts

Send Telegram notifications based on the identified severity.

  1. Add Dispatch Malicious Alert after Detect Malicious Indicators.
  2. Credential Required: Connect your telegramApi credentials in Dispatch Malicious Alert.
  3. Set Chat ID to {{ $('Runtime Configuration Setup').first().json.admin_telegram_id }}.
  4. Set Text to the full template including {{ $json.output.malicious }}, {{ $json.output.malicious_explain }}, and {{ $json.output.status }}.
  5. Add Send Suspicious Notice after Flag Suspicious Indicators.
  6. Credential Required: Connect your telegramApi credentials in Send Suspicious Notice.
  7. Set Chat ID to {{ $('Runtime Configuration Setup').first().json.admin_telegram_id }} and Text to the provided suspicious alert template.

Step 7: Test and Activate Your Workflow

Run a manual test to verify SSH collection, AI analysis, and alert routing.

  1. Click Execute Workflow to run a manual test from Scheduled Checkpoint Trigger.
  2. Confirm SSH Collect System Metrics returns stdout output with process and port details.
  3. Verify AI Threat Assessment outputs structured fields parsed by Parse Threat Report.
  4. Ensure alerts are routed correctly: malicious findings trigger Dispatch Malicious Alert and suspicious findings trigger Send Suspicious Notice.
  5. Toggle the workflow to Active once the test succeeds.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • SSH credentials can expire or require specific permissions. If things break, check your VPS user access and key settings in the n8n SSH node first.
  • If you add Wait nodes later (or your VPS is under load), processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your “normal baseline” and brand of risk tolerance early or you will be second-guessing outputs forever.

Frequently Asked Questions

How long does it take to set up this OpenAI Telegram alerts automation?

About 30 minutes if you already have SSH and Telegram details ready.

Do I need coding skills to automate OpenAI Telegram alerts?

No. You’ll mostly paste credentials and tweak the schedule. The “logic” is already built into the workflow’s checks.

Is n8n free to use for this OpenAI Telegram alerts workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs around $0.001-0.01 per analysis, depending on how busy your server is.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this OpenAI Telegram alerts workflow for multiple servers?

Yes, and it’s a common upgrade. Duplicate the SSH collection step per VPS (or loop through a server list) and keep the same AI assessment and routing checks. Many teams also customize the AI prompt to treat certain processes as “known safe” so they never trigger a suspicious notice.

Why is my Telegram connection failing in this workflow?

Usually it’s a wrong chat ID or a bot token that doesn’t match the bot you’re messaging from. Double-check the admin_telegram_id field in the configuration step and confirm the bot can message that chat. If it still fails, re-authorize the Telegram credentials in n8n and run a manual test message from the Telegram node. Private groups can be tricky too because the bot often needs to be added and allowed to post.

How many servers can this OpenAI Telegram alerts automation handle?

On n8n Cloud Starter, you can run enough executions for a small fleet, and you can scale up by increasing your plan. If you self-host, there’s no execution cap, so limits are mostly your VPS size and how frequently you run checks. Practically, many teams start with a handful of servers and an hourly schedule, then adjust based on load and alert volume.

Is this OpenAI Telegram alerts automation better than using Zapier or Make?

Often, yes, because this kind of workflow needs branching logic, structured parsing, and SSH access, and n8n handles that without turning every decision into a paid “task.” Self-hosting is also a big deal if you want unlimited runs and tighter control over security. Zapier or Make can still work if your setup is simple and you’re not touching SSH at all, but then you lose the core advantage of pulling real system state. Another point people miss is noise control: the “only notify when suspicious” logic is easier to tune in n8n. If you want a second opinion on tooling, Talk to an automation expert.

Once this is running, your VPS still gets watched, but your attention stops getting hijacked. You get cleaner signals, faster decisions, and fewer “just in case” logins.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal