Skip to content

Instantly share code, notes, and snippets.

@that-one-tom
Created May 18, 2025 08:01
Show Gist options
  • Select an option

  • Save that-one-tom/1d4f30d29aa224bcd7869c03b7ebd47a to your computer and use it in GitHub Desktop.

Select an option

Save that-one-tom/1d4f30d29aa224bcd7869c03b7ebd47a to your computer and use it in GitHub Desktop.
An AI-powered n8n workflow to hype me up for my next trip
{
"nodes": [
{
"parameters": {
"rule": {
"interval": [
{
"field": "cronExpression",
"expression": "0 7 * * *"
}
]
}
},
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
220,
-40
],
"id": "bcb3ca1b-d9d0-4e4e-bcdf-45be402379ce",
"name": "Schedule Trigger"
},
{
"parameters": {
"operation": "getTimeBetweenDates",
"startDate": "={{ $today }}",
"endDate": "2025-05-27",
"outputFieldName": "days_left",
"options": {}
},
"type": "n8n-nodes-base.dateTime",
"typeVersion": 2,
"position": [
440,
-40
],
"id": "03520e7b-88d3-4d27-94fc-26283ace480e",
"name": "Calc days left"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "da584bb2-8644-451a-913d-7063c54218a8",
"leftValue": "={{ $json.output.keys() }}",
"rightValue": "name",
"operator": {
"type": "array",
"operation": "contains",
"rightType": "any"
}
},
{
"id": "38457925-35eb-4007-9f4e-f28534cc5c1d",
"leftValue": "={{ $json.output.keys() }}",
"rightValue": "description",
"operator": {
"type": "array",
"operation": "contains",
"rightType": "any"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
1320,
-180
],
"id": "df094011-c10b-4450-80a4-5764747f5487",
"name": "Response has expected properties?"
},
{
"parameters": {
"url": "https://api.bing.microsoft.com/v7.0/search",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "={{ $('Valid result').item.json.output.name }} Official Website"
},
{
"name": "mkt",
"value": "de-DE"
}
]
},
"options": {}
},
"id": "c0fbf737-f758-41a4-9d9f-d1a40a61f831",
"name": "Search website",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
1760,
-280
],
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "JHIxHv9F7GAb6rM6",
"name": "[Bing] Search"
}
}
},
{
"parameters": {
"resource": "databasePage",
"databaseId": {
"__rl": true,
"value": "1ef81d8c-8a3a-80bf-91be-d20d338c6074",
"mode": "list",
"cachedResultName": "Sehenswürdigkeiten",
"cachedResultUrl": "https://www.notion.so/1ef81d8c8a3a80bf91bed20d338c6074"
},
"title": "={{ $('Valid result').item.json.output.name }}",
"propertiesUi": {
"propertyValues": [
{
"key": "Description|rich_text",
"textContent": "={{ $('Valid result').item.json.output.description }}"
},
{
"key": "URL|url",
"urlValue": "={{ $('Search website').item.json.webPages.value[0].url }}"
},
{
"key": "Photo|files",
"fileUrls": {
"fileUrl": [
{
"name": "={{ $('Valid result').item.json.output.name }}",
"url": "={{ $('Search photo').item.json.value[0].contentUrl }}"
}
]
}
}
]
},
"options": {}
},
"type": "n8n-nodes-base.notion",
"typeVersion": 2.2,
"position": [
2200,
-280
],
"id": "07a6c6ec-52f9-4a7e-9a77-bea10de12e33",
"name": "Save place",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"notionApi": {
"id": "13",
"name": "Notion (private)"
}
}
},
{
"parameters": {
"url": "https://api.bing.microsoft.com/v7.0/images/search",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "q",
"value": "={{ $('Valid result').item.json.output.name }}"
},
{
"name": "mkt",
"value": "de-DE"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1980,
-280
],
"id": "1c08e733-ace9-4260-8b3d-44bf7cc707a8",
"name": "Search photo",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "JHIxHv9F7GAb6rM6",
"name": "[Bing] Search"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1540,
-280
],
"id": "4a47c49c-5b13-45bb-9c5a-9a6b23fa87bc",
"name": "Valid result"
},
{
"parameters": {
"errorMessage": "Didn't get expected fields in AI response"
},
"type": "n8n-nodes-base.stopAndError",
"typeVersion": 1,
"position": [
1540,
-80
],
"id": "d57424b9-02f2-4280-acc9-a5ca6c97fc08",
"name": "Stop and Error"
},
{
"parameters": {
"chatId": "6179180420",
"text": "={{ $json.output }}",
"additionalFields": {
"appendAttribution": false
}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
2796,
-280
],
"id": "f5a6e2e8-6d0e-457a-a873-1bdc386d7c1f",
"name": "Send chat message",
"webhookId": "de167e41-a3eb-4095-a4e5-7ed214996911",
"executeOnce": true,
"retryOnFail": true,
"credentials": {
"telegramApi": {
"id": "35",
"name": "@marvin250423_bot"
}
}
},
{
"parameters": {
"operation": "sendPhoto",
"chatId": "6179180420",
"file": "={{ $('Search photo').item.json.value[0].contentUrl }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
3016,
-280
],
"id": "7ff9224e-fee5-4ca8-93c9-a91f0709b721",
"name": "Send photo",
"webhookId": "de167e41-a3eb-4095-a4e5-7ed214996911",
"executeOnce": true,
"retryOnFail": true,
"credentials": {
"telegramApi": {
"id": "35",
"name": "@marvin250423_bot"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "c5fd2ab6-671b-494b-b8d2-b71f554000a3",
"leftValue": "={{ $json.days_left.days }}",
"rightValue": 1,
"operator": {
"type": "number",
"operation": "gte"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
660,
-40
],
"id": "c8edd314-aa5a-4cb6-870c-bc97f3a89130",
"name": "1 or more days left?"
},
{
"parameters": {},
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
980,
100
],
"id": "4b85f19b-6549-468d-b30e-520eead8f56f",
"name": "Do nothing"
},
{
"parameters": {
"jsonSchemaExample": "{\n \"name\": \"Kuchu Teien Observatory\",\n \"description\": \"Kuchu Teien Observatory is a stunning rooftop garden located atop the Umeda Sky Building in Osaka. It offers a 360-degree panoramic view of the city, making it a perfect spot for photography and sightseeing. The observatory is accessible by public transport and provides a unique perspective of Osaka's skyline, especially beautiful at sunset. It's a popular destination for international visitors seeking breathtaking views and a memorable experience.\"\n}\n"
},
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"typeVersion": 1.2,
"position": [
1160,
-60
],
"id": "a9d4294c-7760-4564-aa93-eb9c08b9fd7f",
"name": "Structured Output Parser"
},
{
"parameters": {
"promptType": "define",
"text": "=You are a professional tour guide in Osaka, Japan.\n\nYour customer is going on holiday to Osaka in {{ $json.days_left.days }} {{ $json.days_left.days == 1 ? \"day\" : \"days\" }}. Please recommend a place to visit in the Osaka area that welcome international visitors and is accessible by public transport.\n\nPlease use the 'read_previous_travel_tips' tool to ensure that you do not suggest any places that have already been suggested.",
"hasOutputParser": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.9,
"position": [
920,
-280
],
"id": "a1e9695e-25af-4602-848f-a2c11f72d603",
"name": "Get place to see"
},
{
"parameters": {
"promptType": "define",
"text": "=You are a professional tour guide in Osaka, Japan.\n\nYour customer is going on holiday to Osaka in {{ $('Calc days left').first().json.days_left.days }} {{ $('Calc days left').first().json.days_left.days == 1 ? \"day\" : \"days\" }}. Write a cheerful message of up to 320 characters to build their anticipation for the holiday. In your message, recommend the tourist attraction below:\n\n- Name: {{ $json.name }}\n- Description: {{ $json.property_description }}",
"hasOutputParser": true,
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.9,
"position": [
2420,
-280
],
"id": "3a17c450-7c03-4ed4-bfdf-7773c1c0d00f",
"name": "Prepare chat message"
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4.1",
"mode": "list",
"cachedResultName": "gpt-4.1"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
860,
-60
],
"id": "9b3db1c9-ff1d-4587-b212-d148d9e93c4d",
"name": "gpt-4.1_1",
"credentials": {
"openAiApi": {
"id": "xtsqXDTEgRWqZX4R",
"name": "Tom's OpenAI account"
}
}
},
{
"parameters": {
"model": {
"__rl": true,
"value": "gpt-4.1-mini",
"mode": "list",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"typeVersion": 1.2,
"position": [
2508,
-60
],
"id": "5bdf605e-99c0-4b9a-a3bb-49c5d7e6e4c7",
"name": "gpt-4.1-mini_1",
"credentials": {
"openAiApi": {
"id": "xtsqXDTEgRWqZX4R",
"name": "Tom's OpenAI account"
}
}
},
{
"parameters": {
"descriptionType": "manual",
"toolDescription": "Read previous travel tips from the Notion API",
"resource": "databasePage",
"operation": "getAll",
"databaseId": {
"__rl": true,
"value": "1ef81d8c-8a3a-80bf-91be-d20d338c6074",
"mode": "list",
"cachedResultName": "Sehenswürdigkeiten",
"cachedResultUrl": "https://www.notion.so/1ef81d8c8a3a80bf91bed20d338c6074"
},
"returnAll": true,
"options": {}
},
"type": "n8n-nodes-base.notionTool",
"typeVersion": 2.2,
"position": [
1000,
-60
],
"id": "188245d9-c024-4319-8232-d3f82aa9c14c",
"name": "read_previous_travel_tips",
"credentials": {
"notionApi": {
"id": "13",
"name": "Notion (private)"
}
}
}
],
"connections": {
"Schedule Trigger": {
"main": [
[
{
"node": "Calc days left",
"type": "main",
"index": 0
}
]
]
},
"Calc days left": {
"main": [
[
{
"node": "1 or more days left?",
"type": "main",
"index": 0
}
]
]
},
"Response has expected properties?": {
"main": [
[
{
"node": "Valid result",
"type": "main",
"index": 0
}
],
[
{
"node": "Stop and Error",
"type": "main",
"index": 0
}
]
]
},
"Search website": {
"main": [
[
{
"node": "Search photo",
"type": "main",
"index": 0
}
]
]
},
"Save place": {
"main": [
[
{
"node": "Prepare chat message",
"type": "main",
"index": 0
}
]
]
},
"Search photo": {
"main": [
[
{
"node": "Save place",
"type": "main",
"index": 0
}
]
]
},
"Valid result": {
"main": [
[
{
"node": "Search website",
"type": "main",
"index": 0
}
]
]
},
"Send chat message": {
"main": [
[
{
"node": "Send photo",
"type": "main",
"index": 0
}
]
]
},
"1 or more days left?": {
"main": [
[
{
"node": "Get place to see",
"type": "main",
"index": 0
}
],
[
{
"node": "Do nothing",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Get place to see",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Get place to see": {
"main": [
[
{
"node": "Response has expected properties?",
"type": "main",
"index": 0
}
]
]
},
"Prepare chat message": {
"main": [
[
{
"node": "Send chat message",
"type": "main",
"index": 0
}
]
]
},
"gpt-4.1_1": {
"ai_languageModel": [
[
{
"node": "Get place to see",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"gpt-4.1-mini_1": {
"ai_languageModel": [
[
{
"node": "Prepare chat message",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"read_previous_travel_tips": {
"ai_tool": [
[
{
"node": "Get place to see",
"type": "ai_tool",
"index": 0
}
]
]
}
},
"pinData": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment