Block 1 - User Activity Webhook
- Type / Role
- n8n-nodes-base.webhook - webhook
- Config choices
- Version 1
AI Fraud Detection Workflow n8n + PostgreSQL + OpenAI + Slack This AI Fraud Detection Workflow is an automated n8n pipeline that analyzes user activity in real time using a combination of rule...
n8n-nodes-base.webhook, n8n-nodes-base.code, n8n-nodes-base.stickynote, n8n-nodes-base.postgres, n8n-nodes-base.function, n8n-nodes-base.openai, n8n-nodes-base.if, n8n-nodes-base.slack
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by WeblineIndia.
Original n8n.io source> n8n + PostgreSQL + OpenAI + Slack
This AI Fraud Detection Workflow is an automated n8n pipeline that analyzes user activity in real time using a combination of rule-based fraud detection, AI interpretation and historical behavioral context. It processes events like login attempts, password changes or transactions, evaluates risk, stores results in PostgreSQL and triggers alerts for high-risk activity.
/user-activity user_activity_logs tableThis workflow continuously monitors user activity events and evaluates them for suspicious behavior.
When a user event is received, the system:
It helps detect anomalies like:
CREATE TABLE user_activity_logs (
id BIGSERIAL PRIMARY KEY,
user_id TEXT,
event TEXT,
ip TEXT,
location TEXT,
device TEXT,
risk_score INT,
ai_flag TEXT,
created_at TIMESTAMP DEFAULT NOW()
);
Receives user activity via POST request:
Endpoint:
/user-activity
Payload:
{
"user_id": "user_002",
"event": "password_change",
"ip": "192.165.1.45",
"location": "United States",
"device": "Chrome Browser - Windows"
}
Ensures required fields exist:
Retrieves last 10 activity logs for the user to build behavioral context.
Merges:
This helps detect behavioral anomalies.
Applies deterministic fraud logic:
Outputs:
rule_scorerule_risk (LOW / MEDIUM / HIGH)risk_reasonsThe AI does not calculate risk.
It only interprets rule-based output and returns:
{
"risk_level": "LOW | MEDIUM | HIGH",
"reason": "short explanation"
}
Final risk logic:
Stores final result in PostgreSQL:
Triggers only when:
final_risk === "HIGH"
Sends fraud alert via Slack (or can be replaced with email, SMS, Teams, etc.)
This workflow can be extended to many more fraud detection and security monitoring use cases.
| Issue | Possible Cause | Solution |
|---|---|---|
| Webhook not receiving data | Incorrect endpoint or inactive workflow | Ensure workflow is active and webhook URL is correct |
| AI parsing error | Unexpected response format from OpenAI | Verify JSON structure from AI output |
| No historical data found | Empty user logs table | Ensure user_activity_logs has existing records |
| Slack alert not triggered | Risk not classified as HIGH | Check fusion logic in decision node |
| PostgreSQL error | Wrong credentials or schema mismatch | Verify DB connection and table structure |
| Incorrect risk score | Rule logic misconfiguration | Review fraud scoring conditions |
If you need help with:
You can reach out to our n8n workflow developers at WeblineIndia for professional assistance in building and optimizing automation workflows like this.
This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
| Workflow | Detect fraud in user activity with PostgreSQL, OpenAI and Slack |
|---|---|
| Complexity | advanced |
| Nodes | 18 |
| Categories | SecOps, AI Summarization |
| Author | WeblineIndia |
| Published | 01 May 2026 |
Use the JSON export at /data/workflows/15419/15419.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
AI Fraud Detection Workflow n8n + PostgreSQL + OpenAI + Slack This AI Fraud Detection Workflow is an automated n8n pipeline that analyzes user activity in real time using a combination of rule...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your SecOps, AI Summarization use case.