|
| 1 | +{ |
| 2 | + "name": "Spam Ticket Identification Flow", |
| 3 | + "nodes": [ |
| 4 | + { |
| 5 | + "parameters": { |
| 6 | + "httpMethod": "POST", |
| 7 | + "path": "helpdesk/check-spam/", |
| 8 | + "options": { |
| 9 | + "rawBody": true |
| 10 | + } |
| 11 | + }, |
| 12 | + "type": "n8n-nodes-base.webhook", |
| 13 | + "typeVersion": 2, |
| 14 | + "position": [-1264, 80], |
| 15 | + "id": "960d09d1-c2a3-4710-9c9a-07aa0cd3f795", |
| 16 | + "name": "Webhook", |
| 17 | + "webhookId": "da674dc0-4dc8-4ed6-a51d-59afff4272e2" |
| 18 | + }, |
| 19 | + { |
| 20 | + "parameters": { |
| 21 | + "conditions": { |
| 22 | + "options": { |
| 23 | + "caseSensitive": true, |
| 24 | + "leftValue": "", |
| 25 | + "typeValidation": "strict", |
| 26 | + "version": 2 |
| 27 | + }, |
| 28 | + "conditions": [ |
| 29 | + { |
| 30 | + "id": "99e8601c-e16b-4df6-9df9-f445ec130db8", |
| 31 | + "leftValue": "={{ JSON.parse($json.message.content).is_spam }}", |
| 32 | + "rightValue": "", |
| 33 | + "operator": { |
| 34 | + "type": "boolean", |
| 35 | + "operation": "true", |
| 36 | + "singleValue": true |
| 37 | + } |
| 38 | + } |
| 39 | + ], |
| 40 | + "combinator": "and" |
| 41 | + }, |
| 42 | + "options": {} |
| 43 | + }, |
| 44 | + "type": "n8n-nodes-base.if", |
| 45 | + "typeVersion": 2.2, |
| 46 | + "position": [-688, 80], |
| 47 | + "id": "982df316-3690-434c-85fa-c0c1da46dfdb", |
| 48 | + "name": "If" |
| 49 | + }, |
| 50 | + { |
| 51 | + "parameters": { |
| 52 | + "modelId": { |
| 53 | + "__rl": true, |
| 54 | + "value": "gpt-4o-mini", |
| 55 | + "mode": "list", |
| 56 | + "cachedResultName": "GPT-4O-MINI" |
| 57 | + }, |
| 58 | + "messages": { |
| 59 | + "values": [ |
| 60 | + { |
| 61 | + "content": "You are a strict Spam Detection Officer for an Odoo/IT Helpdesk.\n Your task is to analyze the incoming ticket description and determine whether it is spam.\nCRITERIA FOR SPAM — Return true when ANY of these is detected:\n1. SEO, marketing, backlink, or website ranking service offers.\n2. Unrelated service promotions (web design, mobile apps, logo design, copywriting, outsourcing not related to our project).\n3. Suspicious links, shortened URLs without context, or phishing-like messages.\n4. Bulk-generated outreach messages (generic, not referencing Odoo/IT context).\n5. Nonsense text, random characters, or obviously AI-generated gibberish.\n6. Messages unrelated to IT, Odoo, ERP, or our provided services.\nCRITERIA FOR HAM — Return false:\n1. Issues or questions related to Odoo, modules, customization, bugs, deployments, or integration.\n2. Questions about invoices, access, accounts, or contract-related matters.\n3. Complaints, feedback, or feature requests.\n4. Any message that resembles a genuine support request from a human.\nOUTPUT FORMAT:\nStrictly return a JSON object with this structure:\n{\n \"is_spam\": boolean,\n \"reason\": \"Short explanation why this is spam (max 1 sentence)\",\n \"confidence\": \"Estimation from 0% to 100% (e.g. '98%')\"\n}\nExample: {\"is_spam\": true, \"reason\": \"Mentions prohibited drugs (Viagra).\", \"confidence\": \"99%\"}", |
| 62 | + "role": "system" |
| 63 | + }, |
| 64 | + { |
| 65 | + "content": "={{ $json.body.record.display_name}} - {{ $json.body.record.description }}" |
| 66 | + } |
| 67 | + ] |
| 68 | + }, |
| 69 | + "options": {} |
| 70 | + }, |
| 71 | + "type": "@n8n/n8n-nodes-langchain.openAi", |
| 72 | + "typeVersion": 1.8, |
| 73 | + "position": [-1056, 80], |
| 74 | + "id": "e431b723-d2a4-4d3c-a8ae-420584da691c", |
| 75 | + "name": "Message a model", |
| 76 | + "credentials": { |
| 77 | + "openAiApi": { |
| 78 | + "id": "t7lm95Kw7wmoj4xt", |
| 79 | + "name": "OpenAi account 2" |
| 80 | + } |
| 81 | + } |
| 82 | + }, |
| 83 | + { |
| 84 | + "parameters": { |
| 85 | + "method": "POST", |
| 86 | + "url": "={{$('Webhook').item.json.body._response_url}}", |
| 87 | + "sendBody": true, |
| 88 | + "specifyBody": "json", |
| 89 | + "jsonBody": "={{$json.message.content}}", |
| 90 | + "options": {} |
| 91 | + }, |
| 92 | + "type": "n8n-nodes-base.httpRequest", |
| 93 | + "typeVersion": 4.2, |
| 94 | + "position": [-432, -32], |
| 95 | + "id": "a9e87afa-4907-436e-a241-f63c964af12b", |
| 96 | + "name": "HTTP Request", |
| 97 | + "alwaysOutputData": false |
| 98 | + } |
| 99 | + ], |
| 100 | + "pinData": {}, |
| 101 | + "connections": { |
| 102 | + "Webhook": { |
| 103 | + "main": [ |
| 104 | + [ |
| 105 | + { |
| 106 | + "node": "Message a model", |
| 107 | + "type": "main", |
| 108 | + "index": 0 |
| 109 | + } |
| 110 | + ] |
| 111 | + ] |
| 112 | + }, |
| 113 | + "Message a model": { |
| 114 | + "main": [ |
| 115 | + [ |
| 116 | + { |
| 117 | + "node": "If", |
| 118 | + "type": "main", |
| 119 | + "index": 0 |
| 120 | + } |
| 121 | + ] |
| 122 | + ] |
| 123 | + }, |
| 124 | + "If": { |
| 125 | + "main": [ |
| 126 | + [ |
| 127 | + { |
| 128 | + "node": "HTTP Request", |
| 129 | + "type": "main", |
| 130 | + "index": 0 |
| 131 | + } |
| 132 | + ] |
| 133 | + ] |
| 134 | + } |
| 135 | + }, |
| 136 | + "active": false, |
| 137 | + "settings": { |
| 138 | + "executionOrder": "v1" |
| 139 | + }, |
| 140 | + "versionId": "d7f051a5-c962-44b6-87b1-54441763efef", |
| 141 | + "meta": { |
| 142 | + "templateCredsSetupCompleted": true, |
| 143 | + "instanceId": "95483db1596026047067fce31863479f616aaf310d370d2a94b0e438c3495911" |
| 144 | + }, |
| 145 | + "id": "fWYne7mmDfzimDWd", |
| 146 | + "tags": [] |
| 147 | +} |
0 commit comments