Contoh_Project / contoh_workflow.json
haidarnurudin's picture
contoh n8n project
4d18579 verified
{
"name": "My workflow",
"nodes": [
{
"parameters": {
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "title",
"cssSelector": "h4.artTitle",
"returnArray": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.html",
"typeVersion": 1.2,
"position": [
-2256,
16
],
"id": "",
"name": "HTML"
},
{
"parameters": {
"url": "https://market.bisnis.com/bursa-saham",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-2496,
16
],
"id": "",
"name": "HTTP Request Bursa dan Saham"
},
{
"parameters": {
"url": "https://market.bisnis.com/emas",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-2496,
224
],
"id": "",
"name": "HTTP Request Emas"
},
{
"parameters": {
"operation": "extractHtmlContent",
"extractionValues": {
"values": [
{
"key": "title",
"cssSelector": "h4.artTitle",
"returnArray": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.html",
"typeVersion": 1.2,
"position": [
-2256,
224
],
"id": "",
"name": "HTML1"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "",
"name": "category",
"value": "Bursa dan Saham",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-1792,
16
],
"id": "",
"name": "Edit Fields Bursa Saham"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "",
"name": "category",
"value": "Emas",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
-1792,
224
],
"id": "",
"name": "Edit Fields Emas"
},
{
"parameters": {
"jsCode": "const now = new Date();\nconst formattedDate = now.toLocaleDateString(\"id-ID\", {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric'\n});\n\nreturn items.map(item => ({\n json: {\n ...item.json,\n date: formattedDate\n }\n}));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1568,
16
],
"id": "",
"name": "Code"
},
{
"parameters": {
"jsCode": "const now = new Date();\nconst formattedDate = now.toLocaleDateString(\"id-ID\", {\n day: '2-digit',\n month: '2-digit',\n year: 'numeric'\n});\n\nreturn items.map(item => ({\n json: {\n ...item.json,\n date: formattedDate\n }\n}));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1568,
224
],
"id": "",
"name": "Code1"
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
-1344,
128
],
"id": "",
"name": "Merge"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.prompt }}",
"batching": {}
},
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.7,
"position": [
-816,
128
],
"id": "",
"name": "Basic LLM Chain"
},
{
"parameters": {
"modelName": "models/gemini-2.5-flash-lite",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-848,
288
],
"id": "",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"id": "",
"name": ""
}
}
},
{
"parameters": {
"jsCode": "let text = items[0].json.candidates?.[0]?.content?.parts?.[0]?.text ?? items[0].json.text;\n\n// Remove ```json and ``` if present\ntext = text.replace(/```json\\s*|\\s*```/g, '').trim();\n\n// Parse cleaned JSON string\nconst parsed = JSON.parse(text);\n\nreturn parsed.map(entry => ({\n json: entry\n}));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-464,
128
],
"id": "",
"name": "Code4"
},
{
"parameters": {
"jsCode": "return items[0].json.title.map(t => ({\n json: {\n title: t\n }\n}));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1984,
16
],
"id": "",
"name": "Code Mapping"
},
{
"parameters": {
"jsCode": "return items[0].json.title.map(t => ({\n json: {\n title: t\n }\n}));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1984,
224
],
"id": "",
"name": "Code Mapping1"
},
{
"parameters": {
"jsCode": "const headlines = items.map((item, index) => {\n return {\n title: item.json.title,\n category: item.json.category,\n date: item.json.date\n };\n});\n\nconst promptLines = headlines.map((h, i) => {\n return `${i + 1}. \"${h.title}\" [${h.category}] (${h.date})`;\n});\n\nconst prompt = `Classify the sentiment (Positive, Negative, Neutral) for each of the following financial news headlines.\n\nReturn as a JSON array like this:\n[\n { \"title\": \"...\", \"category\": \"...\", \"date\": \"...\", \"sentiment\": \"...\" },\n ...\n]\n\nHeadlines:\n${promptLines.join('\\n')}\n`;\n\nreturn [{\n json: {\n prompt\n }\n}];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-992,
128
],
"id": "",
"name": "Prompt Machine"
},
{
"parameters": {
"jsCode": "const seen = new Set();\n\nconst filtered = items.filter(item => {\n const title = item.json.title?.trim();\n if (!title) return false;\n\n // Skip \"PREMIUM NOTES\"\n if (title.toLowerCase().includes(\"premium notes\")) return false;\n\n // Skip duplicates\n if (seen.has(title)) return false;\n\n seen.add(title);\n return true;\n});\n\nreturn filtered;\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1168,
128
],
"id": "",
"name": "Data Cleaning"
},
{
"parameters": {
"rule": {
"interval": [
{}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
-2768,
128
],
"id": "",
"name": "Schedule Trigger"
},
{
"parameters": {
"operation": "xlsx",
"binaryPropertyName": "Saham Positif / Beli",
"options": {}
},
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
0,
0
],
"id": "",
"name": "Convert to File"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "",
"leftValue": "={{ $json.sentiment }}",
"rightValue": "=Positive",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-224,
16
],
"id": "",
"name": "If"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "",
"leftValue": "={{ $json.sentiment }}",
"rightValue": "Neutral",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-224,
176
],
"id": "",
"name": "If1"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "",
"leftValue": "={{ $json.sentiment }}",
"rightValue": "Negative",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
-208,
320
],
"id": "",
"name": "If2"
},
{
"parameters": {
"operation": "xlsx",
"binaryPropertyName": "Saham Netral / Hold",
"options": {}
},
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
0,
160
],
"id": "",
"name": "Convert to File1"
},
{
"parameters": {
"operation": "xlsx",
"binaryPropertyName": "Saham Negatif / Jual",
"options": {}
},
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
0,
304
],
"id": "",
"name": "Convert to File2"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.text }}",
"messages": {
"messageValues": [
{
"message": "buatkan artikel (summary) dengan judul dalam 6 paragraf dari keseluruhan data ini.\n\nnegative prompt = hindari kata \"Tentu, berikut adalah ringkasan dalam enam paragraf dari data yang Anda berikan\" dan sejenisnya.\n\nlangsung ke judul dan isi artikel"
}
]
},
"batching": {}
},
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.7,
"position": [
-576,
592
],
"id": "",
"name": "Basic LLM Chain1"
},
{
"parameters": {
"modelName": "models/gemini-2.5-flash-lite",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
-576,
768
],
"id": "",
"name": "Google Gemini Chat Model1",
"credentials": {
"googlePalmApi": {
"id": "",
"name": ""
}
}
}
],
"pinData": {},
"connections": {
"HTTP Request Bursa dan Saham": {
"main": [
[
{
"node": "HTML",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request Emas": {
"main": [
[
{
"node": "HTML1",
"type": "main",
"index": 0
}
]
]
},
"HTML": {
"main": [
[
{
"node": "Code Mapping",
"type": "main",
"index": 0
}
]
]
},
"HTML1": {
"main": [
[
{
"node": "Code Mapping1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields Emas": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields Bursa Saham": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Data Cleaning",
"type": "main",
"index": 0
}
]
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "Code4",
"type": "main",
"index": 0
},
{
"node": "Basic LLM Chain1",
"type": "main",
"index": 0
}
]
]
},
"Code4": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
},
{
"node": "If1",
"type": "main",
"index": 0
},
{
"node": "If2",
"type": "main",
"index": 0
}
]
]
},
"Code Mapping": {
"main": [
[
{
"node": "Edit Fields Bursa Saham",
"type": "main",
"index": 0
}
]
]
},
"Code Mapping1": {
"main": [
[
{
"node": "Edit Fields Emas",
"type": "main",
"index": 0
}
]
]
},
"Prompt Machine": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
},
"Data Cleaning": {
"main": [
[
{
"node": "Prompt Machine",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "HTTP Request Bursa dan Saham",
"type": "main",
"index": 0
},
{
"node": "HTTP Request Emas",
"type": "main",
"index": 0
}
]
]
},
"If": {
"main": [
[
{
"node": "Convert to File",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "Convert to File1",
"type": "main",
"index": 0
}
]
]
},
"If2": {
"main": [
[
{
"node": "Convert to File2",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Basic LLM Chain1": {
"main": [
[]
]
},
"Convert to File": {
"main": [
[]
]
},
"Convert to File1": {
"main": [
[]
]
},
"Convert to File2": {
"main": [
[]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "",
"meta": {
"instanceId": ""
},
"id": "",
"tags": []
}