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
Detect suspicious logins with n8n and GreyNoise

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

Learn how to Build this Workflow with AI:

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.


Detect suspicious logins with n8n and GreyNoise

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

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.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.