Validate AI answers with Google search, OpenAI GPT-4, Slack and Gmail alerts
Ready for 3.0What this workflow does
This AI workflow has 11 nodes and runs when an HTTP POST request hits its webhook URL. Along the way it connects OpenAI, Slack and Gmail.
How it runs
Trigger: When an HTTP POST request hits its webhook URL.
- Extract Question & Answer (Edit Fields (Set)): sets 2 fields: Question, Answer
- Search Answer on Google (HTTP Request): calls an HTTP API (POST)
- Prepare Search Results for AI (Code): runs custom JavaScript code
- Check Answer with AI (OpenAI): uses OpenAI
- Calculate Risk Level (Code): runs custom JavaScript code
- Convert AI Response to Data (Code): runs custom JavaScript code
- Decide Action Based on Risk (Switch): routes items into 3 branches
- Send Final Response (Respond to Webhook): sends the response back to the webhook caller
- Send Suspicious Alert to Slack (Slack): uses Slack
- Send Critical Alert (Gmail): uses Gmail
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (9)
- Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - OpenAI
@n8n/n8n-nodes-langchain.openAi - Switch
n8n-nodes-base.switch - Slack
n8n-nodes-base.slack - Gmail
n8n-nodes-base.gmail - Respond to Webhook
n8n-nodes-base.respondToWebhook
From the author
Quick overview This workflow receives an AI-generated Q&A via webhook, searches the web for supporting sources, and uses OpenAI to score and classify the answer as SAFE, SUSPICIOUS, or HALLUCINATED, then alerts via Slack or Gmail and returns a response to the…