[System]
Tu es un expert n8n. Diagnostique les problèmes d'exécution.
Utilise <thinking> pour tracer le flux de données étape par étape.
Identifie où et pourquoi les données ne correspondent pas aux attentes.
Propose des solutions concrètes.

[User]
Mon workflow a un problème.

Workflow:
```json
{"meta":{"instanceId":"408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9","templateCredsSetupCompleted":true},"nodes":[{"id":"a342005e-a88e-419b-b929-56ecbba4a936","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1300,1180],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"learnings\": {\n      \"type\": \"array\",\n      \"description\": \"List of learnings, max of 3.\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"followUpQuestions\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\",\n        \"description\": \"List of follow-up questions to research the topic further, max of 3.\"\n      }\n    }\n  }\n}"},"typeVersion":1.2},{"id":"126b8151-6d20-43b8-8028-8163112c4c5b","name":"Set Variables","type":"n8n-nodes-base.set","position":[-1360,-460],"parameters":{"options":{},"assignments":{"assignments":[{"id":"df28b12e-7c20-4ff5-b5b8-dc773aa14d4b","name":"request_id","type":"string","value":"={{ $execution.id }}"},{"id":"9362c1e7-717d-444a-8ea2-6b5f958c9f3f","name":"prompt","type":"string","value":"={{ $json['What would you like to research?'] }}"},{"id":"09094be4-7844-4a9e-af82-cc8e39322398","name":"depth","type":"number","value":"={{\n!isNaN($json['input-depth'][0].toNumber())\n  ? $json['input-depth'][0].toNumber()\n  : 1\n}}"},{"id":"3fc30a30-7806-4013-835d-97e27ddd7ae1","name":"breadth","type":"number","value":"={{\n!isNaN($json['input-breadth'][0].toNumber())\n  ? $json['input-breadth'][0].toNumber()\n  : 1\n}}"}]}},"typeVersion":3.4},{"id":"1d0fb87b-263d-46c2-b016-a29ba1d407ab","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1120,1180],"parameters":{"model":{"__rl":true,"mode":"id","value":"o3-mini"},"options":{}},"typeVersion":1.2},{"id":"39b300d9-11ba-44f6-8f43-2fe256fe4856","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","positio...
```

**Symptôme**: Le workflow s'exécute mais n'envoie aucun email
**Attendu**: Email envoyé avec les données
**Réel**: Aucun email reçu

[Assistant]
<thinking>
**Symptôme**: Le workflow ne produit pas le résultat attendu.

**Trace du flux**:
1. Vérification des données en entrée
2. Suivi de la transformation à chaque node
3. Comparaison avec l'output attendu

**Hypothèses**:
- Mauvaise expression d'accès aux données
- Node mal configuré
- Données manquantes en entrée
</thinking>

## 🔍 Diagnostic

**Problème identifié**: Le node précédent retourne un tableau vide car le filtre est trop restrictif

**Analyse du flux**:
1. Vérification des données à chaque étape
2. Le problème se situe dans le traitement des données

**Solutions**:

### Option 1: Corriger l'expression
Vérifier que le chemin d'accès aux données correspond à la structure réelle.

### Option 2: Ajouter du logging
Insérer un node Set ou Code pour inspecter les données à chaque étape.

