AutomationFlowsAI & RAG › Safe Support Agent

Safe Support Agent

Safe support agent. Uses postgres, agent, lmChatOpenAi, slack. Webhook trigger; 11 nodes.

Webhook trigger★★★★☆ complexityAI-powered11 nodesPostgresAgentOpenAI ChatSlack
AI & RAG Trigger: Webhook Nodes: 11 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → OpenAI Chat recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Safe support agent",
  "nodes": [
    {
      "id": "webhook",
      "name": "Authenticated Webhook",
      "type": "n8n-nodes-base.webhook",
      "parameters": {
        "authentication": "headerAuth",
        "path": "support"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "dedupe",
      "name": "Claim idempotency event",
      "type": "n8n-nodes-base.postgres",
      "onError": "continueErrorOutput",
      "parameters": {
        "operation": "executeQuery",
        "query": "INSERT INTO event_ledger (event_id) VALUES ($1) ON CONFLICT (event_id) DO NOTHING RETURNING event_id",
        "queryReplacement": "={{ $json.event_id }}"
      },
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "ledger-failure",
      "name": "Ledger failure stop",
      "type": "n8n-nodes-base.noOp",
      "parameters": {}
    },
    {
      "id": "enabled",
      "name": "Agent enabled kill switch",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ $json.agent_enabled }}",
              "value2": true
            }
          ]
        }
      }
    },
    {
      "id": "agent",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "parameters": {
        "text": "={{ $json.body.message }}"
      }
    },
    {
      "id": "model",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "parameters": {
        "modelName": "gpt-4.1-mini"
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "confidence",
      "name": "Confidence gate",
      "type": "n8n-nodes-base.if",
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.confidence }}",
              "operation": "smaller",
              "value2": 0.7
            }
          ]
        }
      }
    },
    {
      "id": "handoff",
      "name": "Human handoff ticket",
      "type": "n8n-nodes-base.slack",
      "onError": "continueErrorOutput",
      "parameters": {
        "channel": "support",
        "text": "={{ $json.summary }}"
      }
    },
    {
      "id": "handoff-failure",
      "name": "Handoff failure stop",
      "type": "n8n-nodes-base.noOp",
      "parameters": {}
    },
    {
      "id": "failure-alert",
      "name": "Operator error alert",
      "type": "n8n-nodes-base.slack",
      "onError": "continueErrorOutput",
      "parameters": {
        "channel": "operations",
        "text": "Failure alert: {{ $json.error.message }}"
      }
    },
    {
      "id": "response",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json }}"
      }
    }
  ],
  "connections": {
    "Authenticated Webhook": {
      "main": [
        [
          {
            "node": "Claim idempotency event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Claim idempotency event": {
      "main": [
        [
          {
            "node": "Agent enabled kill switch",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Operator error alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent enabled kill switch": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Confidence gate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Confidence gate": {
      "main": [
        [
          {
            "node": "Human handoff ticket",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Human handoff ticket": {
      "main": [
        [],
        [
          {
            "node": "Operator error alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Operator error alert": {
      "main": [
        [],
        [
          {
            "node": "Handoff failure stop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionTimeout": 120
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Safe support agent. Uses postgres, agent, lmChatOpenAi, slack. Webhook trigger; 11 nodes.

Source: https://github.com/domfelipe/vibeflow-n8n/blob/4a4f103ddc96915e33ca8b051d51828c0c2dbe11/examples/safe-support-agent.workflow.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automates customer feedback processing by analyzing sentiment, identifying key issues, generating personalized responses, and escalating critical cases to support teams when required. De

Redis, Postgres, Agent +7
AI & RAG

This workflow automates inventory management and customer engagement for e-commerce businesses and retail operations managing multiple product categories. It solves the critical challenge of maintaini

Agent, OpenAI Chat, Output Parser Structured +3
AI & RAG

This workflow automates veterinary clinic operations and client communications for animal hospitals and veterinary practices managing appointments, inventory, and patient care. It solves the dual chal

HTTP Request, Agent, OpenAI Chat +4
AI & RAG

The system collects real-time wearable health data, normalizes it, and uses AI to analyze trends and risk scores. It detects anomalies by comparing with historical patterns and automatically triggers

Postgres, Agent, OpenAI Chat +7
AI & RAG

This workflow captures incoming leads from a webhook, enriches them using AI, and automates the entire sales pipeline. It validates data, scores leads as hot, warm, or cold, assigns them to sales reps

Agent, OpenAI Chat, Output Parser Structured +5