使用ChatGPT Vision分析可疑邮件内容
这是一个AI, SecOps领域的自动化工作流,包含 18 个节点。主要使用 Set, Code, Jira, HttpRequest, GmailTrigger 等节点,结合人工智能技术实现智能自动化。 使用ChatGPT Vision分析可疑邮件内容
- •可能需要目标 API 的认证凭证
- •Google 账号和 Gmail API 凭证
- •OpenAI API Key
{
"meta": {
"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"
},
"nodes": [
{
"id": "1bad6bfc-9ec9-48a5-b8f7-73c4de3d08cf",
"name": "Gmail 触发器",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
1480,
160
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "kkhNhqKpZt6IUZd0",
"name": " Gmail"
}
},
"typeVersion": 1.2
},
{
"id": "9ac747a1-4fd8-46ba-b4c1-75fd17aab2ed",
"name": "Microsoft Outlook 触发器",
"type": "n8n-nodes-base.microsoftOutlookTrigger",
"disabled": true,
"position": [
1480,
720
],
"parameters": {
"fields": [
"body",
"toRecipients",
"subject",
"bodyPreview"
],
"output": "fields",
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "vTCK0oVQ0WjFrI5H",
"name": " Outlook Credential"
}
},
"typeVersion": 1
},
{
"id": "5bf9b0e8-b84e-44a2-aad2-45dde3e4ab1b",
"name": "HTML 截图",
"type": "n8n-nodes-base.httpRequest",
"position": [
2520,
480
],
"parameters": {
"url": "https://hcti.io/v1/image",
"method": "POST",
"options": {},
"sendBody": true,
"sendQuery": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "html",
"value": "={{ $json.htmlBody }}"
}
]
},
"genericAuthType": "httpBasicAuth",
"queryParameters": {
"parameters": [
{}
]
}
},
"credentials": {
"httpBasicAuth": {
"id": "8tm8mUWmPvtmPFPk",
"name": "hcti.io"
}
},
"typeVersion": 4.2
},
{
"id": "fc770d1d-6c18-4d14-8344-1dc042464df6",
"name": "检索截图",
"type": "n8n-nodes-base.httpRequest",
"position": [
2700,
480
],
"parameters": {
"url": "={{ $json.url }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpBasicAuth"
},
"credentials": {
"httpBasicAuth": {
"id": "8tm8mUWmPvtmPFPk",
"name": "hcti.io"
}
},
"typeVersion": 4.2
},
{
"id": "2f3e5cc0-24e8-450a-898b-71e2d6f7bb58",
"name": "设置 Outlook 变量",
"type": "n8n-nodes-base.set",
"position": [
2020,
720
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
"name": "htmlBody",
"type": "string",
"value": "={{ $('Microsoft Outlook Trigger').item.json.body.content }}"
},
{
"id": "13bdd95b-ef02-486e-b38b-d14bd05a4a8a",
"name": "headers",
"type": "string",
"value": "={{ $json}}"
},
{
"id": "20566ad4-7eb7-42b1-8a0d-f8b759610f10",
"name": "subject",
"type": "string",
"value": "={{ $('Microsoft Outlook Trigger').item.json.subject }}"
},
{
"id": "7171998f-a5a2-4e23-946a-9c1ad75710e7",
"name": "recipient",
"type": "string",
"value": "={{ $('Microsoft Outlook Trigger').item.json.toRecipients[0].emailAddress.address }}"
},
{
"id": "cc262634-2470-4524-8319-abe2518a6335",
"name": "textBody",
"type": "string",
"value": "={{ $('Retrieve Headers of Email').item.json.body.content }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "374e5b16-a666-4706-9fd2-762b2927012d",
"name": "设置 Gmail 变量",
"type": "n8n-nodes-base.set",
"position": [
2040,
160
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "38bd3db2-1a8d-4c40-a2dd-336e0cc84224",
"name": "htmlBody",
"type": "string",
"value": "={{ $json.html }}"
},
{
"id": "18fbcf78-6d3c-4036-b3a2-fb5adf22176a",
"name": "headers",
"type": "string",
"value": "={{ $json.headers }}"
},
{
"id": "1d690098-be2a-4604-baf8-62f314930929",
"name": "subject",
"type": "string",
"value": "={{ $json.subject }}"
},
{
"id": "8009f00a-547f-4eb1-b52d-2e7305248885",
"name": "recipient",
"type": "string",
"value": "={{ $json.to.text }}"
},
{
"id": "1932e97d-b03b-4964-b8bc-8262aaaa1f7a",
"name": "textBody",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "3166738e-d0a3-475b-8b19-51afd519ee3a",
"name": "检索邮件标头",
"type": "n8n-nodes-base.httpRequest",
"position": [
1680,
720
],
"parameters": {
"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $json.id }}?$select=internetMessageHeaders,body",
"options": {},
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
},
{
"name": "Prefer",
"value": "outlook.body-content-type=\"text\""
}
]
},
"nodeCredentialType": "microsoftOutlookOAuth2Api"
},
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "vTCK0oVQ0WjFrI5H",
"name": " Outlook Credential"
}
},
"typeVersion": 4.2
},
{
"id": "25ae222c-088f-4565-98d6-803c8c1b0826",
"name": "格式化标头",
"type": "n8n-nodes-base.code",
"position": [
1860,
720
],
"parameters": {
"jsCode": "const input = $('Retrieve Headers of Email').item.json.internetMessageHeaders;\n\nconst result = input.reduce((acc, { name, value }) => {\n if (!acc[name]) acc[name] = [];\n acc[name].push(value);\n return acc;\n}, {});\n\nreturn result;"
},
"typeVersion": 2
},
{
"id": "8f14f267-1074-43ea-968d-26a6ab36fd7b",
"name": "设置邮件变量",
"type": "n8n-nodes-base.set",
"position": [
2360,
480
],
"parameters": {
"options": {},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "45d156aa-91f4-483c-91d4-c9de4a4f595d",
"name": "ChatGPT 分析",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
3100,
480
],
"parameters": {
"text": "=Describe this image. Determine if the email could be a phishing email. The message headers are as follows:\n{{ $('Set Email Variables').item.json.headers }}\n\nFormat the response for Jira who uses a wiki-style renderer. Do not include ``` around your response.",
"modelId": {
"__rl": true,
"mode": "list",
"value": "chatgpt-4o-latest",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"options": {
"maxTokens": 1500
},
"resource": "image",
"inputType": "base64",
"operation": "analyze"
},
"credentials": {
"openAiApi": {
"id": "76",
"name": "OpenAi account"
}
},
"typeVersion": 1.6
},
{
"id": "62ca591b-6627-496c-96a7-95cb0081480d",
"name": "创建 Jira 工单",
"type": "n8n-nodes-base.jira",
"position": [
3500,
480
],
"parameters": {
"project": {
"__rl": true,
"mode": "list",
"value": "10001",
"cachedResultName": "Support"
},
"summary": "=Phishing Email Reported: \"{{ $('Set Email Variables').item.json.subject }}\"",
"issueType": {
"__rl": true,
"mode": "list",
"value": "10008",
"cachedResultName": "Task"
},
"additionalFields": {
"description": "=A phishing email was reported by {{ $('Set Email Variables').item.json.recipient }} with the subject line \"{{ $('Set Email Variables').item.json.subject }}\" and body:\n{{ $('Set Email Variables').item.json.textBody }}\n\\\\\n\\\\\n\\\\\nh2. Here is ChatGPT's analysis of the email:\n{{ $json.content }}"
}
},
"credentials": {
"jiraSoftwareCloudApi": {
"id": "BZmmGUrNIsgM9fDj",
"name": "New Jira Cloud"
}
},
"typeVersion": 1
},
{
"id": "071380c8-8070-4f8f-86c6-87c4ee3bc261",
"name": "重命名截图",
"type": "n8n-nodes-base.code",
"position": [
3680,
480
],
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "$('Retrieve Screenshot').item.binary.data.fileName = 'emailScreenshot.png'\n\nreturn $('Retrieve Screenshot').item;"
},
"typeVersion": 2
},
{
"id": "05c57490-c1ee-48f0-9e38-244c9a995e22",
"name": "将邮件截图上传至 Jira",
"type": "n8n-nodes-base.jira",
"position": [
3860,
480
],
"parameters": {
"issueKey": "={{ $('Create Jira Ticket').item.json.key }}",
"resource": "issueAttachment"
},
"credentials": {
"jiraSoftwareCloudApi": {
"id": "BZmmGUrNIsgM9fDj",
"name": "New Jira Cloud"
}
},
"typeVersion": 1
},
{
"id": "be02770d-a943-41f5-98a9-5c433a6a3dbf",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
1420,
-107.36679523834897
],
"parameters": {
"color": 7,
"width": 792.3026315789474,
"height": 426.314163659402,
"content": ""
},
"typeVersion": 1
},
{
"id": "c1d2f691-669a-46de-9ef8-59ce4e6980c5",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1420,
380.6918768014301
],
"parameters": {
"color": 7,
"width": 792.3026315789474,
"height": 532.3344389880435,
"content": ""
},
"typeVersion": 1
},
{
"id": "c189e2e0-9f51-4bc0-a483-8b7f0528be70",
"name": "便签2",
"type": "n8n-nodes-base.stickyNote",
"position": [
2287.3684210526317,
46.18421052631584
],
"parameters": {
"color": 7,
"width": 580.4605263157906,
"height": 615.460526315789,
"content": ""
},
"typeVersion": 1
},
{
"id": "9076f9e9-f4fb-409a-9580-1ae459094c31",
"name": "便签3",
"type": "n8n-nodes-base.stickyNote",
"position": [
2880,
123.72476075009968
],
"parameters": {
"color": 7,
"width": 507.82894736842223,
"height": 537.9199760920052,
"content": ""
},
"typeVersion": 1
},
{
"id": "ca2488af-e787-4675-802a-8b4f2d845376",
"name": "便签4",
"type": "n8n-nodes-base.stickyNote",
"position": [
3400,
122.88662032580646
],
"parameters": {
"color": 7,
"width": 692.434210526317,
"height": 529.5475902005091,
"content": ""
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Gmail Trigger": {
"main": [
[
{
"node": "Set Gmail Variables",
"type": "main",
"index": 0
}
]
]
},
"Format Headers": {
"main": [
[
{
"node": "Set Outlook Variables",
"type": "main",
"index": 0
}
]
]
},
"Screenshot HTML": {
"main": [
[
{
"node": "Retrieve Screenshot",
"type": "main",
"index": 0
}
]
]
},
"ChatGPT Analysis": {
"main": [
[
{
"node": "Create Jira Ticket",
"type": "main",
"index": 0
}
]
]
},
"Rename Screenshot": {
"main": [
[
{
"node": "Upload Screenshot of Email to Jira",
"type": "main",
"index": 0
}
]
]
},
"Create Jira Ticket": {
"main": [
[
{
"node": "Rename Screenshot",
"type": "main",
"index": 0
}
]
]
},
"Retrieve Screenshot": {
"main": [
[
{
"node": "ChatGPT Analysis",
"type": "main",
"index": 0
}
]
]
},
"Set Email Variables": {
"main": [
[
{
"node": "Screenshot HTML",
"type": "main",
"index": 0
}
]
]
},
"Set Gmail Variables": {
"main": [
[
{
"node": "Set Email Variables",
"type": "main",
"index": 0
}
]
]
},
"Set Outlook Variables": {
"main": [
[
{
"node": "Set Email Variables",
"type": "main",
"index": 0
}
]
]
},
"Microsoft Outlook Trigger": {
"main": [
[
{
"node": "Retrieve Headers of Email",
"type": "main",
"index": 0
}
]
]
},
"Retrieve Headers of Email": {
"main": [
[
{
"node": "Format Headers",
"type": "main",
"index": 0
}
]
]
}
}
}如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 人工智能, 安全运维
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
Angel Menendez
@djangelicAngel Menendez is a Staff Developer Advocate at n8n.io, specializing in low-code tools for cybersecurity workflows. From Puerto Rico, Angel's tech journey began by helping his father translate technical books. He later started a web development business and transitioned from a career as a flight attendant to cybersecurity engineering. His workflows have saved companies significant time. Outside work, Angel enjoys time with his two sons, riding electric bikes, reading, and exploring new places.
分享此工作流