**Workflow avec corrections suggérées:**
{"meta":{"instanceId":"408f9fb9940c3cb18ffdef0e0150fe342d6e655c3a9fac21f0f644e8bedabcd9","templateCredsSetupCompleted":true},"nodes":[{"id":"a342005e-a88e-419b-b929-56ecbba4a936","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1300,1180],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"learnings\": {\n      \"type\": \"array\",\n      \"description\": \"List of learnings, max of 3.\",\n      \"items\": { \"type\": \"string\" }\n    },\n    \"followUpQuestions\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\",\n        \"description\": \"List of follow-up questions to research the topic further, max of 3.\"\n      }\n    }\n  }\n}"},"typeVersion":1.2},{"id":"126b8151-6d20-43b8-8028-8163112c4c5b","name":"Set Variables","type":"n8n-nodes-base.set","position":[-1360,-460],"parameters":{"options":{},"assignments":{"assignments":[{"id":"df28b12e-7c20-4ff5-b5b8-dc773aa14d4b","name":"request_id","type":"string","value":"={{ $execution.id }}"},{"id":"9362c1e7-717d-444a-8ea2-6b5f958c9f3f","name":"prompt","type":"string","value":"={{ $json['What would you like to research?'] }}"},{"id":"09094be4-7844-4a9e-af82-cc8e39322398","name":"depth","type":"number","value":"={{\n!isNaN($json['input-depth'][0].toNumber())\n  ? $json['input-depth'][0].toNumber()\n  : 1\n}}"},{"id":"3fc30a30-7806-4013-835d-97e27ddd7ae1","name":"breadth","type":"number","value":"={{\n!isNaN($json['input-breadth'][0].toNumber())\n  ? $json['input-breadth'][0].toNumber()\n  : 1\n}}"}]}},"typeVersion":3.4},{"id":"1d0fb87b-263d-46c2-b016-a29ba1d407ab","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1120,1180],"parameters":{"model":{"__rl":true,"mode":"id","value":"o3-mini"},"options":{}},"typeVersion":1.2},{"id":"39b300d9-11ba-44f6-8f43-2fe256fe4856","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-860,1760],"parameters":{"model":{"__rl":true,"mode":"id","value":"o3-mini"},"options":{}},"typeVersion":1.2},{"id":"018da029-a796-45c5-947c-791e087fe934","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1060,-300],"parameters":{"model":{"__rl":true,"mode":"id","value":"o3-mini"},"options":{}},"typeVersion":1.2},{"id":"525da936-a9eb-4523-b27a-ff6ae7b0e5ef","name":"Structured Output Parser1","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-840,-300],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"questions\": {\n      \"type\": \"array\",\n      \"description\": \"Follow up questions to clarify the research direction, max of 3.\",\n      \"items\": {\n          \"type\": \"string\"\n      }\n    }\n  }\n}"},"typeVersion":1.2},{"id":"e6664883-cff4-4e09-881e-6b6f684f9cac","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[-1760,-460],"webhookId":"026629c8-7644-493c-b830-d9c72eea307d","parameters":{"options":{"path":"deep_research","ignoreBots":true,"buttonLabel":"Next"},"formTitle":" DeepResearcher","formFields":{"values":[{"fieldType":"html"}]},"formDescription":"=DeepResearcher is a multi-step, recursive approach using the internet to solve complex research tasks, accomplishing in tens of minutes what a human would take many hours.\n\nTo use, provide a short summary of what the research and how \"deep\" you'd like the workflow to investigate. Note, the higher the numbers the more time and cost will occur for the research.\n\nThe workflow is designed to complete independently and when finished, a report will be saved in a designated Notion Database."},"typeVersion":2.2},{"id":"6b8ebc08-c0b1-4af8-99cc-79d09eea7316","name":"Generate SERP Queries","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-1040,820],"parameters":{"text":"=Given the following prompt from the user, generate a list of SERP queries to research the topic.\nReduce the number of words in each query to its keywords only.\nReturn a maximum of {{ $('JobType Router').first().json.data.breadth }} queries, but feel free to return less if the original prompt is clear. Make sure each query is unique and not similar to each other: <prompt>{{ $('JobType Router').first().json.data.query.trim() }}</prompt>\n\n{{\n$('JobType Router').first().json.data.learnings.length\n  ? `Here are some learnings from previous research, use them to generate more specific queries:\\n${$('JobType Router').first().json.data.learnings.map(text => `* ${text}`).join('\\n')}`\n  : ''\n}}","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=You are an expert researcher. Today is {{ $now.toLocaleString() }}. Follow these instructions when responding:\n  - You may be asked to research subjects that is after your knowledge cutoff, assume the user is right when presented with news.\n  - The user is a highly experienced analyst, no need to simplify it, be as detailed as possible and make sure your response is correct.\n  - Be highly organized.\n  - Suggest solutions that I didn't think about.\n  - Be proactive and anticipate my needs.\n  - Treat me as an expert in all subject matter.\n  - Mistakes erode my trust, so be accurate and thorough.\n  - Provide detailed explanations, I'm comfortable with lots of detail.\n  - Value good arguments over authorities, the source is irrelevant.\n  - Consider new technologies and contrarian ideas, not just the conventional wisdom.\n  - You may use high levels of speculation or prediction, just flag it for me."}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.5},{"id":"34e1fa5d-bc0c-4b9e-84a7-35db2b08c772","name":"Structured Output Parser2","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[-860,980],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"queries\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"query\": {\n            \"type\": \"string\",\n            \"description\": \"The SERP query\"\n          },\n          \"researchGoal\": {\n            \"type\": \"string\",\n            \"description\": \"First talk about the goal of the research that this query is meant to accomplish, then go deeper into how to advance the research once the results are found, mention additional research directions. Be as specific as possible, especially for additional research directions.\"\n          }\n        }\n      }\n    }\n  }\n}"},"typeVersion":1.2},{"id":"be6dd6a2-aacf-4682-8f13-8ae24c4249a3","name":"OpenAI Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1040,980],"parameters":{"model":{"__rl":true,"mode":"id","value":"o3-mini"},"options":{}},"typeVersion":1.2},{"id":"d5ce6e21-cd07-44fa-b6d0-90bf7531ee01","name":"Set Initial Query","type":"n8n-nodes-base.set","position":[-580,180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"acb41e93-70c6-41a3-be0f-e5a74ec3ec88","name":"query","type":"string","value":"={{ $('JobType Router').first().json.data.query }}"},{"id":"7fc54063-b610-42bc-a250-b1e8847c4d1e","name":"learnings","type":"array","value":"={{ $('JobType Router').first().json.data.learnings }}"},{"id":"e8f1c158-56fb-41c8-8d86-96add16289bb","name":"breadth","type":"number","value":"={{ $('JobType Router').first().json.data.breadth }}"}]}},"typeVersion":3.4},{"id":"9de6e4a1-a2b5-4a6f-948e-a0585edcae48","name":"SERP to Items","type":"n8n-nodes-base.splitOut","position":[-700,820],"parameters":{"options":{},"fieldToSplitOut":"output.queries"},"typeVersion":1},{"id":"2c9c4cdf-942b-494c-83fb-ed5ec37385ee","name":"Item Ref","type":"n8n-nodes-base.noOp","position":[-220,1020],"parameters":{},"typeVersion":1},{"id":"703c57af-de19-4f00-b580-711a272fa5ca","name":"Research Goal + Learnings","type":"n8n-nodes-base.set","position":[1460,1160],"parameters":{"options":{},"assignments":{"assignments":[{"id":"9acec2cc-64c8-4e62-bed4-c3d9ffab1379","name":"researchGoal","type":"string","value":"={{ $('Item Ref').first().json.researchGoal }}"},{"id":"1b2d2dad-429b-4fc9-96c5-498f572a85c3","name":"learnings","type":"array","value":"={{ $json.output.learnings }}"},{"id":"7025f533-02ab-4031-9413-43390fb61f05","name":"followUpQuestions","type":"string","value":"={{ $json.output.followUpQuestions }}"},{"id":"c9e34ea4-5606-46d6-8d66-cb42d772a8b4","name":"urls","type":"array","value":"={{\n$('Get Markdown + URL')\n  .all()\n  .map(item => item.json.url)\n}}"}]}},"typeVersion":3.4},{"id":"16ed2835-3af4-45e3-b5a7-e4342d571aa0","name":"Accumulate Results","type":"n8n-nodes-base.set","position":[-200,180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"db509e90-9a86-431f-8149-4094d22666cc","name":"should_stop","type":"boolean","value":"={{\n$runIndex >= ($('JobType Router').first().json.data.depth)\n}}"},{"id":"90986e2b-8aca-4a22-a9db-ed8809d6284d","name":"all_learnings","type":"array","value":"={{\nArray($runIndex+1)\n  .fill(0)\n  .flatMap((_,idx) => {\n    try {\n      return $('Generate Learnings')\n        .all(0,idx)\n        .flatMap(item => item.json.data.flatMap(d => d.learnings))\n    } catch (e) {\n      return []\n    }\n  })\n}}"},{"id":"3eade958-e8ab-4975-aac4-f4a4a983c163","name":"all_urls","type":"array","value":"={{\nArray($runIndex+1)\n  .fill(0)\n  .flatMap((_,idx) => {\n    try {\n      return $('Generate Learnings')\n        .all(0,idx)\n        .flatMap(item => item.json.data.flatMap(d => d.urls))\n    } catch (e) {\n      return []\n    }\n  })\n}}"}]}},"executeOnce":true,"typeVersion":3.4},{"id":"0011773e-85c6-4fe1-8554-c23ce50706d0","name":"DeepResearch Results","type":"n8n-nodes-base.set","position":[160,360],"parameters":{"mode":"raw","options":{},"jsonOutput":"={{ $('Generate Learnings').item.json }}"},"typeVersion":3.4},{"id":"c0b646d0-1246-4864-8f79-8b7a66e4e083","name":"Results to Items","type":"n8n-nodes-base.splitOut","position":[320,360],"parameters":{"options":{},"fieldToSplitOut":"data"},"typeVersion":1},{"id":"3c52ec3e-c952-4b5f-ab12-f1b5d02aba74","name":"Set Next Queries","type":"n8n-nodes-base.set","position":[480,360],"parameters":{"options":{},"assignments":{"assignments":[{"id":"d88bfe95-9e73-4d25-b45c-9f164b940b0e","name":"query","type":"string","value":"=Previous research goal: {{ $json.researchGoal }}\nFollow-up research directions: {{ $json.followUpQuestions.map(q => `\\n${q}`).join('') }}"},{"id":"4aa20690-d998-458a-b1e4-0d72e6a68e6b","name":"learnings","type":"array","value":"={{ $('Accumulate Results').item.json.all_learnings }}"},{"id":"89acafae-b04a-4d5d-b08b-656e715654e4","name":"breadth","type":"number","value":"={{ $('JobType Router').first().json.data.breadth }}"}]}},"typeVersion":3.4},{"id":"bc59dddc-2b03-481f-91c6-ea8aa378eef0","name":"For Each Query...","type":"n8n-nodes-base.splitInBatches","position":[-420,860],"parameters":{"options":{}},"typeVersion":3},{"id":"903c31c4-5fdc-4cb6-8baa-402555997266","name":"Feedback to Items","type":"n8n-nodes-base.splitOut","position":[-720,-460],"parameters":{"options":{},"fieldToSplitOut":"output.questions"},"typeVersion":1},{"id":"59ff671d-5d4f-42ff-b94f-ed30a8531e55","name":"Ask Clarity Questions","type":"n8n-nodes-base.form","position":[-360,-380],"webhookId":"d3375ba6-0008-4fcb-96bc-110374de2603","parameters":{"options":{"formTitle":"DeepResearcher","buttonLabel":"Answer","formDescription":"=\n
\nAnswer the following clarification questions to assist the DeepResearcher better under the research topic.\n
\n
\n
\nTotal {{ $('Feedback to Items').all().length }} questions.\n
"},"formFields":{"values":[{"fieldType":"textarea","fieldLabel":"={{ $json[\"output.questions\"] }}","placeholder":"=","requiredField":true}]}},"typeVersion":1},{"id":"1c2cf79b-f1a1-4ecc-bb45-3d4460c947bd","name":"For Each Question...","type":"n8n-nodes-base.splitInBatches","position":[-540,-460],"parameters":{"options":{}},"typeVersion":3},{"id":"0c9ffa99-2687-4df5-8581-0c5b0b2657a9","name":"DeepResearch Subworkflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-1880,820],"parameters":{"workflowInputs":{"values":[{"name":"requestId","type":"any"},{"name":"jobType"},{"name":"data","type":"object"}]}},"typeVersion":1.1},{"id":"e87c0f19-6002-4aa2-931a-ca7546146a84","name":"Clarifying Questions","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-1040,-460],"parameters":{"text":"=Given the following query from the user, ask some follow up questions to clarify the research direction. Return a maximum of 3 questions, but feel free to return less if the original query is clear: <query>{{ $json.prompt }}</query>`","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=You are an expert researcher. Today is {{ $now.toLocaleString() }}. Follow these instructions when responding:\n  - You may be asked to research subjects that is after your knowledge cutoff, assume the user is right when presented with news.\n  - The user is a highly experienced analyst, no need to simplify it, be as detailed as possible and make sure your response is correct.\n  - Be highly organized.\n  - Suggest solutions that I didn't think about.\n  - Be proactive and anticipate my needs.\n  - Treat me as an expert in all subject matter.\n  - Mistakes erode my trust, so be accurate and thorough.\n  - Provide detailed explanations, I'm comfortable with lots of detail.\n  - Value good arguments over authorities, the source is irrelevant.\n  - Consider new technologies and contrarian ideas, not just the conventional wisdom.\n  - You may use high levels of speculation or prediction, just flag it for me."}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.5},{"id":"0a8c3a01-d4d4-4075-9521-035b7df9aa5a","name":"End Form","type":"n8n-nodes-base.form","position":[960,-420],"webhookId":"88f2534b-2b82-4b40-a4bc-97d96384e8fd","parameters":{"options":{},"operation":"completion","completionTitle":"=Thank you for using DeepResearcher.","completionMessage":"=You may now close this window."},"typeVersion":1},{"id":"44a3603f-a5a1-4031-8c5f-c748b1007b47","name":"Initiate DeepResearch","type":"n8n-nodes-base.executeWorkflow","position":[600,-420],"parameters":{"mode":"each","options":{"waitForSubWorkflow":false},"workflowId":{"__rl":true,"mode":"id","value":"={{ $workflow.id }}"},"workflowInputs":{"value":{"data":"={{\n{\n  \"query\": $('Get Initial Query').first().json.query,\n  \"learnings\": [],\n  \"depth\": $('Set Variables').first().json.depth,\n  \"breadth\": $('Set Variables').first().json.breadth,\n}\n}}","jobType":"deepresearch_initiate","requestId":"={{ $('Set Variables').first().json.request_id }}"},"schema":[{"id":"requestId","display":true,"removed":false,"required":false,"displayName":"requestId","defaultMatch":false,"canBeUsedToMatch":true},{"id":"jobType","type":"string","display":true,"removed":false,"required":false,"displayName":"jobType","defaultMatch":false,"canBeUsedToMatch":true},{"id":"data","type":"object","display":true,"removed":false,"required":false,"displayName":"data","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"b243eb76-9ed9-4327-968f-c21844bc9df4","name":"Execution Data","type":"n8n-nodes-base.executionData","position":[-1700,820],"parameters":{"dataToSave":{"values":[{"key":"requestId","value":"={{ $json.requestId }}"},{"key":"=jobType","value":"={{ $json.jobType }}"}]}},"typeVersion":1},{"id":"57ca4b22-9349-4b34-8f6b-c502905b5172","name":"JobType Router","type":"n8n-nodes-base.switch","position":[-1520,820],"parameters":{"rules":{"values":[{"outputKey":"initiate","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.jobType }}","rightValue":"deepresearch_initiate"}]},"renameOutput":true},{"outputKey":"learnings","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"ecbfa54d-fc97-48c5-8d3d-f0538b8d727b","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.jobType }}","rightValue":"deepresearch_learnings"}]},"renameOutput":true},{"outputKey":"report","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"392f9a98-ec22-4e57-9c8e-0e1ed6b7dafa","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.jobType }}","rightValue":"deepresearch_report"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"1f880fbd-71ba-4e5b-8d99-9654ae0c949f","name":"OpenAI Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-20,-280],"parameters":{"model":{"__rl":true,"mode":"id","value":"o3-mini"},"options":{}},"typeVersion":1.2},{"id":"ea65589b-106f-4ff1-a6f2-763393c2cb07","name":"Get Initial Query","type":"n8n-nodes-base.set","position":[-360,-540],"parameters":{"options":{},"assignments":{"assignments":[{"id":"14b77741-c3c3-4bd2-be6e-37bd09fcea2b","name":"query","type":"string","value":"=Initial query: {{ $('Set Variables').first().json.prompt }}\nFollow-up Questions and Answers:\n{{\n$input.all()\n  .map(item => {\n    const q = Object.keys(item.json)[0];\n    const a = item.json[q];\n    return `question: ${q}\\nanswer: ${a}`;\n  })\n  .join('\\n')\n}}"}]}},"executeOnce":true,"typeVersion":3.4},{"id":"09a363f2-6300-430d-8c7e-3e1611ab8e68","name":"Structured Output Parser4","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[160,-280],"parameters":{"schemaType":"manual","inputSchema":"{\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": {\n      \"type\": \"string\",\n      \"description\":\" A short title summarising the research topic\"\n    },\n    \"description\": {\n      \"type\": \"string\",\n      \"description\": \"A short description to summarise the research topic\"\n    }\n  }\n}"},"typeVersion":1.2},{"id":"9910804e-8376-4e2e-a011-7d32ca951edf","name":"Create Row","type":"n8n-nodes-base.notion","position":[300,-420],"parameters":{"title":"={{ $json.output.title }}","options":{},"resource":"databasePage","databaseId":{"__rl":true,"mode":"list","value":"19486dd6-0c0c-80da-9cb7-eb1468ea9afd","cachedResultUrl":"https://www.notion.so/19486dd60c0c80da9cb7eb1468ea9afd","cachedResultName":"n8n DeepResearch"},"propertiesUi":{"propertyValues":[{"key":"Description|rich_text","textContent":"={{ $json.output.description }}"},{"key":"Status|status","statusValue":"Not started"},{"key":"Request ID|rich_text","textContent":"={{ $('Set Variables').first().json.request_id }}"},{"key":"Name|title","title":"={{ $json.output.title }}"}]}},"typeVersion":2.2},{"id":"9f06d9ae-220d-4f5b-bcbf-761b88ba255c","name":"Report Page Generator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-20,-420],"parameters":{"text":"=Create a suitable title for the research report which will be created from the user's query.\n<query>{{ $json.query }}</query>","promptType":"define","hasOutputParser":true},"typeVersion":1.5},{"id":"9fd00d55-1c76-425b-8386-7bc5b2bb47ac","name":"Is Depth Reached?","type":"n8n-nodes-base.if","position":[-40,180],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"75d18d88-6ba6-43df-bef7-3e8ad99ad8bd","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.should_stop }}","rightValue":""}]}},"typeVersion":2.2},{"id":"f658537b-4f4c-4427-a66f-56cfd950bffc","name":"Get Research Results","type":"n8n-nodes-base.set","position":[160,180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"90b3da00-dcd5-4289-bd45-953146a3b0ba","name":"all_learnings","type":"array","value":"={{ $json.all_learnings }}"},{"id":"623dbb3d-83a1-44a9-8ad3-48d92bc42811","name":"all_urls","type":"array","value":"={{ $json.all_urls }}"}]}},"typeVersion":3.4},{"id":"6059f3ba-e4a0-4528-894c-6080eedb91c3","name":"Get Existing Row","type":"n8n-nodes-base.notion","position":[-1040,180],"parameters":{"limit":1,"filters":{"conditions":[{"key":"Request ID|rich_text","condition":"equals","richTextValue":"={{ $json.requestId.toString() }}"}]},"options":{},"resource":"databasePage","matchType":"allFilters","operation":"getAll","databaseId":{"__rl":true,"mode":"list","value":"19486dd6-0c0c-80da-9cb7-eb1468ea9afd","cachedResultUrl":"https://www.notion.so/19486dd60c0c80da9cb7eb1468ea9afd","cachedResultName":"n8n DeepResearch"},"filterType":"manual"},"typeVersion":2.2},{"id":"100625bb-bf9a-4993-b387-1c61e486ba6d","name":"Set In-Progress","type":"n8n-nodes-base.notion","position":[-840,180],"parameters":{"pageId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"resource":"databasePage","operation":"update","propertiesUi":{"propertyValues":[{"key":"Status|status","statusValue":"In progress"}]}},"typeVersion":2.2},{"id":"864332ea-dd25-4347-a49d-68ed6495c1a9","name":"Set Done","type":"n8n-nodes-base.notion","position":[1680,1600],"parameters":{"pageId":{"__rl":true,"mode":"id","value":"={{ $('Get Existing Row1').first().json.id }}"},"options":{},"resource":"databasePage","operation":"update","propertiesUi":{"propertyValues":[{"key":"Status|status","statusValue":"Done"},{"key":"Last Updated|date","date":"={{ $now.toISO() }}"}]}},"executeOnce":true,"typeVersion":2.2},{"id":"6771568a-e6bd-4c89-a535-089fd1c18fc3","name":"Tags to Items","type":"n8n-nodes-base.splitOut","position":[-60,1600],"parameters":{"options":{},"fieldToSplitOut":"tag"},"typeVersion":1},{"id":"47fce580-7b5b-4bc6-ba52-a8e7af6595b5","name":"Convert to HTML","type":"n8n-nodes-base.markdown","position":[-380,1600],"parameters":{"mode":"markdownToHtml","options":{"tables":true},"markdown":"={{ $json.text }}"},"typeVersion":1},{"id":"e2fb5a31-9ca5-487b-a7f8-f020759ec53a","name":"HTML to Array","type":"n8n-nodes-base.set","position":[-220,1600],"parameters":{"options":{},"assignments":{"assignments":[{"id":"851b8a3f-c2d3-41ad-bf60-4e0e667f6c58","name":"tag","type":"array","value":"={{ $json.data.match(/<table[\\s\\S]*?<\\/table>|<ul[\\s\\S]*?<\\/ul>|<[^>]+>[^<]*<\\/[^>]+>/g) }}"}]}},"typeVersion":3.4},{"id":"5275f9dd-5420-4c59-a330-5f2775b47e51","name":"Notion Block Generator","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[100,1600],"parameters":{"text":"={{ $json.tag.trim() }}","messages":{"messageValues":[{"message":"=Convert the following html into its equivalent Notion Block as per Notion's API schema.\n* Ensure the content is always included and remains the same.\n* Return only a json response.\n* Generate child-level blocks. Should not define \"parent\" or \"children\" property.\n* Strongly prefer headings, paragraphs, tables and lists type blocks.\n* available headings are heading_1, heading_2 and heading_3 - h4,h5,h6 should use heading_3 type instead. ensure headings use the rich text definition.\n* ensure lists blocks include all list items.\n\n## Examples\n\n1. headings\n```\n<h3 id=\"references\">References</h3>\n```\nwould convert to \n```\n{\"object\":  \"block\", \"type\": \"heading_3\", \"heading_3\": { \"rich_text\": [{\"type\": \"text\",\"text\": {\"content\": \"References\"}}]}}\n```\n\n2. lists\n```\n<ul><li>hello</li><li>world</li></ul>\n```\nwould convert to\n```\n[\n{\n  \"object\": \"block\",\n  \"type\": \"bulleted_list_item\",\n  \"bulleted_list_item\": {\"rich_text\": [{\"type\": \"text\",\"text\": {\"content\": \"hello\"}}]}\n},\n{\n  \"object\": \"block\",\n  \"type\": \"bulleted_list_item\",\n  \"bulleted_list_item\": {\"rich_text\": [{\"type\": \"text\",\"text\": {\"content\": \"world\"}}]}\n}\n]\n```\n\n3. tables\n```\n<table>\n  <thead>\n    <tr><th>Technology</th><th>Potential Impact</th></tr>\n  </thead>\n  <tbody>\n    <tr>\n      <td>5G Connectivity</td><td>Enables faster data speeds and advanced apps</td>\n    </tr>\n  </tbody>\n</table>\n```\nwould convert to\n```\n{\n  \"object\": \"block\",\n  \"type\": \"table\",\n  \"table\": {\n    \"table_width\": 2,\n    \"has_column_header\": true,\n    \"has_row_header\": false,\n    \"children\": [\n      {\n        \"object\": \"block\",\n        \"type\": \"table_row\",\n        \"table_row\": {\n          \"cells\": [\n            [\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"Technology\",\n                  \"link\": null\n                }\n              },\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"Potential Impact\",\n                  \"link\": null\n                }\n              }\n            ],\n            [\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"5G Connectivity\",\n                  \"link\": null\n                }\n              },\n              {\n                \"type\": \"text\",\n                \"text\": {\n                  \"content\": \"Enables faster data speeds and advanced apps\",\n                  \"link\": null\n                }\n              }\n            ]\n          ]\n        }\n      }\n    ]\n  }\n}\n```\n4. anchor links\nSince Notion doesn't support anchor links, just convert them to rich text blocks instead.\n```\n<a href=\"#module-0-pre-course-setup-and-learning-principles\">Module 0: Pre-Course Setup and Learning Principles</a>\n```\nconverts to\n```\n{\n  \"object\": \"block\",\n  \"type\": \"paragraph\",\n  \"paragraph\": {\n    \"rich_text\": [\n      {\n        \"type\": \"text\",\n        \"text\": {\n          \"content\": \"Module 0: Pre-Course Setup and Learning Principles\"\n        }\n      }\n    ]\n  }\n}\n```\n5. Invalid html parts\nWhen the html is not syntax valid eg. orphaned closing tags, then just skip the conversion and use an empty rich text block.\n```\n</li>\\n</ol>\n```\ncan be substituted with\n```\n{\n  \"object\": \"block\",\n  \"type\": \"paragraph\",\n  \"paragraph\": {\n    \"rich_text\": [\n      {\n        \"type\": \"text\",\n        \"text\": {\n          \"content\": \" \"\n        }\n      }\n    ]\n  }\n}\n```"}]},"promptType":"define"},"typeVersion":1.5},{"id":"30e73ecf-5994-4229-b7f6-01e043e0e65b","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[80,1760],"parameters":{"options":{},"modelName":"models/gemini-2.0-flash"},"typeVersion":1},{"id":"85ce9f7e-0369-41bd-8c31-c4217f400472","name":"Parse JSON blocks","type":"n8n-nodes-base.set","onError":"continueRegularOutput","position":[420,1600],"parameters":{"options":{},"assignments":{"assignments":[{"id":"73fcb8a0-2672-4bd5-86de-8075e1e02baf","name":"=block","type":"array","value":"={{\n(function(){\n  const block = $json.text\n    .replace('```json', '')\n    .replace('```', '')\n    .trim()\n    .parseJson();\n  if (Array.isArray(block)) return block;\n  if (block.type.startsWith('heading_')) {\n    const prev = Number(block.type.split('_')[1]);\n    const next = Math.max(1, prev - 1);\n    if (next !== prev) {\n      block.type = `heading_${next}`;\n      block[`heading_${next}`] = Object.assign({}, block[`heading_${prev}`]);\n      block[`heading_${prev}`] = undefined;\n    }\n  }\n  return [block];\n})()\n}}"}]}},"executeOnce":false,"typeVersion":3.4},{"id":"349f4323-d65f-4845-accc-6f51340a84c4","name":"Upload to Notion Page","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","maxTries":2,"position":[1680,1760],"parameters":{"url":"=https://api.notion.com/v1/blocks/{{ $('Get Existing Row1').first().json.id }}/children","method":"PATCH","options":{"timeout":"={{ 1000 * 60 }}"},"jsonBody":"={{\n{\n  \"children\": $json.block\n}\n}}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"predefinedCredentialType","headerParameters":{"parameters":[{"name":"Notion-Version","value":"2022-06-28"}]},"nodeCredentialType":"notionApi"},"retryOnFail":true,"typeVersion":4.2,"waitBetweenTries":3000},{"id":"e2c29aa2-ff79-4bdd-b3c7-cf5e5866db8a","name":"Get Existing Row1","type":"n8n-nodes-base.notion","position":[-1020,1600],"parameters":{"limit":1,"filters":{"conditions":[{"key":"Request ID|rich_text","condition":"equals","richTextValue":"={{ $json.requestId.toString() }}"}]},"options":{},"resource":"databasePage","matchType":"allFilters","operation":"getAll","databaseId":{"__rl":true,"mode":"list","value":"19486dd6-0c0c-80da-9cb7-eb1468ea9afd","cachedResultUrl":"https://www.notion.so/19486dd60c0c80da9cb7eb1468ea9afd","cachedResultName":"n8n DeepResearch"},"filterType":"manual"},"typeVersion":2.2},{"id":"533ede84-1138-426c-93df-c2b862e2d063","name":"DeepResearch Report","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-860,1600],"parameters":{"text":"=You are are an expert and insightful researcher.\n* Given the following prompt from the user, write a final report on the topic using the learnings from research.\n* Make it as as detailed as possible, aim for 3 or more pages, include ALL the learnings from research.\n* Format the report in markdown. Use headings, lists and tables only and where appropriate.\n\n<prompt>{{ $('JobType Router').first().json.data.query }}</prompt>\n\nHere are all the learnings from previous research:\n\n<learnings>\n{{\n$('JobType Router').first().json.data\n  .all_learnings\n  .map(item => `<learning>${item}</learning>`)  \n  .join('\\n')\n}}\n</learnings>","promptType":"define"},"typeVersion":1.5},{"id":"efe47725-7fd5-45e7-97c4-d6c133745e5f","name":"DeepResearch Learnings","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[1120,1020],"parameters":{"text":"=Given the following contents from a SERP search for the query <query>{{ $('Item Ref').first().json.query }}</query>, generate a list of learnings from the contents. Return a maximum of 3 learnings, but feel free to return less if the contents are clear. Make sure each learning is unique and not similar to each other. The learnings should be concise and to the point, as detailed and infromation dense as possible. Make sure to include any entities like people, places, companies, products, things, etc in the learnings, as well as any exact metrics, numbers, or dates. The learnings will be used to research the topic further.\n\n<contents>\n{{\n$input\n  .all()\n  .map(item =>`<content>\\n${item.json.markdown.substr(0, 25_000)}\\n</content>`)\n  .join('\\n')\n}}\n</contents>","messages":{"messageValues":[{"type":"HumanMessagePromptTemplate","message":"=You are an expert researcher. Today is {{ $now.toLocaleString() }}. Follow these instructions when responding:\n  - You may be asked to research subjects that is after your knowledge cutoff, assume the user is right when presented with news.\n  - The user is a highly experienced analyst, no need to simplify it, be as detailed as possible and make sure your response is correct.\n  - Be highly organized.\n  - Suggest solutions that I didn't think about.\n  - Be proactive and anticipate my needs.\n  - Treat me as an expert in all subject matter.\n  - Mistakes erode my trust, so be accurate and thorough.\n  - Provide detailed explanations, I'm comfortable with lots of detail.\n  - Value good arguments over authorities, the source is irrelevant.\n  - Consider new technologies and contrarian ideas, not just the conventional wisdom.\n  - You may use high levels of speculation or prediction, just flag it for me."}]},"promptType":"define","hasOutputParser":true},"executeOnce":true,"typeVersion":1.5},{"id":"d3b42d13-e8ca-4085-ace9-1d9fb53f5e71","name":"Generate Report","type":"n8n-nodes-base.executeWorkflow","position":[480,180],"parameters":{"options":{"waitForSubWorkflow":false},"workflowId":{"__rl":true,"mode":"id","value":"={{ $workflow.id }}"},"workflowInputs":{"value":{"data":"={{\n{\n  ...Object.assign({}, $json),\n  query: $('JobType Router').first().json.data.query\n}\n}}","jobType":"deepresearch_report","requestId":"={{ $('JobType Router').first().json.requestId }}"},"schema":[{"id":"requestId","display":true,"required":false,"displayName":"requestId","defaultMatch":false,"canBeUsedToMatch":true},{"id":"jobType","type":"string","display":true,"required":false,"displayName":"jobType","defaultMatch":false,"canBeUsedToMatch":true},{"id":"data","type":"object","display":true,"required":false,"displayName":"data","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"2b0314ff-cd82-4b3b-a4a9-5fd8067391eb","name":"Generate Learnings","type":"n8n-nodes-base.executeWorkflow","position":[-380,180],"parameters":{"mode":"each","options":{"waitForSubWorkflow":true},"workflowId":{"__rl":true,"mode":"id","value":"={{ $workflow.id }}"},"workflowInputs":{"value":{"data":"={{ $json }}","jobType":"deepresearch_learnings","requestId":"={{ $('JobType Router').first().json.requestId }}"},"schema":[{"id":"requestId","display":true,"removed":false,"required":false,"displayName":"requestId","defaultMatch":false,"canBeUsedToMatch":true},{"id":"jobType","type":"string","display":true,"removed":false,"required":false,"displayName":"jobType","defaultMatch":false,"canBeUsedToMatch":true},{"id":"data","type":"object","display":true,"removed":false,"required":false,"displayName":"data","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"f4457d0b-d708-4bca-9973-46d96ed55826","name":"Confirmation","type":"n8n-nodes-base.form","position":[780,-420],"webhookId":"2eb17c47-c887-4e95-8641-1b3796452ab9","parameters":{"options":{"formTitle":"DeepResearcher","buttonLabel":"Done","formDescription":"=\n
\nYour Report Is On Its Way!\n
\nDeepResearcher will now work independently to conduct the research and the compiled report will be uploaded to the following Notion page below when finished.\n

\nPlease click the \"Done\" button to complete the form.\n
\n
"},"formFields":{"values":[{"html":"=\n
\n
\n    \n
\n
\n
{{ $json.name }}
\n
\n      {{ $json.property_description }}\n
\n
\n
\n","fieldType":"html"}]}},"typeVersion":1},{"id":"af8fe17a-4314-4e92-ad8e-8be0be62984b","name":"Research Request","type":"n8n-nodes-base.form","position":[-1560,-460],"webhookId":"46142c14-3692-40f6-80e5-f3d976e95191","parameters":{"options":{"formTitle":"DeepResearcher","formDescription":"="},"formFields":{"values":[{"fieldType":"textarea","fieldLabel":"What would you like to research?","requiredField":true},{"html":"<video\n    style=\"display:none\"\n    src=\"/when_will_n8n_support_range_sliders.mp4\"\n    onerror='\n  this.insertAdjacentHTML(`afterend`,\n  `
\n    \n      Enter research depth (Default 1)\n    \n
\n      This value determines how many sub-queries to generate.\n
\n    <input\n      class=\"form-input\"\n      type=\"range\"\n      id=\"depth\"\n      name=\"field-1\"\n      value=\"1\"\n      step=\"1\"\n      max=\"5\"\n      min=\"1\"\n      list=\"depth-markers\"\n    >\n    <datalist\n      id=\"depth-markers\"\n      style=\"display: flex;\n      flex-direction: row;\n      justify-content: space-between;\n      writing-mode: horizontal-tb;\n      margin-top: -10px;\n      text-align: center;\n      font-size: 10px;\n      margin-left: 16px;\n      margin-right: 16px;\"\n    >\n      <option value=\"1\" label=\"1\"></option>\n      <option value=\"2\" label=\"2\"></option>\n      <option value=\"3\" label=\"3\"></option>\n      <option value=\"4\" label=\"4\"></option>\n      <option value=\"5\" label=\"5\"></option>\n    </datalist>\n
`)\n  '\n/>","fieldType":"html","elementName":"input-depth"},{"html":"<video\n    style=\"display:none\"\n    src=\"/when_will_n8n_support_range_sliders.mp4\"\n    onerror='\n  this.insertAdjacentHTML(`afterend`,\n  `
\n    \n      Enter research breadth (Default 2)\n    \n
\n      This value determines how many sources to explore.\n
\n    <input\n      class=\"form-input\"\n      type=\"range\"\n      id=\"breadth\"\n      name=\"field-2\"\n      value=\"2\"\n      step=\"1\"\n      max=\"5\"\n      min=\"1\"\n      list=\"breadth-markers\"\n    >\n    <datalist\n      id=\"breadth-markers\"\n      style=\"display: flex;\n      flex-direction: row;\n      justify-content: space-between;\n      writing-mode: horizontal-tb;\n      margin-top: -10px;\n      text-align: center;\n      font-size: 10px;\n      margin-left: 16px;\n      margin-right: 16px;\"\n    >\n      <option value=\"1\" label=\"1\"></option>\n      <option value=\"2\" label=\"2\"></option>\n      <option value=\"3\" label=\"3\"></option>\n      <option value=\"4\" label=\"4\"></option>\n      <option value=\"5\" label=\"5\"></option>\n    </datalist>\n
`)\n  '\n/>\n","fieldType":"html","elementName":"input-breadth"},{"fieldType":"dropdown","fieldLabel":"={{ \"\" }}","multiselect":true,"fieldOptions":{"values":[{"option":"=I understand higher depth and breath values I've selected may incur longer wait times and higher costs. I acknowledging this and wish to proceed with the research request."}]},"requiredField":true}]}},"typeVersion":1},{"id":"c67a5e5c-f82b-4e8a-9c99-065d16dfa576","name":"Valid Blocks","type":"n8n-nodes-base.filter","position":[740,1600],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f68cefe0-e109-4d41-9aa3-043f3bc6c449","operator":{"type":"string","operation":"notExists","singleValue":true},"leftValue":"={{ $json.error }}","rightValue":""}]}},"typeVersion":2.2},{"id":"70c898a1-a757-452d-83ef-de1998fe13ae","name":"Append Blocks","type":"n8n-nodes-base.merge","position":[1000,1760],"parameters":{},"typeVersion":3},{"id":"591a3fcd-1748-43f7-9766-bc2059c195a0","name":"URL Sources to Lists","type":"n8n-nodes-base.code","position":[740,1760],"parameters":{"jsCode":"const urls = Object.values($('JobType Router').first().json.data.all_urls\n  .reduce((acc, url) => ({ ...acc, [url]: url }),{}));\nconst chunksize = 50;\nconst splits = Math.max(1, Math.floor(urls.length/chunksize));\n\nconst blocks = Array(splits).fill(0)\n  .map((_, idx) => {\n    const block = urls\n      .slice(\n        idx * chunksize, \n        (idx * chunksize) + chunksize - 1\n      )\n      .map(url => {\n        return {\n          object: \"block\",\n          type: \"bulleted_list_item\",\n          bulleted_list_item: {\n            rich_text: [\n              { type: \"text\", text: { content: url } }\n            ]\n          }\n        }\n      });\n    return { json: { block } }\n  });\n\nreturn [\n  { json: {\n    block:[{\n      \"object\": \"block\",\n      \"type\": \"heading_2\",\n      \"heading_2\": {\n        \"rich_text\": [\n          {\n            \"type\": \"text\",\n            \"text\": {\n              \"content\": \"Sources\"\n            }\n          }\n        ]\n      }\n    }]\n  } },\n  ...blocks\n];"},"typeVersion":2},{"id":"e59dbeea-ccf3-4619-9fe1-24874a91bdab","name":"Empty Response","type":"n8n-nodes-base.set","position":[640,1160],"parameters":{"options":{},"assignments":{"assignments":[{"id":"1de40158-338b-4db3-9e22-6fd63b21f825","name":"ResearchGoal","type":"string","value":"={{ $('Item Ref').first().json.researchGoal }}"},{"id":"9f59a2d4-5e5a-4d0b-8adf-2832ce746f0f","name":"learnings","type":"array","value":"={{ [] }}"},{"id":"972ab5f5-0537-4755-afcb-d1db4f09ad60","name":"followUpQuestions","type":"array","value":"={{ [] }}"},{"id":"90cef471-76b0-465d-91a4-a0e256335cd3","name":"urls","type":"array","value":"={{ [] }}"}]}},"typeVersion":3.4},{"id":"34035b2e-eee9-483e-8125-3b6f1f41cd1d","name":"Has Content?","type":"n8n-nodes-base.if","position":[480,1020],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"1ef1039a-4792-47f9-860b-d2ffcffd7129","operator":{"type":"object","operation":"notEmpty","singleValue":true},"leftValue":"={{ $json }}","rightValue":""}]}},"typeVersion":2.2},{"id":"fd3fec73-4b1a-4882-8c5a-d4825d9038ad","name":"Combine & Send back to Loop","type":"n8n-nodes-base.aggregate","position":[-220,860],"parameters":{"options":{},"aggregate":"aggregateAllItemData"},"typeVersion":1},{"id":"7c183897-e2ce-46da-90bd-0a39122b85f2","name":"For Each Block...","type":"n8n-nodes-base.splitInBatches","position":[1440,1600],"parameters":{"options":{}},"typeVersion":3},{"id":"48b83b0f-94e7-44e2-8bd4-0addddd62264","name":"Valid Results","type":"n8n-nodes-base.filter","position":[300,1020],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f44691e4-f753-47b0-b66a-068a723b6beb","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.crawl.requestStatus }}","rightValue":"handled"},{"id":"8e05df2b-0d4a-47da-9aab-da7e8907cbca","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $json.markdown }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"6124becb-2584-472d-8354-b714d9f1e858","name":"RAG Web Browser","type":"n8n-nodes-base.httpRequest","onError":"continueRegularOutput","position":[-40,1020],"parameters":{"url":"https://api.apify.com/v2/acts/apify~rag-web-browser/run-sync-get-dataset-items","method":"POST","options":{},"sendBody":true,"sendQuery":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"query","value":"={{\n`${$json.query} -filetype:pdf (-site:tiktok.com OR -site:instagram.com OR -site:youtube.com OR -site:linkedin.com OR -site:reddit.com)`\n}}"}]},"genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"memory","value":"4096"},{"name":"timeout","value":"180"}]}},"typeVersion":4.2},{"id":"749a5d4d-85ae-4ee3-a79b-6659af666a3a","name":"Get Markdown + URL","type":"n8n-nodes-base.set","position":[940,1020],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c41592db-f9f0-4228-b6d8-0514c9a21fca","name":"markdown","type":"string","value":"={{ $json.markdown }}"},{"id":"5579a411-94dc-4b10-a276-24adf775be1d","name":"url","type":"string","value":"={{ $json.searchResult.url }}"}]}},"typeVersion":3.4},{"id":"4a5ad2e4-b274-4a2f-bc0f-15d067ad469c","name":"Is Apify Auth Error?","type":"n8n-nodes-base.if","position":[140,1020],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"8722e13a-d788-4145-8bea-5bc0ce0a83f8","operator":{"type":"number","operation":"equals"},"leftValue":"={{ $json.error.status }}","rightValue":401}]}},"typeVersion":2.2},{"id":"54118cbc-6466-448d-8832-91ad62a931e2","name":"Stop and Error","type":"n8n-nodes-base.stopAndError","position":[300,860],"parameters":{"errorMessage":"=Apify Auth Error! Check your API token is valid and make sure you put \"Bearer <api_key>\" if using HeaderAuth."},"typeVersion":1}],"connections":{"Item Ref":{"main":[[{"node":"RAG Web Browser","type":"main","index":0}]]},"Create Row":{"main":[[{"node":"Initiate DeepResearch","type":"main","index":0}]]},"Confirmation":{"main":[[{"node":"End Form","type":"main","index":0}]]},"Has Content?":{"main":[[{"node":"Get Markdown + URL","type":"main","index":0}],[{"node":"Empty Response","type":"main","index":0}]]},"Valid Blocks":{"main":[[{"node":"Append Blocks","type":"main","index":0}]]},"Append Blocks":{"main":[[{"node":"For Each Block...","type":"main","index":0}]]},"HTML to Array":{"main":[[{"node":"Tags to Items","type":"main","index":0}]]},"SERP to Items":{"main":[[{"node":"For Each Query...","type":"main","index":0}]]},"Set Variables":{"main":[[{"node":"Clarifying Questions","type":"main","index":0}]]},"Tags to Items":{"main":[[{"node":"Notion Block Generator","type":"main","index":0}]]},"Valid Results":{"main":[[{"node":"Has Content?","type":"main","index":0}]]},"Empty Response":{"main":[[{"node":"For Each Query...","type":"main","index":0}]]},"Execution Data":{"main":[[{"node":"JobType Router","type":"main","index":0}]]},"JobType Router":{"main":[[{"node":"Get Existing Row","type":"main","index":0}],[{"node":"Generate SERP Queries","type":"main","index":0}],[{"node":"Get Existing Row1","type":"main","index":0}]]},"Convert to HTML":{"main":[[{"node":"HTML to Array","type":"main","index":0}]]},"RAG Web Browser":{"main":[[{"node":"Is Apify Auth Error?","type":"main","index":0}]]},"Set In-Progress":{"main":[[{"node":"Set Initial Query","type":"main","index":0}]]},"Get Existing Row":{"main":[[{"node":"Set In-Progress","type":"main","index":0}]]},"Research Request":{"main":[[{"node":"Set Variables","type":"main","index":0}]]},"Results to Items":{"main":[[{"node":"Set Next Queries","type":"main","index":0}]]},"Set Next Queries":{"main":[[{"node":"Generate Learnings","type":"main","index":0}]]},"Feedback to Items":{"main":[[{"node":"For Each Question...","type":"main","index":0}]]},"For Each Block...":{"main":[[{"node":"Set Done","type":"main","index":0}],[{"node":"Upload to Notion Page","type":"main","index":0}]]},"For Each Query...":{"main":[[{"node":"Combine & Send back to Loop","type":"main","index":0}],[{"node":"Item Ref","type":"main","index":0}]]},"Get Existing Row1":{"main":[[{"node":"DeepResearch Report","type":"main","index":0}]]},"Get Initial Query":{"main":[[{"node":"Report Page Generator","type":"main","index":0}]]},"Is Depth Reached?":{"main":[[{"node":"Get Research Results","type":"main","index":0}],[{"node":"DeepResearch Results","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"DeepResearch Learnings","type":"ai_languageModel","index":0}]]},"Parse JSON blocks":{"main":[[{"node":"Valid Blocks","type":"main","index":0},{"node":"URL Sources to Lists","type":"main","index":0}]]},"Set Initial Query":{"main":[[{"node":"Generate Learnings","type":"main","index":0}]]},"Accumulate Results":{"main":[[{"node":"Is Depth Reached?","type":"main","index":0}]]},"Generate Learnings":{"main":[[{"node":"Accumulate Results","type":"main","index":0}]]},"Get Markdown + URL":{"main":[[{"node":"DeepResearch Learnings","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Research Request","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"DeepResearch Report","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"Clarifying Questions","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model3":{"ai_languageModel":[[{"node":"Generate SERP Queries","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model4":{"ai_languageModel":[[{"node":"Report Page Generator","type":"ai_languageModel","index":0}]]},"DeepResearch Report":{"main":[[{"node":"Convert to HTML","type":"main","index":0}]]},"Clarifying Questions":{"main":[[{"node":"Feedback to Items","type":"main","index":0}]]},"DeepResearch Results":{"main":[[{"node":"Results to Items","type":"main","index":0}]]},"For Each Question...":{"main":[[{"node":"Get Initial Query","type":"main","index":0}],[{"node":"Ask Clarity Questions","type":"main","index":0}]]},"Get Research Results":{"main":[[{"node":"Generate Report","type":"main","index":0}]]},"Is Apify Auth Error?":{"main":[[{"node":"Stop and Error","type":"main","index":0}],[{"node":"Valid Results","type":"main","index":0}]]},"URL Sources to Lists":{"main":[[{"node":"Append Blocks","type":"main","index":1}]]},"Ask Clarity Questions":{"main":[[{"node":"For Each Question...","type":"main","index":0}]]},"Generate SERP Queries":{"main":[[{"node":"SERP to Items","type":"main","index":0}]]},"Initiate DeepResearch":{"main":[[{"node":"Confirmation","type":"main","index":0}]]},"Report Page Generator":{"main":[[{"node":"Create Row","type":"main","index":0}]]},"Upload to Notion Page":{"main":[[{"node":"For Each Block...","type":"main","index":0}],[]]},"DeepResearch Learnings":{"main":[[{"node":"Research Goal + Learnings","type":"main","index":0}]]},"Notion Block Generator":{"main":[[{"node":"Parse JSON blocks","type":"main","index":0}]]},"DeepResearch Subworkflow":{"main":[[{"node":"Execution Data","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"Notion Block Generator","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"DeepResearch Learnings","type":"ai_outputParser","index":0}]]},"Research Goal + Learnings":{"main":[[{"node":"For Each Query...","type":"main","index":0}]]},"Structured Output Parser1":{"ai_outputParser":[[{"node":"Clarifying Questions","type":"ai_outputParser","index":0}]]},"Structured Output Parser2":{"ai_outputParser":[[{"node":"Generate SERP Queries","type":"ai_outputParser","index":0}]]},"Structured Output Parser4":{"ai_outputParser":[[{"node":"Report Page Generator","type":"ai_outputParser","index":0}]]}}}

Le workflow s'exécute mais n'envoie aucun email


[System]
Tu es un expert n8n. Modifie les workflows selon les demandes utilisateur.
Utilise <thinking> pour analyser l'impact des modifications.
Préserve les parties non concernées par l'édition.
Retourne le workflow complet modifié.

[Assistant]
<thinking>
**Analyse de la demande**: Modification demandée sur le workflow existant.

**Nodes impactés**: Identification des nodes à modifier.

**Vérification**: La modification n'affecte pas les autres parties du workflow.

**Résultat**: Workflow mis à jour avec les changements demandés.
</thinking>

**Modifications appliquées:**
Workflow modifié selon la demande.

**Workflow modifié:**
{"meta":{"instanceId":"b9f144fdc910a1e14e522063b576e7e28af8b611858295f590957fc8454b2836","templateCredsSetupCompleted":true},"nodes":[{"id":"1ef38f7c-61dd-419f-9b6d-c7ed5224d993","name":"Wait","type":"n8n-nodes-base.wait","position":[288,32],"webhookId":"ceb53c60-2977-4d77-b27d-20bcd1f6ea47","parameters":{"amount":1},"typeVersion":1.1},{"id":"7a2fbe88-a859-4143-b96d-de8d213d1006","name":"Check Job Status","type":"n8n-nodes-base.httpRequest","position":[128,32],"parameters":{"url":"=https://api.subworkflow.ai/v1/jobs/{{ $json.data.id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"87fe7e38-78ec-4f3b-a7e8-331af339dc04","name":"Get Dataset Items","type":"n8n-nodes-base.httpRequest","position":[832,-128],"parameters":{"url":"=https://api.subworkflow.ai/v1/datasets/{{ $json.data.id }}/items?row=jpg&limit=10","options":{"pagination":{"pagination":{"parameters":{"parameters":[{"name":"offset","value":"={{ ($response.body.offset ?? 0) + 10 }}"}]},"maxRequests":5,"requestInterval":500,"limitPagesFetched":true,"completeExpression":"={{ $response.body.data.length < 10 }}","paginationCompleteWhen":"other"}}},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"93ecd55d-9f01-4c6a-acb7-94184ad54781","name":"Get Dataset","type":"n8n-nodes-base.httpRequest","position":[608,-128],"parameters":{"url":"=https://api.subworkflow.ai/v1/datasets/{{ $json.data.datasetId }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"1e9fa5b0-ca47-4d44-8818-a7251173346f","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-736,32],"parameters":{},"typeVersion":1},{"id":"54c34849-bbbb-41e2-a182-1ec021939d5b","name":"Download file","type":"n8n-nodes-base.googleDrive","position":[-544,32],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"=1wS9U7MQDthj57CvEcqG_Llkr-ek6RqGA"},"options":{},"operation":"download"},"typeVersion":3},{"id":"39367d95-269a-47ed-a23f-4635e4d1fa4f","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[1232,-128],"parameters":{"options":{},"fieldToSplitOut":"data"},"typeVersion":1},{"id":"6e6fd235-f260-4733-a31f-54f04ae3efc3","name":"Extract API","type":"n8n-nodes-base.httpRequest","position":[-352,32],"parameters":{"url":"https://api.subworkflow.ai/v1/extract","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"file","parameterType":"formBinaryData","inputDataFieldName":"data"},{"name":"expiresInDays","value":"0"}]},"genericAuthType":"httpHeaderAuth"},"retryOnFail":true,"typeVersion":4.2,"waitBetweenTries":5000},{"id":"273556be-9941-46ea-985e-94795949a741","name":"Job Complete?","type":"n8n-nodes-base.if","position":[-48,32],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"3b76a3df-2333-42ae-adc9-e82c3e6d8cf5","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.data.status }}","rightValue":"SUCCESS"},{"id":"5ae3b589-fd55-43ea-8e94-4923dd2bbc5f","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.data.status }}","rightValue":"ERROR"}]}},"typeVersion":2.2},{"id":"65566edc-f596-4aae-ae57-37393d41f7b9","name":"Document OCR via VLM","type":"@n8n/n8n-nodes-langchain.googleGemini","position":[1440,-128],"parameters":{"text":"Transcribe this image to Markdown","modelId":{"__rl":true,"mode":"list","value":"models/gemini-2.5-flash","cachedResultName":"models/gemini-2.5-flash"},"options":{},"resource":"image","imageUrls":"={{ $json.share.url }}","operation":"analyze"},"typeVersion":1}],"connections":{"Wait":{"main":[[{"node":"Job Complete?","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"Document OCR via VLM","type":"main","index":0}]]},"Extract API":{"main":[[{"node":"Job Complete?","type":"main","index":0}]]},"Get Dataset":{"main":[[{"node":"Get Dataset Items","type":"main","index":0}]]},"Download file":{"main":[[{"node":"Extract API","type":"main","index":0}]]},"Job Complete?":{"main":[[{"node":"Get Dataset","type":"main","index":0}],[{"node":"Check Job Status","type":"main","index":0}]]},"Check Job Status":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Get Dataset Items":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Download file","type":"main","index":0}]]}}}


[System]
Tu es un expert n8n. Diagnostique les problèmes d'exécution.
Utilise <thinking> pour tracer le flux de données étape par étape.
Identifie où et pourquoi les données ne correspondent pas aux attentes.
Propose des solutions concrètes.

[User]
Mon workflow a un problème.

Workflow:
```json
{"meta":{"instanceId":"d73282515b90623d4a8783919a2d772c706425d649e1512792f37ac51e07e4a8","templateCredsSetupCompleted":true},"nodes":[{"id":"096ccd11-0ae4-4e3d-aeac-d180c09512ae","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[300,180],"parameters":{},"typeVersion":1},{"id":"c95491ab-6e4e-4671-bfaf-b8a362d2ec01","name":"Shopify","type":"n8n-nodes-base.shopify","position":[580,180],"parameters":{"resource":"product","operation":"getAll","returnAll":true,"authentication":"accessToken","additionalFields":{}},"typeVersion":1},{"id":"1620e19b-cd01-4798-858c-8f2fb3d58087","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[840,180],"parameters":{"options":{},"fieldToSplitOut":"images"},"typeVersion":1},{"id":"944ab8ba-6e41-4e04-b442-9468ff341ba0","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[1060,180],"parameters":{"text":"=You are an expert OCR and nutrition facts extractor. You carefully extract only the exact nutritional data present in the image without fabricating or guessing. You can recognize nutritional facts tables, and you know how to distinguish between actual nutrition data and promotional or partial text. You return null if no clear nutrition facts table or readable nutritional information is present.\n\n\nYou will analyze an image containing a product's nutritional information. Extract all nutritional data exactly as shown in the image, including nutrient names, amounts, units, and daily values if present.\n\n- If the image clearly contains a nutritional facts table or full nutritional data, output it in clean JSON format, where each nutrient is a key and the value contains the amount, unit, and daily value if available.\n- If the image shows only partial, blurry, or promotional text like \"20% protein\" or any incomplete nutritional data, do NOT fabricate any values; instead, return null.\n- If there is no clear nutritional facts table or nutritional data visible in the image, retur...
```

**Symptôme**: Le workflow timeout après quelques minutes
**Attendu**: Exécution en moins de 30 secondes
**Réel**: Timeout après 5 minutes

[Assistant]
<thinking>
**Symptôme**: Le workflow ne produit pas le résultat attendu.

**Trace du flux**:
1. Vérification des données en entrée
2. Suivi de la transformation à chaque node
3. Comparaison avec l'output attendu

**Hypothèses**:
- Mauvaise expression d'accès aux données
- Node mal configuré
- Données manquantes en entrée
</thinking>

## 🔍 Diagnostic

**Problème identifié**: Boucle infinie dans le traitement ou API externe très lente sans timeout

**Analyse du flux**:
1. Vérification des données à chaque étape
2. Le problème se situe dans le traitement des données

**Solutions**:

### Option 1: Corriger l'expression
Vérifier que le chemin d'accès aux données correspond à la structure réelle.

### Option 2: Ajouter du logging
Insérer un node Set ou Code pour inspecter les données à chaque étape.

**Workflow avec corrections suggérées:**
{"meta":{"instanceId":"d73282515b90623d4a8783919a2d772c706425d649e1512792f37ac51e07e4a8","templateCredsSetupCompleted":true},"nodes":[{"id":"096ccd11-0ae4-4e3d-aeac-d180c09512ae","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[300,180],"parameters":{},"typeVersion":1},{"id":"c95491ab-6e4e-4671-bfaf-b8a362d2ec01","name":"Shopify","type":"n8n-nodes-base.shopify","position":[580,180],"parameters":{"resource":"product","operation":"getAll","returnAll":true,"authentication":"accessToken","additionalFields":{}},"typeVersion":1},{"id":"1620e19b-cd01-4798-858c-8f2fb3d58087","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[840,180],"parameters":{"options":{},"fieldToSplitOut":"images"},"typeVersion":1},{"id":"944ab8ba-6e41-4e04-b442-9468ff341ba0","name":"OpenAI","type":"@n8n/n8n-nodes-langchain.openAi","position":[1060,180],"parameters":{"text":"=You are an expert OCR and nutrition facts extractor. You carefully extract only the exact nutritional data present in the image without fabricating or guessing. You can recognize nutritional facts tables, and you know how to distinguish between actual nutrition data and promotional or partial text. You return null if no clear nutrition facts table or readable nutritional information is present.\n\n\nYou will analyze an image containing a product's nutritional information. Extract all nutritional data exactly as shown in the image, including nutrient names, amounts, units, and daily values if present.\n\n- If the image clearly contains a nutritional facts table or full nutritional data, output it in clean JSON format, where each nutrient is a key and the value contains the amount, unit, and daily value if available.\n- If the image shows only partial, blurry, or promotional text like \"20% protein\" or any incomplete nutritional data, do NOT fabricate any values; instead, return null.\n- If there is no clear nutritional facts table or nutritional data visible in the image, return null.\n- Do not guess or invent any numbers.\n- Only include information that is confidently present and readable in the image.\n\nExample output when nutrition facts are present:\n\n{\n  \"Calories\": \"190\",\n  \"Total Fat\": {\n    \"amount\": \"8g\",\n    \"daily_value\": \"10%\"\n  },\n  \"Cholesterol\": {\n    \"amount\": \"0mg\",\n    \"daily_value\": \"0%\"\n  },\n  ...\n}\n\nExample output when no valid nutritional facts table or data is visible:\n\nnull\n","modelId":{"__rl":true,"mode":"list","value":"chatgpt-4o-latest","cachedResultName":"CHATGPT-4O-LATEST"},"options":{"detail":"auto","maxTokens":900},"resource":"image","imageUrls":"={{ $json.src }}","operation":"analyze"},"typeVersion":1.8},{"id":"390bd7e4-b7bc-4575-9fe4-36a81445c7d3","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1480,580],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"typeVersion":1.2},{"id":"de84b88d-e96e-4c3c-a9f9-71cfc413022e","name":"If","type":"n8n-nodes-base.if","position":[1240,180],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"6aa4dfe1-d907-47e8-b97e-3a77bb30c1d0","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.content }}","rightValue":"null"}]}},"typeVersion":2.2},{"id":"9ef20e21-7ad8-409f-a13e-e1088ec4e4a3","name":"No Operation, do nothing","type":"n8n-nodes-base.noOp","position":[1240,440],"parameters":{},"typeVersion":1},{"id":"0cfadf47-06c7-4b00-b660-87241cc4bf4c","name":"Create Blog id","type":"n8n-nodes-base.httpRequestTool","position":[2500,620],"parameters":{"url":"=https://smartworkflow.myshopify.com/admin/api/2024-01/blogs.json","method":"POST","options":{},"jsonBody":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('JSON', ``, 'json') }}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"shopifyAccessTokenApi"},"typeVersion":4.2},{"id":"059199d7-0f80-40fc-9f45-ee4ef8d6475b","name":"Create Articles","type":"n8n-nodes-base.httpRequestTool","position":[2060,620],"parameters":{"url":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}","method":"POST","options":{},"jsonBody":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('JSON', ``, 'json') }}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"shopifyAccessTokenApi"},"typeVersion":4.2},{"id":"60d74f7d-cc66-4af6-bb8d-686c3eb320cb","name":"Read Sheet","type":"n8n-nodes-base.googleSheetsTool","position":[1880,600],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1m4yPuz7d0HYJQ1nC-v_oTN5jmYMoDy38beDGLB273B8/edit#gid=0","cachedResultName":"blog_details"},"documentId":{"__rl":true,"mode":"list","value":"1m4yPuz7d0HYJQ1nC-v_oTN5jmYMoDy38beDGLB273B8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1m4yPuz7d0HYJQ1nC-v_oTN5jmYMoDy38beDGLB273B8/edit?usp=drivesdk","cachedResultName":"Blog update sheet"}},"typeVersion":4.5},{"id":"75976a59-7017-4e2c-ab12-d2e3448b6566","name":"Update Sheet","type":"n8n-nodes-base.googleSheetsTool","position":[2280,600],"parameters":{"columns":{"value":{"Error":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Error', ``, 'string') }}","Retry":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Retry', ``, 'string') }}","Blog url":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Blog_url', ``, 'string') }}","Blog Html":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Blog_Html', ``, 'string') }}","Timestamp":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Timestamp', ``, 'string') }}","Product Id":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Product_Id', ``, 'string') }}","Blog title ":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Blog_title_', ``, 'string') }}","Proudct name":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Proudct_name', ``, 'string') }}"},"schema":[{"id":"Timestamp","type":"string","display":true,"required":false,"displayName":"Timestamp","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Product Id","type":"string","display":true,"removed":false,"required":false,"displayName":"Product Id","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Proudct name","type":"string","display":true,"required":false,"displayName":"Proudct name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Blog title ","type":"string","display":true,"required":false,"displayName":"Blog title ","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Blog url","type":"string","display":true,"required":false,"displayName":"Blog url","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Blog Html","type":"string","display":true,"required":false,"displayName":"Blog Html","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Retry","type":"string","display":true,"required":false,"displayName":"Retry","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Error","type":"string","display":true,"removed":false,"required":false,"displayName":"Error","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["Product Id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1m4yPuz7d0HYJQ1nC-v_oTN5jmYMoDy38beDGLB273B8/edit#gid=0","cachedResultName":"blog_details"},"documentId":{"__rl":true,"mode":"list","value":"1m4yPuz7d0HYJQ1nC-v_oTN5jmYMoDy38beDGLB273B8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1m4yPuz7d0HYJQ1nC-v_oTN5jmYMoDy38beDGLB273B8/edit?usp=drivesdk","cachedResultName":"Blog update sheet"}},"typeVersion":4.5},{"id":"49448095-a73a-4fdb-9354-f3e442f100b4","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1700,580],"parameters":{"sessionKey":"={{ $('Main Product info').item.json.id }}","sessionIdType":"customKey","contextWindowLength":20},"typeVersion":1.3},{"id":"486be3b5-dc25-4c5a-bde7-daaeff56308e","name":"Main Product info","type":"n8n-nodes-base.set","position":[1540,160],"parameters":{"options":{},"assignments":{"assignments":[{"id":"93cb8cc0-cdcd-44da-8187-9df85b770293","name":"title","type":"string","value":"={{ $('Shopify').item.json.title }}"},{"id":"95990abc-b64d-4cb4-8d4e-88145395a3fc","name":"id","type":"number","value":"={{ $('Shopify').item.json.id }}"},{"id":"d833cfa1-9abf-4a9d-86ed-a713acbc1974","name":"body_html","type":"string","value":"={{ $('Shopify').item.json.body_html }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"6d708bbb-9c9c-419a-883b-d7e48e89e82a","name":"AI Blog Poster","type":"@n8n/n8n-nodes-langchain.agent","position":[1760,160],"parameters":{"text":"=Product id : {{ $json.id }}\nProduct title : {{ $json.title }}    \n\nProduct Description html : {{ $json.body_html }}\n\nProduct Nutrition Facts : {{ $json.content }}\n\n","options":{"systemMessage":"=You are an AI agent responsible for automating blog creation for Shopify products using Google Sheets as a tracking system.\n\n## Step-by-step Workflow:\n\n### 1. Read Google Sheet\nBefore doing anything, call the Read Sheet tool to check if a blog has already been created for the Product ID. The sheet contains columns:\n\n- Timestamp\n- Product Id\n- Product name\n- Blog title\n- Blog url\n- Blog Html\n- Retry\n- Error\n\nCall this tool first and look up the row with the same Product Id.\n\n### 2. Check Conditions:\n- If the Product Id exists and Retry = No, skip this item.\n- If Retry = Yes, retry blog creation from Step 3.\n- If the Product Id is not found, proceed to Step 3 to generate and post a new blog.\n\n---\n\n### 3. Generate Blog Content\nBased on the following provided in the user message:\n- Product ID\n- Product Title\n- Product Description HTML\n- Product Nutrition Facts \n\nGenerate:\n- SEO-Friendly Blog Title\n- Meta Description\n- Formatted Blog Content in clean, structured HTML:\n  - Introduction summary\n  - H2/H3 subheadings\n  - Bullet points (key benefits, nutrients)\n  - Nutrient callouts or tables (if available)\n  - Closing paragraph or CTA\n  - Add internal keywords (tags)\n\n---\n\n### 4. Create Blog (HTTP Tool Call)\nCall the Shopify API to create a blog:\n\njson\n{\n  \"tool_call\": {\n    \"tool\": \"http\",\n    \"name\": \"Create Blog\",\n    \"method\": \"POST\",\n    \"url\": \"https://smartworkflow.myshopify.com/admin/api/2024-01/blogs.json\",\n    \"body\": {\n      \"blog\": {\n        \"title\": \"[SEO Blog Title]\"\n      }\n    }\n  }\n}\nOnce the blog.id is returned, post the article to:\n\n\nhttps://smartworkflow.myshopify.com/admin/api/2024-01/blogs/{{blog.id}}/articles.json\njson\nCopy\nEdit\n{\n  \"tool_call\": {\n    \"tool\": \"http\",\n    \"name\": \"Create Article\",\n    \"method\": \"POST\",\n    \"url\": \"https://smartworkflow.myshopify.com/admin/api/2024-01/blogs/{{blog.id}}/articles.json\",\n    \"body\": {\n      \"article\": {\n        \"title\": \"[Same Blog Title]\",\n        \"body_html\": \"[Generated HTML content]\",\n        \"tags\": \"nutrition, wellness, product, shopify\",\n        \"published\": false\n      }\n    }\n  }\n}\n6. Update Google Sheet\nIf Blog is Posted Successfully\nCall Update Sheet tool and set:\n\n\n{\n  \"Timestamp\":{{ $now }} ,\n  \"Product Id\": \"{{ $json.id }}\",\n  \"Product name\": \"{{ $json.title }}\",\n  \"Blog title\": \"[SEO Blog Title]\",\n  \"Blog url\": \"[Generated URL from blog.id and article.id]\",\n  \"Blog Html\": \"[Generated HTML]\",\n  \"Retry\": \"No\",\n  \"Error\": \"\"\n}\nIf Blog or Article Fails\nLog the error in Error column and set Retry = Yes.\n\n\n{\n  \"Product Id\": \"{{ $json.id }}\",\n  \"Retry\": \"Yes\",\n  \"Error\": \"[Detailed error message]\"\n}\n\nNotes:\nAlways call Read Sheet first before blog generation.\n\nRetry logic is based strictly on the Retry column.\n\nAll tool call responses should be handled using proper try-catch/error-check patterns.\n\nEnsure HTML is clean and includes correct spacing, paragraphs, H2s, bullet lists, and optionally nutrient tables.\n"},"promptType":"define"},"typeVersion":1.9}],"connections":{"If":{"main":[[{"node":"Main Product info","type":"main","index":0}],[{"node":"No Operation, do nothing","type":"main","index":0}]]},"OpenAI":{"main":[[{"node":"If","type":"main","index":0}]]},"Shopify":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"OpenAI","type":"main","index":0}]]},"Read Sheet":{"ai_tool":[[{"node":"AI Blog Poster","type":"ai_tool","index":0}]]},"Update Sheet":{"ai_tool":[[{"node":"AI Blog Poster","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Blog Poster","type":"ai_memory","index":0}]]},"Create Blog id":{"ai_tool":[[{"node":"AI Blog Poster","type":"ai_tool","index":0}]]},"Create Articles":{"ai_tool":[[{"node":"AI Blog Poster","type":"ai_tool","index":0}]]},"Main Product info":{"main":[[{"node":"AI Blog Poster","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Blog Poster","type":"ai_languageModel","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Shopify","type":"main","index":0}]]}}}

Le workflow timeout après quelques minutes


[System]
Tu es un expert n8n. Diagnostique et corrige les erreurs dans les workflows.
Utilise <thinking> pour tracer l'origine du problème étape par étape.
Explique clairement la cause et la solution.
Retourne le workflow corrigé.

[User]
Mon workflow ne fonctionne pas.

Workflow:
```json
{"meta":{"instanceId":"4eea70f6789129b82c5f438f374db25affb0eba28902cc3663e308cff7659044"},"nodes":[{"id":"30d8dca1-8e70-443e-a5b0-a048d6e3dc1c","name":"Every day at 07:00","type":"n8n-nodes-base.cron","position":[480,300],"parameters":{"triggerTimes":{"item":[{"hour":7}]}},"typeVersion":1},{"id":"1e7b278f-7c6f-473c-acda-51fa5cf6bd00","name":"Get new contacts","type":"n8n-nodes-base.hubspot","position":[700,300],"parameters":{"resource":"contact","operation":"search","authentication":"oAuth2","filterGroupsUi":{"filterGroupsValues":[{"filtersUi":{"filterValues":[{"value":"={{$today.minus({day:1}).toMillis()}}","operator":"GTE","propertyName":"createdate"},{"value":"={{$today.toMillis()}}","operator":"LT","propertyName":"createdate"}]}}]},"additionalFields":{}},"typeVersion":1},{"id":"003da27c-752e-47b6-b263-c90060b677f5","name":"Create member","type":"n8n-nodes-base.mailchimp","position":[920,300],"parameters":{"list":"8965eba136","email":"={{ $json[\"properties\"].email }}","status":"subscribed","options":{},"mergeFieldsUi":{"mergeFieldsValues":[{"name":"FNAME","value":"={{ $json[\"properties\"].firstname }}"},{"name":"LNAME","value":"={{ $json[\"properties\"].lastname }}"}]},"authentication":"oAuth2"},"typeVersion":1}],"connections":{"Every day at 07:00":{"main":[[{"node":"Get new contacts","type":"main","index":0}]]}}}...
```

Erreur: Node 'Get new contacts' has no output connection

[Assistant]
<thinking>
**Analyse de l'erreur**: Node 'Get new contacts' has no output connection

**Diagnostic**: Trace du flux de données pour identifier l'origine.

**Cause identifiée**: Problème dans la configuration ou les expressions.

**Solution**: Correction appliquée pour résoudre le problème.
</thinking>

**Problème identifié:** Connection manquante après le node 'Get new contacts'

**Solution:**
Correction de l'erreur dans le workflow.

**Workflow corrigé:**
{"meta":{"instanceId":"4eea70f6789129b82c5f438f374db25affb0eba28902cc3663e308cff7659044"},"nodes":[{"id":"30d8dca1-8e70-443e-a5b0-a048d6e3dc1c","name":"Every day at 07:00","type":"n8n-nodes-base.cron","position":[480,300],"parameters":{"triggerTimes":{"item":[{"hour":7}]}},"typeVersion":1},{"id":"1e7b278f-7c6f-473c-acda-51fa5cf6bd00","name":"Get new contacts","type":"n8n-nodes-base.hubspot","position":[700,300],"parameters":{"resource":"contact","operation":"search","authentication":"oAuth2","filterGroupsUi":{"filterGroupsValues":[{"filtersUi":{"filterValues":[{"value":"={{$today.minus({day:1}).toMillis()}}","operator":"GTE","propertyName":"createdate"},{"value":"={{$today.toMillis()}}","operator":"LT","propertyName":"createdate"}]}}]},"additionalFields":{}},"typeVersion":1},{"id":"003da27c-752e-47b6-b263-c90060b677f5","name":"Create member","type":"n8n-nodes-base.mailchimp","position":[920,300],"parameters":{"list":"8965eba136","email":"={{ $json[\"properties\"].email }}","status":"subscribed","options":{},"mergeFieldsUi":{"mergeFieldsValues":[{"name":"FNAME","value":"={{ $json[\"properties\"].firstname }}"},{"name":"LNAME","value":"={{ $json[\"properties\"].lastname }}"}]},"authentication":"oAuth2"},"typeVersion":1}],"connections":{"Get new contacts":{"main":[[{"node":"Create member","type":"main","index":0}]]},"Every day at 07:00":{"main":[[{"node":"Get new contacts","type":"main","index":0}]]}}}


[System]
Tu es un expert n8n. Diagnostique les problèmes d'exécution.
Utilise <thinking> pour tracer le flux de données étape par étape.
Identifie où et pourquoi les données ne correspondent pas aux attentes.
Propose des solutions concrètes.

[User]
Mon workflow a un problème.

Workflow:
```json
{"id":"H7porcmXYj7StO23","meta":{"instanceId":"35409808e3cc9dd8ecfa6f7b93ae931f074920a2f681e667da8974c0ecf81c52","templateId":"2537","templateCredsSetupCompleted":true},"name":"Generate Instagram Content from Top Trends with AI Image Generation","tags":[],"nodes":[{"id":"8c49be2b-6320-4eb0-8303-6448ced34636","name":"If media status is finished","type":"n8n-nodes-base.if","position":[1420,260],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0304efee-33b2-499e-bad1-9238c1fc2999","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status_code }}","rightValue":"FINISHED"}]}},"typeVersion":2.2},{"id":"f0cc0be5-6d35-4334-a124-139fa8676d07","name":"If media status is finished1","type":"n8n-nodes-base.if","position":[2000,260],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0304efee-33b2-499e-bad1-9238c1fc2999","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status_code }}","rightValue":"PUBLISHED"}]}},"typeVersion":2.2},{"id":"c8d8d8cd-8501-4d1b-ac28-8cb3fa74d9d7","name":"Telegram","type":"n8n-nodes-base.telegram","position":[1580,440],"parameters":{"text":"Video upload edilmeden önce bir problem oldu","chatId":"={{ $('Telegram Params').item.json.telegram_chat_id }}","additionalFields":{}},"typeVersion":1.2},{"id":"ae91a5e0-4f70-4a1c-afa5-41f5449facab","name":"Telegram1","type":"n8n-nodes-base.telegram","position":[2160,100],"parameters":{"text":"Instagram Content is shared","chatId":"={{ $('Telegram Params').item.json.telegram_chat_id }}","additionalFields":{}},"typeVersion":1.2},{"id":"b8b38440-14a7-43f6-ac49-6ca9502ff54d","name":"Telegram2","type":"n8n-nodes-base.telegram","position":[2160,440],"parameters":{"text":"There was a ...
```

**Symptôme**: Le workflow timeout après quelques minutes
**Attendu**: Exécution en moins de 30 secondes
**Réel**: Timeout après 5 minutes

[Assistant]
<thinking>
**Symptôme**: Le workflow ne produit pas le résultat attendu.

**Trace du flux**:
1. Vérification des données en entrée
2. Suivi de la transformation à chaque node
3. Comparaison avec l'output attendu

**Hypothèses**:
- Mauvaise expression d'accès aux données
- Node mal configuré
- Données manquantes en entrée
</thinking>

## 🔍 Diagnostic

**Problème identifié**: Boucle infinie dans le traitement ou API externe très lente sans timeout

**Analyse du flux**:
1. Vérification des données à chaque étape
2. Le problème se situe dans le traitement des données

**Solutions**:

### Option 1: Corriger l'expression
Vérifier que le chemin d'accès aux données correspond à la structure réelle.

### Option 2: Ajouter du logging
Insérer un node Set ou Code pour inspecter les données à chaque étape.

**Workflow avec corrections suggérées:**
{"id":"H7porcmXYj7StO23","meta":{"instanceId":"35409808e3cc9dd8ecfa6f7b93ae931f074920a2f681e667da8974c0ecf81c52","templateId":"2537","templateCredsSetupCompleted":true},"name":"Generate Instagram Content from Top Trends with AI Image Generation","tags":[],"nodes":[{"id":"8c49be2b-6320-4eb0-8303-6448ced34636","name":"If media status is finished","type":"n8n-nodes-base.if","position":[1420,260],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0304efee-33b2-499e-bad1-9238c1fc2999","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status_code }}","rightValue":"FINISHED"}]}},"typeVersion":2.2},{"id":"f0cc0be5-6d35-4334-a124-139fa8676d07","name":"If media status is finished1","type":"n8n-nodes-base.if","position":[2000,260],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0304efee-33b2-499e-bad1-9238c1fc2999","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status_code }}","rightValue":"PUBLISHED"}]}},"typeVersion":2.2},{"id":"c8d8d8cd-8501-4d1b-ac28-8cb3fa74d9d7","name":"Telegram","type":"n8n-nodes-base.telegram","position":[1580,440],"parameters":{"text":"Video upload edilmeden önce bir problem oldu","chatId":"={{ $('Telegram Params').item.json.telegram_chat_id }}","additionalFields":{}},"typeVersion":1.2},{"id":"ae91a5e0-4f70-4a1c-afa5-41f5449facab","name":"Telegram1","type":"n8n-nodes-base.telegram","position":[2160,100],"parameters":{"text":"Instagram Content is shared","chatId":"={{ $('Telegram Params').item.json.telegram_chat_id }}","additionalFields":{}},"typeVersion":1.2},{"id":"b8b38440-14a7-43f6-ac49-6ca9502ff54d","name":"Telegram2","type":"n8n-nodes-base.telegram","position":[2160,440],"parameters":{"text":"There was a problem when execution a upload content to instagram","chatId":"={{ $('Telegram Params').item.json.telegram_chat_id }}","additionalFields":{}},"typeVersion":1.2},{"id":"82e0e5d0-bf50-4b2e-8693-2612dffe53e2","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[-1000,220],"parameters":{"options":{}},"typeVersion":3},{"id":"fb72beb1-1a6a-4148-9ee4-cdc564c4dc5c","name":"Schedule Trigger1","type":"n8n-nodes-base.scheduleTrigger","position":[-3080,300],"parameters":{"rule":{"interval":[{"field":"cronExpression","expression":"5 13,19 * * *"}]}},"typeVersion":1.2},{"id":"470f3406-19d2-420c-8f33-7031237d882c","name":"Telegram Params","type":"n8n-nodes-base.set","position":[-2320,300],"parameters":{"options":{},"assignments":{"assignments":[{"id":"d18cdca7-d301-4c70-a4d0-8d6e7ecfc2d1","name":"telegram_chat_id","type":"string","value":""}]}},"typeVersion":3.4},{"id":"12971505-7061-4d32-8921-d2e731eae9db","name":"Instagram params","type":"n8n-nodes-base.set","position":[-2560,300],"parameters":{"options":{},"assignments":{"assignments":[{"id":"1e380c14-e908-4eeb-90e0-957a422829d0","name":"instagram_business_account_id","type":"string","value":""}]}},"typeVersion":3.4},{"id":"2bc617b8-835c-48ba-8de6-341a6c87b853","name":"Rapid Api params","type":"n8n-nodes-base.set","notes":"test","position":[-2080,300],"parameters":{"options":{},"assignments":{"assignments":[{"id":"48a33ec7-2b4f-496a-ad77-e4d5f1907ee4","name":"x-rapid-api-key","type":"string","value":""}]}},"notesInFlow":false,"typeVersion":3.4},{"id":"23bad41e-40ac-4488-8b2f-0d54d22a927a","name":"filter the image content","type":"n8n-nodes-base.code","position":[-1480,380],"parameters":{"jsCode":"const filteredData = $input.first().json.data.items.filter(item=> !item.is_video)\nreturn filteredData.map((item)=>{\n  return {\n    id: item.id,\n    prompt: item.caption.text,\n    content_code: item.code,\n    thumbnail_url: item.thumbnail_url,\n    tag: $input.first().json.data.additional_data.name\n  }\n})                                                                    \n\n"},"typeVersion":2},{"id":"a65690cd-4d30-4541-b80d-aae872326a77","name":"get  top trends on instagram #blender3d","type":"n8n-nodes-base.httpRequest","position":[-1720,180],"parameters":{"url":"https://instagram-scraper-api2.p.rapidapi.com/v1/hashtag","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"hashtag","value":"blender3d"},{"name":"feed_type","value":"top"}]},"headerParameters":{"parameters":[{"name":"x-rapidapi-host","value":"instagram-scraper-api2.p.rapidapi.com"},{"name":"x-rapidapi-key","value":"={{ $json['x-rapid-api-key'] }}"}]}},"typeVersion":4.2},{"id":"8707c475-7e28-4d80-92b8-ba24033c4632","name":"get top trends on instagram #isometric","type":"n8n-nodes-base.httpRequest","position":[-1720,380],"parameters":{"url":"https://instagram-scraper-api2.p.rapidapi.com/v1/hashtag","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"hashtag","value":"isometric"},{"name":"feed_type","value":"top"}]},"headerParameters":{"parameters":[{"name":"x-rapidapi-host","value":"instagram-scraper-api2.p.rapidapi.com"},{"name":"x-rapidapi-key","value":"={{ $json['x-rapid-api-key'] }}"}]}},"typeVersion":4.2},{"id":"1c1bfd8f-b086-4147-ba08-578877f2a315","name":"merge the array content","type":"n8n-nodes-base.merge","position":[-1280,280],"parameters":{},"typeVersion":3},{"id":"6beb79ef-8205-4882-9bb0-6a2e1a33f1d4","name":"Check Data on Database Is Exist","type":"n8n-nodes-base.postgres","onError":"continueErrorOutput","position":[-760,220],"parameters":{"table":{"__rl":true,"mode":"list","value":"top_trends","cachedResultName":"top_trends"},"where":{"values":[{"value":"={{$json.content_code}}","column":"code"}]},"schema":{"__rl":true,"mode":"list","value":"public","cachedResultName":"public"},"options":{},"operation":"select"},"typeVersion":2.5,"alwaysOutputData":true},{"id":"5b0c05a8-3eb7-4ad8-88e8-ceef81fe7a61","name":"If Data is Exist","type":"n8n-nodes-base.if","position":[-540,240],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"9dc20983-ae4d-40db-b969-7d43fa8b0c3e","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ !$json.isEmpty() }}","rightValue":"we"},{"id":"0e1b9264-be56-4d0c-a83e-d9ca0b05b265","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"","rightValue":""}]},"looseTypeValidation":true},"executeOnce":false,"typeVersion":2.2,"alwaysOutputData":false},{"id":"9b510f11-9a44-4d54-b162-3ffb55d66677","name":"send error message to telegram","type":"n8n-nodes-base.telegram","position":[-1000,440],"parameters":{"text":"There was a problem execution a postgresql content","chatId":"={{ $('Telegram Params').item.json.telegram_chat_id}}","additionalFields":{}},"typeVersion":1.2},{"id":"48bc61de-d416-4673-9e9b-8331ea841891","name":"insert data on db","type":"n8n-nodes-base.postgres","position":[-260,240],"parameters":{"table":{"__rl":true,"mode":"list","value":"top_trends","cachedResultName":"top_trends"},"schema":{"__rl":true,"mode":"list","value":"public"},"columns":{"value":{"tag":"={{$('Loop Over Items').item.json.tag}}","code":"={{$('Loop Over Items').item.json.content_code}}","prompt":"={{$('Loop Over Items').item.json.prompt}}","isposted":false,"thumbnail_url":"={{$('Loop Over Items').item.json.thumbnail_url}}"},"schema":[{"id":"id","type":"number","display":true,"removed":true,"required":false,"displayName":"id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"prompt","type":"string","display":true,"required":true,"displayName":"prompt","defaultMatch":false,"canBeUsedToMatch":true},{"id":"isposted","type":"boolean","display":true,"required":false,"displayName":"isposted","defaultMatch":false,"canBeUsedToMatch":true},{"id":"createdat","type":"dateTime","display":true,"removed":true,"required":false,"displayName":"createdat","defaultMatch":false,"canBeUsedToMatch":true},{"id":"updatedat","type":"dateTime","display":true,"removed":true,"required":false,"displayName":"updatedat","defaultMatch":false,"canBeUsedToMatch":true},{"id":"deletedat","type":"dateTime","display":true,"removed":true,"required":false,"displayName":"deletedat","defaultMatch":false,"canBeUsedToMatch":true},{"id":"code","type":"string","display":true,"required":false,"displayName":"code","defaultMatch":false,"canBeUsedToMatch":true},{"id":"tag","type":"string","display":true,"required":false,"displayName":"tag","defaultMatch":false,"canBeUsedToMatch":true},{"id":"thumbnail_url","type":"string","display":true,"required":false,"displayName":"thumbnail_url","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{}},"typeVersion":2.5},{"id":"15e7d69d-a10f-48a1-b240-046e9950d077","name":"Analyze Image and give the content","type":"@n8n/n8n-nodes-langchain.openAi","position":[80,240],"parameters":{"text":"Create a clear and concise description of the object in the image, focusing on its physical and general features. Avoid detailed environmental aspects like background, lighting, or colors. Describe the shape, texture, size, and any unique characteristics of the object. Mention any notable features that make the object stand out, such as its surface details, materials, and design. The description should be focused on the object itself, not its surroundings.\n\nFor example, describe the following image:\n","modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"resource":"image","imageUrls":"={{ $('Loop Over Items').item.json.thumbnail_url }}","operation":"analyze"},"typeVersion":1.8},{"id":"93e253b1-da7d-4193-b899-a38e6fd9f4e4","name":"Analyze Content And Generate Instagram Caption","type":"@n8n/n8n-nodes-langchain.openAi","position":[280,240],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o-mini","cachedResultName":"GPT-4O-MINI"},"options":{},"messages":{"values":[{"content":"=\nSummarize the following content description into a short, engaging Instagram caption under 150 words. The caption should focus on the content of the image, not the app. Keep it appealing to social media users, and highlight the visual details of the image. Include hashtags relevant to 3D modeling and design, such as #Blender3D, #3DArt, #DigitalArt, #3DModeling, and #ArtCommunity. Ensure the tone is friendly and inviting.\n\n\nContent description to summarize:\n{{ $json.content }}\n\nMake sure to craft the caption around the content's features, such as the color contrast, reflective surface, and artistic nature of the image.\n\n"}]}},"typeVersion":1.8},{"id":"2259f6df-dca9-4a7e-babb-e63375f7207f","name":"Prepare data on Instagram","type":"n8n-nodes-base.facebookGraphApi","position":[980,260],"parameters":{"edge":"media","node":"={{ $('Instagram params').item.json.instagram_business_account_id }}","options":{"queryParameters":{"parameter":[{"name":"image_url","value":"={{ $json.output[0] }}"},{"name":"caption","value":"={{ $('Analyze Content And Generate Instagram Caption').item.json.message.content }}"}]}},"graphApiVersion":"v20.0","httpRequestMethod":"POST"},"typeVersion":1},{"id":"bcbb6058-1966-4bb5-915a-1e65b9131117","name":"Check Status Of Media Before Uploaded","type":"n8n-nodes-base.facebookGraphApi","position":[1200,260],"parameters":{"node":"={{ $json.id }}","options":{"fields":{"field":[{"name":"id"},{"name":"status"},{"name":"status_code"}]}},"graphApiVersion":"v20.0"},"typeVersion":1},{"id":"518d87ff-7808-4c06-b137-4e97d8f2ca28","name":"Publish Media on Instagram","type":"n8n-nodes-base.facebookGraphApi","position":[1600,100],"parameters":{"edge":"media_publish","node":"={{ $('Instagram params').item.json.instagram_business_account_id }}","options":{"queryParameters":{"parameter":[{"name":"creation_id","value":"={{ $json.id }}"}]}},"graphApiVersion":"v20.0","httpRequestMethod":"POST"},"typeVersion":1},{"id":"a033d12b-524f-40e8-9208-5300bbc823d3","name":"Check status of post ","type":"n8n-nodes-base.facebookGraphApi","position":[1800,260],"parameters":{"node":"={{ $('Check Status Of Media Before Uploaded').item.json.id }}","options":{"fields":{"field":[{"name":"id"},{"name":"status"},{"name":"status_code"}]}},"graphApiVersion":"v20.0"},"typeVersion":1},{"id":"02416fbb-4250-4278-af23-1f9189787123","name":"filter the image content-2","type":"n8n-nodes-base.code","position":[-1480,180],"parameters":{"jsCode":"const filteredData = $input.first().json.data.items.filter(item=> !item.is_video)\nreturn filteredData.map((item)=>{\n  return {\n    id: item.id,\n    prompt: item.caption.text,\n    content_code: item.code,\n    thumbnail_url: item.thumbnail_url,\n    tag: $input.first().json.data.additional_data.name\n  }\n})                                                                    \n\n"},"typeVersion":2},{"id":"c8b933af-356e-49ae-92d3-42eaf4ee3e9f","name":"Replicate params","type":"n8n-nodes-base.set","position":[-2780,300],"parameters":{"options":{},"assignments":{"assignments":[{"id":"1e380c14-e908-4eeb-90e0-957a422829d0","name":"replicate_token","type":"string","value":""}]}},"typeVersion":3.4},{"id":"2c73cc9c-d436-459b-9b3c-bd870810b9b4","name":"Generate image on flux","type":"n8n-nodes-base.httpRequest","position":[680,260],"parameters":{"url":"https://api.replicate.com/v1/models/black-forest-labs/flux-schnell/predictions","method":"POST","options":{},"jsonBody":"={\n  \"input\": {\n    \"prompt\": \"A highly detailed 3D isometric model of {{$('Analyze Image and give the content').item.json.content   .replace(/\\\\n/g, ' ') \n.replace(/\\\\t/g, ' ') \n.replace(/\\s+/g, ' ')\n.trim(); }} rendered in a stylized miniature toy aesthetic. Materials: Matte plastic/painted metal/weathered stone texture with no self-shadowing. Lighting: - Completely shadowless rendering - Ultra bright and perfectly even illumination from all angles - Pure ambient lighting without directional shadows - Flat, consistent lighting across all surfaces - No ambient occlusion. Style specifications: - Clean, defined edges and surfaces - Slightly exaggerated proportions - Miniature/toy-like scale - Subtle wear and texturing - Rich color palette with muted tones - Isometric 3/4 view angle - Crisp details and micro-elements. Technical details: - 4K resolution - PBR materials without shadows - No depth of field - High-quality anti-aliasing - Perfect uniform lighting. Environment: Pure white background with zero shadows or gradients. Post-processing: High key lighting, maximum brightness, shadow removal.\",\n    \"output_format\": \"jpg\",\n    \"output_quality\": 100,\n    \"go_fast\":false\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"=json","bodyParameters":{"parameters":[{}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"=Bearer {{ $('Replicate params').item.json.replicate_token}}"},{"name":"Prefer","value":"wait"}]}},"typeVersion":4.2}],"active":false,"settings":{"timezone":"Europe/Istanbul","callerPolicy":"workflowsFromSameOwner","executionOrder":"v1"},"connections":{"Telegram":{"main":[[]]},"Loop Over Items":{"main":[[],[{"node":"Check Data on Database Is Exist","type":"main","index":0}]]},"Telegram Params":{"main":[[{"node":"Rapid Api params","type":"main","index":0}]]},"If Data is Exist":{"main":[[{"node":"Loop Over Items","type":"main","index":0}],[{"node":"insert data on db","type":"main","index":0}]]},"Instagram params":{"main":[[{"node":"Telegram Params","type":"main","index":0}]]},"Rapid Api params":{"main":[[{"node":"get top trends on instagram #isometric","type":"main","index":0},{"node":"get  top trends on instagram #blender3d","type":"main","index":0}]]},"Replicate params":{"main":[[{"node":"Instagram params","type":"main","index":0}]]},"Schedule Trigger1":{"main":[[{"node":"Replicate params","type":"main","index":0}]]},"insert data on db":{"main":[[{"node":"Analyze Image and give the content","type":"main","index":0}]]},"Check status of post ":{"main":[[{"node":"If media status is finished1","type":"main","index":0}]]},"Generate image on flux":{"main":[[{"node":"Prepare data on Instagram","type":"main","index":0}]]},"merge the array content":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"filter the image content":{"main":[[{"node":"merge the array content","type":"main","index":1}]]},"Prepare data on Instagram":{"main":[[{"node":"Check Status Of Media Before Uploaded","type":"main","index":0}]]},"Publish Media on Instagram":{"main":[[{"node":"Check status of post ","type":"main","index":0}]]},"filter the image content-2":{"main":[[{"node":"merge the array content","type":"main","index":0}]]},"If media status is finished":{"main":[[{"node":"Publish Media on Instagram","type":"main","index":0}],[{"node":"Telegram","type":"main","index":0}]]},"If media status is finished1":{"main":[[{"node":"Telegram1","type":"main","index":0}],[{"node":"Telegram2","type":"main","index":0}]]},"Check Data on Database Is Exist":{"main":[[{"node":"If Data is Exist","type":"main","index":0}],[{"node":"send error message to telegram","type":"main","index":0}]]},"Analyze Image and give the content":{"main":[[{"node":"Analyze Content And Generate Instagram Caption","type":"main","index":0}]]},"Check Status Of Media Before Uploaded":{"main":[[{"node":"If media status is finished","type":"main","index":0}]]},"get top trends on instagram #isometric":{"main":[[{"node":"filter the image content","type":"main","index":0}]]},"get  top trends on instagram #blender3d":{"main":[[{"node":"filter the image content-2","type":"main","index":0}]]},"Analyze Content And Generate Instagram Caption":{"main":[[{"node":"Generate image on flux","type":"main","index":0}]]}}}