{
	"name": "Lentra: new Polish public tenders to Slack",
	"nodes": [
		{
			"id": "b1f0c6a2-0001-4c55-9d7e-2a1f00000001",
			"name": "Sticky Note",
			"type": "n8n-nodes-base.stickyNote",
			"typeVersion": 1,
			"position": [-460, -260],
			"parameters": {
				"content": "## New Polish public tenders from Lentra to Slack\n\nEvery hour this workflow asks Lentra for open public tenders that match your company's search profile and posts each new one to a Slack channel.\n\nLentra (lentra.pl) checks BZP, TED and Baza Konkurencyjności every hour, reads the full tender documentation and matches tenders to your scope of work. Sign in with your Lentra account.\n\n### Setup\n1. In **Settings**, set `workspace` to your Lentra workspace slug: the part after `/app/w/` in the Lentra app URL.\n2. In **Lentra: search tenders**, create an **MCP OAuth2** credential: Server URL `https://app.lentra.pl/mcp`, **Register Client Automatically** on. Click **Connect my account** and sign in with your Lentra account.\n3. In **Slack**, pick your Slack credential and channel.\n\nThe first run posts the 25 newest tenders. Each later run posts the new ones.\n\nBy default Lentra searches your workspace's first search profile. To pick another, add `profileId` with a `profile_id` from the `get_workspace` tool.",
				"height": 620,
				"width": 400
			}
		},
		{
			"id": "b1f0c6a2-0002-4c55-9d7e-2a1f00000002",
			"name": "Every hour",
			"type": "n8n-nodes-base.scheduleTrigger",
			"typeVersion": 1.2,
			"position": [0, 0],
			"parameters": {
				"rule": {
					"interval": [
						{
							"field": "hours",
							"hoursInterval": 1
						}
					]
				}
			}
		},
		{
			"id": "b1f0c6a2-0003-4c55-9d7e-2a1f00000003",
			"name": "Settings",
			"type": "n8n-nodes-base.set",
			"typeVersion": 3.4,
			"position": [220, 0],
			"parameters": {
				"mode": "manual",
				"assignments": {
					"assignments": [
						{
							"id": "b1f0c6a2-1001-4c55-9d7e-2a1f00000001",
							"name": "workspace",
							"value": "",
							"type": "string"
						}
					]
				},
				"options": {}
			}
		},
		{
			"id": "b1f0c6a2-0004-4c55-9d7e-2a1f00000004",
			"name": "Lentra: search tenders",
			"type": "@n8n/n8n-nodes-langchain.mcpClient",
			"typeVersion": 1.1,
			"position": [440, 0],
			"parameters": {
				"endpointUrl": "https://app.lentra.pl/mcp",
				"authentication": "mcpOAuth2Api",
				"tool": {
					"__rl": true,
					"mode": "id",
					"value": "search_procurements"
				},
				"inputMode": "json",
				"jsonInput": "={{ JSON.stringify({ workspace: $json.workspace, sort: 'newest', limit: 25 }) }}",
				"options": {}
			}
		},
		{
			"id": "b1f0c6a2-0005-4c55-9d7e-2a1f00000005",
			"name": "Rows from result",
			"type": "n8n-nodes-base.code",
			"typeVersion": 2,
			"position": [660, 0],
			"parameters": {
				"jsCode": "const workspace = $('Settings').first().json.workspace;\nconst rows = [];\nfor (const item of $input.all()) {\n\tconst text = (item.json.content ?? [])\n\t\t.filter((part) => part.type === 'text')\n\t\t.map((part) => part.text)\n\t\t.join('\\n');\n\tconst lines = text.split('\\n');\n\tconst start = lines.indexOf('## items');\n\tif (start === -1) continue;\n\tconst header = lines[start + 1].split('\\t');\n\tfor (const line of lines.slice(start + 2)) {\n\t\tif (line.trim() === '' || line.startsWith('#')) break;\n\t\tconst cells = line.split('\\t');\n\t\tconst row = Object.fromEntries(header.map((name, i) => [name, cells[i] ?? '']));\n\t\trow.url = `https://app.lentra.pl/app/w/${encodeURIComponent(workspace)}/procurements/${encodeURIComponent(row.pid)}`;\n\t\trows.push({ json: row });\n\t}\n}\nreturn rows;\n"
			}
		},
		{
			"id": "b1f0c6a2-0006-4c55-9d7e-2a1f00000006",
			"name": "Only new",
			"type": "n8n-nodes-base.removeDuplicates",
			"typeVersion": 2,
			"position": [880, 0],
			"parameters": {
				"operation": "removeItemsSeenInPreviousExecutions",
				"dedupeValue": "={{ $json.pid }}",
				"options": {}
			}
		},
		{
			"id": "b1f0c6a2-0007-4c55-9d7e-2a1f00000007",
			"name": "Slack: team channel",
			"type": "n8n-nodes-base.slack",
			"typeVersion": 2.3,
			"position": [1100, 0],
			"parameters": {
				"select": "channel",
				"channelId": {
					"__rl": true,
					"mode": "name",
					"value": "#tenders"
				},
				"text": "=*{{ $json.title }}*\n{{ $json.buyer }} · deadline: {{ $json.deadline }}\n{{ $json.overview }}\n<{{ $json.url }}|Open in Lentra>",
				"otherOptions": {}
			}
		}
	],
	"connections": {
		"Every hour": {
			"main": [
				[
					{
						"node": "Settings",
						"type": "main",
						"index": 0
					}
				]
			]
		},
		"Settings": {
			"main": [
				[
					{
						"node": "Lentra: search tenders",
						"type": "main",
						"index": 0
					}
				]
			]
		},
		"Lentra: search tenders": {
			"main": [
				[
					{
						"node": "Rows from result",
						"type": "main",
						"index": 0
					}
				]
			]
		},
		"Rows from result": {
			"main": [
				[
					{
						"node": "Only new",
						"type": "main",
						"index": 0
					}
				]
			]
		},
		"Only new": {
			"main": [
				[
					{
						"node": "Slack: team channel",
						"type": "main",
						"index": 0
					}
				]
			]
		}
	},
	"settings": {
		"executionOrder": "v1"
	},
	"pinData": {},
	"meta": {
		"templateCredsSetupCompleted": false
	}
}
