Production n8n Automations · SSH · Webhooks · Discord · Email · Google

Automation workflows
built for real infrastructure

A showcase of production-grade n8n workflows covering scheduled database backups, automated backup retention cleanup, webhook-driven procurement notifications, and Google Sheets tracking — running daily across cloud and onsite environments.

⏰ Schedule
SSH Backup
Parse Status
Merge Results
📨 Discord + Email
🔗 Webhook (PIMS)
Validate Email
📊 Sheets
☁️ Google Drive
Filter 28d+
🗑 Purge + Notify

Coverage at a glance

All workflows are actively running in a government agency infrastructure environment in Davao del Sur.

5
Production workflows deployed
8+
Systems & databases backed up daily
28d
Retention policy on local + cloud storage
2
Notification channels (Discord + Email)
24/7
Fully unattended scheduled execution

Workflow case studies

Onsite Dual-Webapp Backup workflow screenshot
01
Onsite Dual-Webapp Backup
CUAMS + PNPKI · Scheduled · MySQL · Discord Report

Nightly scheduled workflow that SSHes into the onsite server to run isolated mysqldump jobs for CUAMS and PNPKI in parallel. Both outputs are normalized by JS code nodes into success / failed objects, merged, and dispatched as a formatted Discord report.

⏰ 19:30 Daily
CUAMS Backup
PNPKI Backup
JS Status Parser ×2
Merge
Format Report
📨 Discord

What it does

  • Parallel SSH mysqldump to local ~/backup
  • Strips insecure-password CLI warnings
  • Merges both statuses into one report
  • Posts Daily Backup Report to Discord

Systems covered

  • CUAMS (onsite MySQL)
  • PNPKI (onsite MySQL)
⏰ Scheduled 19:30 🔑 SSH + Private Key 📨 Discord Webhook
Centralized Multi-System Backup Orchestration workflow screenshot
02
Centralized Multi-System Backup Orchestration
6 Apps · MySQL + PostgreSQL · Discord + HTML Email

Expanded backup pipeline covering six systems — both onsite and cloud-hosted — running in parallel. Results are collected, counted, and formatted into two outputs: a Discord summary and a professional HTML email branded as A.L.I.T.A. (Automated Log Integrity Timestamp Archiver), including partial-failure detection and per-system status badges.

⏰ 19:00 Daily
Helpdesk · Paycontrack · PIMS · HRIS · Clockwork · MYHIS
Status Parsers ×6
Merge (6-in)
Discord Formatter
HTML Email Builder
📨 Discord
📧 Mailgun

What it does

  • 6 parallel SSH backup jobs
  • Handles MySQL (onsite) + PostgreSQL (cloud via Docker)
  • Overall status: SUCCESS / PARTIAL FAILURE / FAILED
  • Branded HTML email + Discord report
  • SSL-secured cloud DB connections

Systems covered

  • Helpdesk (onsite MySQL)
  • Paycontrack (remote MySQL)
  • PIMS (onsite MySQL)
  • HRIS (cloud MySQL / DigitalOcean)
  • Clockwork (cloud PostgreSQL)
  • MYHIS (cloud MySQL, SSL/TLS)
⏰ Scheduled 19:00 🔑 SSH + Private Key 📧 Mailgun Email 📨 Discord Webhook
PIMS Procurement Event Notifier workflow screenshot
03
PIMS Procurement Event Notifier
Webhook · Email Dispatch · Google Sheets Tracker

Event-driven workflow triggered by a secured webhook from the PIMS webapp. When a procurement event fires, it splits all recipients, validates each email address via regex, sends a formatted HTML notification per recipient, and logs every outcome (sent, failed, or no-email) as a row in a Google Sheets tracking log.

🔗 Webhook (POST /procurement-events)
Split Recipients
Email Validator
IF: Has Valid Email?
📧 SMTP Email
❌ Mark FAILED
Merge (3-in)
📊 Append to Sheets

What it does

  • Receives PR events from PIMS via webhook
  • Loops per recipient, validates email via regex
  • Sends HTML email with PR details per recipient
  • Records every result: SENT, FAILED, or ERROR
  • Logs to Google Sheets for audit trail

Data tracked per row

  • Timestamp
  • PR / Reference No.
  • Event type
  • Recipient name + email
  • Send status + message
🔗 Webhook Triggered ⚡ Real-time 📧 SMTP Email 📊 Google Sheets
Cloud Backup Retention Purge workflow screenshot
04
Cloud Backup Retention Purge
Google Drive · 28-Day Retention · Batch Delete · Discord

Scheduled nightly cleanup that queries a designated Google Drive backup folder, filters any file whose filename contains a date older than 28 days, then deletes them in batches of 20 using a loop. Results are summarized and posted to Discord, keeping cloud storage lean without manual intervention.

⏰ 20:30 Daily
Query Drive Folder
Filter Files 28d+
Loop (batch 20)
Delete File
→ loop back
Build Purge Report
📨 Discord

What it does

  • Queries entire Drive folder at once
  • Parses dates from filenames via regex
  • Batched deletions (20 files/loop) to avoid rate limits
  • Reports purged file list to Discord
  • No-op safe: notifies when nothing was deleted

Retention policy

  • 28-day rolling window
  • Filename date pattern: YYYY-MM-DD
  • Google Drive OAuth2
  • Posts purge log to PICTOHUB Discord
⏰ Scheduled 20:30 ☁️ Google Drive 📨 Discord Webhook
Local Server Backup Retention Purge workflow screenshot
05
Local Server Backup Retention Purge
SSH · find + delete · 28-Day Retention · Discord

Companion cleanup workflow for the onsite server. Uses SSH to execute a single find . -mtime +28 -print -delete in the backup directory, then parses stdout for deleted files and posts a formatted purge report to Discord — minimal but production-reliable retention automation.

⏰ 20:30 Daily
SSH: find -mtime +28 -delete
Parse stdout → Purge Report
📨 Discord

What it does

  • SSH into onsite server, runs native find/delete
  • Parses stdout to extract deleted filenames
  • Formats purge report with file list
  • No-op safe: reports "nothing deleted" gracefully

Technical details

  • 28-day mtime-based retention
  • Target: /home/lord/backup
  • SSH private key auth
  • Posts to PICTOHUB Discord channel
⏰ Scheduled 20:30 🔑 SSH + Private Key 📨 Discord Webhook

Architecture patterns

All five workflows share a clean reusable design pattern, adapted for the trigger type and target environment.

🗄️ Backup orchestration pattern

1 Schedule trigger fires at a fixed daily time
2 SSH nodes execute remote dump/backup commands in parallel
3 JS code nodes normalize exit codes + stderr into status objects
4 Merge node collects all per-system results into one context
5 Formatter node builds Discord message and/or HTML email body
6 Notification dispatched via Discord webhook and/or Mailgun

🔗 Webhook event pattern (PIMS)

1 PIMS app fires POST to n8n webhook with recipient list + PR data
2 Split Out node iterates each recipient individually
3 Validator code node checks email regex per recipient
4 IF node branches: valid email → SMTP send, invalid → FAILED mark
5 All three outcomes (sent, error, no-email) feed into Merge
6 Every result row is appended to Google Sheets for audit

🗑️ Retention cleanup pattern

1 Schedule trigger fires after backup window completes
2 Cloud: Drive API query returns all files; Local: SSH find command
3 Filter logic identifies files older than 28 days by filename date or mtime
4 Cloud: batch-loop deletion; Local: find -delete handles it natively
5 Summary builder lists purged files or reports a clean no-op
6 Discord notification confirms cleanup ran successfully

⚙️ Design principles applied

Error-tolerant: continueRegularOutput prevents single failures from halting the workflow
Credentials use SSH private keys and env variables — no plaintext passwords in nodes
Idempotent JS parsers strip noise (password warnings, GTID messages) before reporting
All workflows send human-readable summaries, not raw logs

More workflows coming soon

This showcase is designed to grow. Paste additional n8n workflow JSONs and each one will be analyzed and documented as a new case-study card — covering scheduling, APIs, AI, forms, and more.

↑ Back to workflows