Detect Suspicious Logins with n8n and GreyNoise Integration

This n8n workflow automates the detection of suspicious user logins by analyzing IP trust, location, and device anomalies. It efficiently notifies security teams via Slack and emails users about unusual login activities, enhancing real-time threat response.
set
webhook
if
+10
Workflow Identifier: 1168
NODES in Use: Set, Webhook, If, Postgres, HTTP Request, Merge, Code, Manual Trigger, HTML, Gmail, Slack, Switch, NoOp

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

Visit through Desktop for Best experience

What This Automation Does

This workflow finds risky logins fast. It checks if the IP address is bad or sneaky. It looks where the login came from. It sees what device and browser were used. It checks if these are new or strange compared to past logins. Then it gives a risk level and sends alerts to Slack and emails to users. This saves time and helps spot real threats early.


Tools and Services Used

  • GreyNoise API: Checks if IP address has bad history.
  • IP-API: Finds physical location of IP.
  • UserParser API: Breaks down user agent into device, browser, OS.
  • Postgres Database: Stores past login info for comparison.
  • Gmail SMTP or OAuth2: Sends email alerts to users.
  • Slack API: Sends alerts to security team chat.

Who Should Use This Workflow

This is for security teams watching login events. They want to stop account hacks fast. Also useful for anyone with many users logging in daily. It helps reduce time spent checking false alarms. Good for companies with access to APIs and a Postgres database.


Inputs, Processing Steps, and Outputs

Inputs

  • Login event JSON with IP, user agent, user ID, timestamp.

Processing Steps

  1. Receive login event through Webhook node.
  2. Extract IP, user agent, timestamp, URL, and user ID using Set node.
  3. Send IP to GreyNoise API to check reputation.
  4. Branch flow based on GreyNoise flags (noise and riot values).
  5. Classify threat priority (High, Medium, Low) using Switch nodes.
  6. For uncertain threats, query Postgres for user’s last 10 logins.
  7. Query IP-API for geolocation of current login.
  8. Compare new location to historical cities.
  9. Call UserParser API to parse user agent details.
  10. Check if device/browser/OS is new or changed.
  11. Merge GreyNoise, geolocation, and user agent data to get full context.
  12. Fetch user email and profile from Postgres for notification.
  13. Send email alert if user has email.
  14. Send Slack alert to security team with priority and details.

Outputs

  • Security team Slack messages with login alerts and IP reputation link.
  • Email notifications to users if unusual login detected.
  • Priority tag on each login event to guide response.

Beginner Step-by-Step: How to Use This Workflow in n8n

Step 1: Import Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open n8n editor, click on “Import from File” and select the downloaded workflow JSON.

Step 2: Add Credentials and Configure Settings

  1. Set up API credentials for GreyNoise and UserParser in n8n’s Credentials section.
  2. Check and update any IDs, emails, Slack channel names, database table names as needed.
  3. Ensure Postgres credentials are correct and connected.

Step 3: Test the Workflow

  1. Trigger a sample login event manually via Webhook node or use test data.
  2. Check Slack and email outputs for correct alerts.

Step 4: Activate Workflow for Production

  1. Activate the Webhook node to start receiving real login events.
  2. Monitor workflow runs in n8n UI for errors or missed alerts.
  3. Consider enabling retry settings on critical nodes to avoid lost events.

For those who want to run this on their own server, consider self-host n8n for full control and security.


Common Errors and How to Fix Them

  • GreyNoise API call fails or returns no data: Check API Key is valid and network is working.
  • No email sent to user: Verify user email exists in Postgres; check Gmail node credentials.
  • Postgres query errors or no results: Confirm table names and SQL syntax, ensure userId parameter is passed correctly.

Customization Ideas

  • Change how the workflow sets priority rules for different GreyNoise classifications.
  • Increase or lower the number of past logins queried from Postgres.
  • Adjust user email notification HTML content for branding or extra instructions.
  • Add SMS alerts after priority is set using Twilio or other services.
  • Extend workflow to trigger multi-factor authentication on suspicious logins.

Summary of Benefits

✓ Saves hours by automating login threat checks.
✓ Quickly spots suspicious IPs, locations, and devices.
✓ Sends clear alerts to security team and users.
✓ Easy to import and configure inside n8n.
✓ Reduces false alarms and missed threats.


Frequently Asked Questions

GreyNoise API checks the reputation and threat classification of the IP address initiating the login.
The workflow uses the UserParser API to parse user agent details and compares device and browser info against past login data in Postgres.
Verify that the user email exists in the Postgres database and check that Gmail node credentials are correctly set.
Download and import the workflow file into n8n, add required API credentials and database info, test with sample data, then activate the Webhook node to receive live login events.

Promoted by BULDRR AI

Related Workflows

Automate Viral UGC Video Creation Using n8n + Degaus (Beginner-Friendly Guide)

Learn how to automate viral UGC video creation using n8n, AI prompts, and Degaus. This beginner-friendly guide shows how to import, configure, and run the workflow without technical complexity.
Form Trigger
Google Sheets
Gmail
+37
Free

AI SEO Blog Writer Automation Workflows in n8n

A complete beginner guide to building an AI SEO blog writer automation using n8n.
AI Agent
Google Sheets
httpRequest
+5
Free

Automate CrowdStrike Alerts with VirusTotal, Jira & Slack

This workflow automates processing of CrowdStrike detections by enriching threat data via VirusTotal, creating Jira tickets for incident tracking, and notifying teams on Slack for quick response. Save hours daily by transforming complex threat data into actionable alerts effortlessly.
scheduleTrigger
httpRequest
jira
+5
Free

Automate Telegram Invoices to Notion with AI Summaries & Reports

Save hours on financial tracking by automating invoice extraction from Telegram photos to Notion using Google Gemini AI. This workflow extracts data, records transactions, and generates detailed spending reports with charts sent on schedule via Telegram.
lmChatGoogleGemini
telegramTrigger
notion
+9
Free

Automate Email Replies with n8n and AI-Powered Summarization

Save hours managing your inbox with this n8n workflow that uses IMAP email triggers, AI summarization, and vector search to draft concise replies requiring minimal review. Automate business email processing efficiently with AI guidance and Gmail integration.
emailReadImap
vectorStoreQdrant
emailSend
+12
Free

Automate Email Campaigns Using n8n with Gmail & Google Sheets

This n8n workflow automates personalized email outreach campaigns by integrating Gmail and Google Sheets, saving hours of manual follow-up work and reducing errors in email sequences. It ensures timely follow-ups based on previous email interactions, optimizing communication efficiency.
googleSheets
gmail
code
+5
Free