Skip to content

Instantly share code, notes, and snippets.

@AswinBehera
Last active September 1, 2025 12:16
Show Gist options
  • Select an option

  • Save AswinBehera/b9f972800aa7d0b24f55180c70b9ef8d to your computer and use it in GitHub Desktop.

Select an option

Save AswinBehera/b9f972800aa7d0b24f55180c70b9ef8d to your computer and use it in GitHub Desktop.
{
"name": "My workflow",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-32,
-192
],
"id": "efe4d58f-e4f8-4aeb-9504-cdf8e373bdc6",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"text": "={{ $json.body }}",
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": { \"type\": \"string\" },\n \"releaseDate\": { \"type\": \"string\" },\n \"steamLink\": { \"type\": \"string\" },\n \"steamAppId\": { \"type\": \"string\" }\n },\n \"required\": [\"title\", \"steamLink\", \"steamAppId\"]\n }\n}",
"options": {
"systemPromptTemplate": "Extract ALL game entries from this HTML page. \nFor each game, return a JSON object with:\n- title: the game’s name\n- releaseDate: the release date shown\n- steamLink: the full Steam URL\n- steamAppId: the numeric AppID parsed from the steamLink (/app/<id>/)\n\nReturn the result as a JSON array."
}
},
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"typeVersion": 1.2,
"position": [
464,
0
],
"id": "4cb2ff01-0812-4c1f-9d36-d416ef39bcb4",
"name": "Information Extractor"
},
{
"parameters": {
"modelName": "models/gemini-1.5-flash-8b-latest",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
400,
208
],
"id": "138543da-3e5f-4023-b75b-c4698525fc0a",
"name": "Google Gemini Chat Model",
"credentials": {
"googlePalmApi": {
"id": "d6XC9ZsqGhFt03lL",
"name": "Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nreturn $json.output.map(game => ({\n json: game\n}));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
816,
0
],
"id": "c0cd1831-5058-4cea-b403-0794fc14d227",
"name": "Code"
},
{
"parameters": {
"url": "=https://api.steampowered.com/ISteamUserStats/GetNumberOfCurrentPlayers/v1/?appid={{ $json.steamAppId }}\n",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1024,
-96
],
"id": "aa29391e-2d93-4891-8427-a9bf8c1d903b",
"name": "Get Player Count"
},
{
"parameters": {
"url": "=https://store.steampowered.com/appreviews/{{$json.steamAppId}}?json=1&filter=recent&language=english&num_per_page=0",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1024,
80
],
"id": "999cc624-6dea-4ad4-bb96-489cafa87ead",
"name": "Get Review Count"
},
{
"parameters": {
"zone": {
"__rl": true,
"mode": "list",
"value": "web_unlocker1"
},
"country": {
"__rl": true,
"mode": "list",
"value": "us"
},
"url": "https://store.steampowered.com/search/?filter=popularnew&sort_by=Released_DESC&os=win",
"format": "json",
"requestOptions": {}
},
"type": "@brightdata/n8n-nodes-brightdata.brightData",
"typeVersion": 1,
"position": [
256,
0
],
"id": "4f5370c2-0848-4273-ad44-e4e2af034713",
"name": "Extract New and Popular games from Steam List",
"credentials": {
"brightdataApi": {
"id": "TBF5rnN7kHTkWzeU",
"name": "BrightData account"
}
}
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"numberInputs": 3,
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1264,
-48
],
"id": "e7cc2bf6-110d-42ef-829e-b835018f5e65",
"name": "Merge"
},
{
"parameters": {
"jsCode": "// weighting: 70% playerCount, 20% reviews, 10% reviewScore\n// tweak weights as needed\n\nconst ranked = items\n .map(item => {\n const data = item.json;\n\n const playerCount = data.response?.player_count || 0;\n const totalReviews = data.query_summary?.total_reviews || 0;\n const reviewScore = data.query_summary?.review_score || 0;\n\n // popularity formula\n const popularity =\n (playerCount * 0.7) +\n (totalReviews * 0.2) +\n (reviewScore * 100);\n\n return {\n steamAppId: data.steamAppId,\n title: data.title,\n releaseDate: data.releaseDate,\n steamLink: data.steamLink,\n playerCount,\n reviewScore,\n reviewScoreDesc: data.query_summary?.review_score_desc || \"\",\n totalPositive: data.query_summary?.total_positive || 0,\n totalNegative: data.query_summary?.total_negative || 0,\n totalReviews,\n popularity\n };\n })\n // sort by popularity\n .sort((a, b) => b.popularity - a.popularity)\n // add rank\n .map((game, idx) => ({\n ...game,\n rank: idx + 1\n }));\n\n// n8n needs an array of { json: {...} }\nreturn ranked.map(game => ({ json: game }));\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1472,
-48
],
"id": "c1b80e9b-1edf-474a-b46b-913521fb5473",
"name": "Sorted based on a weighted popularity formula"
},
{
"parameters": {
"promptType": "define",
"text": "={{ $json.messages[1].content }}",
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 2.2,
"position": [
1888,
-48
],
"id": "f6e8ac84-20cd-4dbf-b9ab-776d825a0962",
"name": "AI Agent"
},
{
"parameters": {
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"typeVersion": 1,
"position": [
1760,
160
],
"id": "77adb6d4-c45f-4cd6-ac68-608b2069e8ab",
"name": "Google Gemini Chat Model1",
"credentials": {
"googlePalmApi": {
"id": "d6XC9ZsqGhFt03lL",
"name": "Google Gemini(PaLM) Api account"
}
}
},
{
"parameters": {
"sessionIdType": "customKey",
"sessionKey": "={{ $json.steamAppId }}"
},
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"typeVersion": 1.3,
"position": [
1904,
160
],
"id": "ab51e624-fdf1-451d-80e3-bde2507cc191",
"name": "Simple Memory"
},
{
"parameters": {
"url": "=https://store.steampowered.com/appreviews/{{$json.steamAppId}}?json=1&filter=all&review_type=positive&day_range=30&language=english&num_per_page=10\n",
"options": {}
},
"type": "n8n-nodes-base.httpRequestTool",
"typeVersion": 4.2,
"position": [
2048,
160
],
"id": "60245ac5-10c1-460c-8ce3-ac102d80b2dc",
"name": "HTTP Request"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
2224,
-256
],
"id": "ecc474c4-5a5e-4978-bf31-97e58e5e37b4",
"name": "Merge1"
},
{
"parameters": {
"jsCode": "return items.map(item => {\n const g = item.json;\n\n return {\n json: {\n steamAppId: g.steamAppId,\n title: g.title,\n rank: g.rank,\n messages: [\n {\n role: \"system\",\n content: \"You are an expert analyst of Steam games, reviews, and community chatter. Your goal is to identify what themes players are likely discussing, any risks or complaints, and why the game resonates with audiences.\"\n },\n {\n role: \"user\",\n content: `Game: ${g.title} (${g.releaseDate})\nSteam Link: ${g.steamLink}\nCurrent Players: ${g.playerCount}\nReviews: ${g.totalReviews} (${g.reviewScoreDesc})\n\nAs an AI analyst, tell me:\n1. What are players most likely talking about for this game?\n2. Any risks or common complaints that might appear in reviews or discussions?\n3. Why might this game be resonating right now?`\n }\n ]\n }\n };\n});\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1680,
-48
],
"id": "e4c5531f-4c6d-4496-ab28-54d8efbdc7e6",
"name": "Prompt Ready"
},
{
"parameters": {
"jsCode": "function chunkText(text, size = 2000) {\n const chunks = [];\n let i = 0;\n while (i < text.length) {\n chunks.push(text.slice(i, i + size));\n i += size;\n }\n return chunks;\n}\n\nreturn items.map(item => {\n const data = item.json;\n\n // Metadata block\n const meta = `Steam App ID: ${data.steamAppId}\nRelease Date: ${data.releaseDate}\nSteam Link: ${data.steamLink}\nPlayers: ${data.playerCount}\nReviews: ${data.totalReviews} (${data.reviewScoreDesc})\n\n---`;\n\n // Split AI analysis text into chunks\n const analysisChunks = chunkText(data.output || \"\");\n\n // Convert chunks into paragraph blocks\n const analysisBlocks = analysisChunks.map(chunk => ({\n object: \"block\",\n type: \"paragraph\",\n paragraph: {\n rich_text: [\n {\n text: { content: chunk }\n }\n ]\n }\n }));\n\n // First block with metadata\n const children = [\n {\n object: \"block\",\n type: \"paragraph\",\n paragraph: {\n rich_text: [\n {\n text: { content: meta }\n }\n ]\n }\n },\n ...analysisBlocks\n ];\n\n return {\n json: {\n parent: { page_id: \"<YOUR_PARENT_PAGE_ID>\" }, // or database_id\n properties: {\n title: {\n title: [{ text: { content: data.title || \"Untitled Game\" } }]\n }\n },\n children\n }\n };\n});\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2432,
-256
],
"id": "c91daea0-1205-4914-9795-b82d57d722ec",
"name": "Code1"
},
{
"parameters": {
"pageId": {
"__rl": true,
"value": "261f7ec0b23880bfac7dd9fb1fd9afc2",
"mode": "id"
},
"title": "={{ $json.properties.title.title[0].text.content }}",
"blockUi": {
"blockValues": [
{
"richText": true,
"text": {
"text": [
{
"text": "={{ $json.children[0].paragraph.rich_text[0].text.content }}",
"annotationUi": {}
}
]
}
},
{
"richText": true,
"text": {
"text": [
{
"text": "={{ $json.children[1].paragraph.rich_text[0].text.content }}",
"annotationUi": {}
}
]
}
},
{
"richText": true,
"text": {
"text": [
{
"text": "={{ $json.children[2].paragraph.rich_text[0].text.content }}",
"annotationUi": {}
}
]
}
},
{
"richText": true,
"text": {
"text": [
{
"text": "={{ $json.children[3]?.paragraph?.rich_text[0]?.text?.content || \"\" }}\n",
"annotationUi": {}
}
]
}
}
]
},
"options": {}
},
"type": "n8n-nodes-base.notion",
"typeVersion": 2.2,
"position": [
2640,
-256
],
"id": "0c49e3f9-9612-4845-a152-9a2e05f63719",
"name": "Create a page",
"credentials": {
"notionApi": {
"id": "JYOlekQqaeKeV7gn",
"name": "Notion account"
}
}
},
{
"parameters": {
"rule": {
"interval": [
{
"field": "weeks",
"triggerAtHour": 6
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
-16,
0
],
"id": "26d8ede6-ba8e-469b-92dc-e403cab413d7",
"name": "Schedule Trigger"
}
],
"pinData": {},
"connections": {
"When clicking ‘Execute workflow’": {
"main": [
[]
]
},
"Google Gemini Chat Model": {
"ai_languageModel": [
[
{
"node": "Information Extractor",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Information Extractor": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Get Player Count",
"type": "main",
"index": 0
},
{
"node": "Get Review Count",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Extract New and Popular games from Steam List": {
"main": [
[
{
"node": "Information Extractor",
"type": "main",
"index": 0
}
]
]
},
"Get Player Count": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Get Review Count": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 2
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Sorted based on a weighted popularity formula",
"type": "main",
"index": 0
}
]
]
},
"Sorted based on a weighted popularity formula": {
"main": [
[
{
"node": "Prompt Ready",
"type": "main",
"index": 0
},
{
"node": "Merge1",
"type": "main",
"index": 0
}
]
]
},
"Google Gemini Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"HTTP Request": {
"ai_tool": [
[
{
"node": "AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "Merge1",
"type": "main",
"index": 1
}
]
]
},
"Prompt Ready": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Merge1": {
"main": [
[
{
"node": "Code1",
"type": "main",
"index": 0
}
]
]
},
"Code1": {
"main": [
[
{
"node": "Create a page",
"type": "main",
"index": 0
}
]
]
},
"Schedule Trigger": {
"main": [
[
{
"node": "Extract New and Popular games from Steam List",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "2424298e-ca45-409a-8897-e96bb5e28754",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "ac971950c7bd0b406a74c6e313e4e245db41b43e5f2105ea06985894d29680c5"
},
"id": "WRHep3UHzCFM2Ytm",
"tags": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment