{ "id": "dsKnCFwysROIA4MT", "meta": { "instanceId": "03524270bab2c2dfd5b82778cd1355e56cdda3cf098bf2dfd865e18164c00485" }, "name": "Agent with custom HTTP Request", "tags": [], "nodes": [ { "id": "e7374976-f3c1-4f60-ae57-9eec65444216", "name": "On new manual Chat Message", "type": "@n8n/n8n-nodes-langchain.manualChatTrigger", "position": [ 763, 676 ], "parameters": {}, "typeVersion": 1 }, { "id": "97e84a23-9536-43cd-94e9-b8166be8ed32", "name": "OpenAI Chat Model", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [ 983, 896 ], "parameters": { "model": "gpt-4-1106-preview", "options": { "timeout": 300000, "temperature": 0.7, "frequencyPenalty": 0.3 } }, "credentials": { "openAiApi": { "id": "wPFAzp4ZHdLLwvkK", "name": "OpenAi account" } }, "typeVersion": 1 }, { "id": "63d98361-8978-4042-84e7-53a0e226f946", "name": "HTTP Request", "type": "n8n-nodes-base.httpRequest", "onError": "continueRegularOutput", "position": [ 1360, 1200 ], "parameters": { "url": "={{ encodeURI($json.query.url) }}", "options": { "response": { "response": { "neverError": true } }, "allowUnauthorizedCerts": true } }, "typeVersion": 4.1, "alwaysOutputData": false }, { "id": "17d4b5ae-f5d3-4793-8419-d3c879f7f50d", "name": "Exctract HTML Body", "type": "n8n-nodes-base.set", "position": [ 1780, 1480 ], "parameters": { "fields": { "values": [ { "name": "HTML", "stringValue": "={{ $json?.data.match(/
]*>([\\s\\S]*?)<\\/body>/i)[1] }}" } ] }, "include": "selected", "options": {}, "includeFields": "HTML" }, "typeVersion": 3.2 }, { "id": "36c38ee4-724c-4ba2-a59a-ac0bbc912e94", "name": "Is error?", "type": "n8n-nodes-base.if", "position": [ 1560, 1200 ], "parameters": { "conditions": { "boolean": [ { "value1": "={{ $json.hasOwnProperty('error') }}", "value2": true } ] } }, "typeVersion": 1 }, { "id": "4e4d97ce-14a9-4f4f-aa75-f218784d9ed9", "name": "Stringify error message", "type": "n8n-nodes-base.set", "position": [ 1780, 980 ], "parameters": { "fields": { "values": [ { "name": "page_content", "stringValue": "={{ $('QUERY_PARAMS').first()?.json?.query?.url == null ? \"INVALID action_input. This should be an HTTP query string like this: \\\"?url=VALIDURL&method=SELECTEDMETHOD\\\". Only a simple string value is accepted. JSON object as an action_input is NOT supported!\" : JSON.stringify($json.error) }}" } ] }, "include": "selected", "options": {}, "includeFields": "HTML" }, "typeVersion": 3.2 }, { "id": "8452e5c4-aa29-4a02-9579-8d9da3727bcb", "name": "Execute Workflow Trigger", "type": "n8n-nodes-base.executeWorkflowTrigger", "position": [ 760, 1200 ], "parameters": {}, "typeVersion": 1 }, { "id": "063220c2-fa4d-4d5e-9549-7712aaa72921", "name": "Remove extra tags", "type": "n8n-nodes-base.set", "position": [ 1980, 1480 ], "parameters": { "fields": { "values": [ { "name": "HTML", "stringValue": "={{ ($json.HTML || \"HTML BODY CONTENT FOR THIS SEARCH RESULT IS NOT AVAILABLE\").replace(/