[System]
Tu es un expert n8n. Crée des workflows JSON complets et fonctionnels.
Utilise <thinking> pour expliquer ton raisonnement avant de générer le JSON.
Structure ton thinking: analyse du besoin, choix du trigger, architecture, flux de données, points d'attention.

[User] Crée un workflow n8n pour: Introduction Automate price monitoring for e-commerce competitors—ideal for retailers, analysts, and pricing teams. Scrapes competitor sites, extracts pricing/stock data via AI, detects changes, and sends instant alerts for dynamic pricing strategies. How It Works Scrapes competitor URLs via Firecrawl and Apify, extracts data with AI, detects price/stock changes, logs to Google Sheets, and sends Telegram alerts. Workflow Template Trigger → Scrape URL → AI Extract → Parse → Merge Historical → Detect Changes → Update Sheets + Send Telegram Alert Workflow Steps Trigger & Scrape → Manual/scheduled trigger → Firecrawl + Apify fetch competitor data AI Processing → Claude extracts product details → Parses and structures data Change Detection → Reads historical prices → Merges with current data →

[Assistant]
<thinking>
**Analyse du besoin**

Ce workflow répond à un besoin critique en e-commerce : la surveillance automatisée des prix concurrents. Les équipes pricing doivent réagir rapidement aux changements de prix pour rester compétitives. Le challenge principal est l'extraction fiable de données depuis des sites web dynamiques qui peuvent utiliser du JavaScript, avoir des structures différentes, et implémenter des mesures anti-scraping. La valeur ajoutée réside dans l'automatisation complète du processus, de la collecte à l'alerte, permettant des décisions pricing en temps réel.

**Choix techniques**

L'utilisation combinée de Firecrawl et Apify est judicieuse car elle offre une redondance et une flexibilité d'extraction. Firecrawl excelle sur les sites modernes avec JavaScript, tandis qu'Apify propose des scrapers spécialisés par plateforme. L'intégration de l'IA pour l'extraction de données est particulièrement pertinente car elle permet de gérer la variabilité des structures HTML entre concurrents sans avoir à maintenir des sélecteurs CSS complexes. Google Sheets comme base de données historique facilite l'accès aux données non-techniques, et Telegram assure des notifications instantanées avec une API simple.

**Architecture**

Le workflow suit une logique séquentielle optimale : déclenchement programmé → scraping → extraction intelligente → parsing et validation → fusion avec l'historique → détection de changements → alertes conditionnelles. L'architecture modulaire permet de traiter plusieurs concurrents en parallèle. La séparation entre extraction brute et parsing structuré facilite le debugging et la maintenance. Le merge avec l'historique est crucial pour la détection de tendances et l'évitement de fausses alertes sur des fluctuations temporaires.

**Points d'attention**

La robustesse du scraping est critique : il faut prévoir la gestion des timeouts, des captchas, et des changements de structure des sites. L'IA d'extraction doit être promptée précisément pour garantir la cohérence des données extraites. La fréquence de scraping doit équilibrer réactivité et respect des serveurs cibles. Il est essentiel d'implémenter une validation des données pour éviter les alertes sur des erreurs d'extraction. La gestion des erreurs et des logs détaillés faciliteront la maintenance. Enfin, la scalabilité doit être anticipée si le nombre de concurrents surveillés augmente significativement.
</thinking>

{"id":"YnD0kvM9AYMjYxmj","meta":{"instanceId":"b91e510ebae4127f953fd2f5f8d40d58ca1e71c746d4500c12ae86aad04c1502","templateCredsSetupCompleted":true},"name":"Multi-Site Product Price Monitor: Claude-Sonnet , Google Sheets & Telegram Alert","tags":[{"id":"7zsdOA50QGm7RNqx","name":"Monitoring","createdAt":"2025-10-23T16:41:17.031Z","updatedAt":"2025-10-23T16:41:17.031Z"},{"id":"BL8TsHYj5FkNYzfi","name":"E-commerce","createdAt":"2025-10-23T16:41:16.985Z","updatedAt":"2025-10-23T16:41:16.985Z"},{"id":"dlf9zFSN3j6s2jgO","name":"Business Intelligence","createdAt":"2025-10-23T16:41:17.008Z","updatedAt":"2025-10-23T16:41:17.008Z"},{"id":"lpozR2Ct8reF9bCk","name":"AI","createdAt":"2025-10-23T16:41:17.062Z","updatedAt":"2025-10-23T16:41:17.062Z"}],"nodes":[{"id":"306294b3-27b8-4821-9b04-0e8d210af07e","name":"⏰ Monitor Every 6 Hours","type":"n8n-nodes-base.scheduleTrigger","notes":"Triggers the workflow every 6 hours to check competitor data","position":[-832,352],"parameters":{"rule":{"interval":[{"field":"hours","hoursInterval":6}]}},"typeVersion":1.2},{"id":"8b934690-1e26-4810-820d-8ff785691adf","name":"Scrape a url and get its content","type":"@mendable/n8n-nodes-firecrawl.firecrawl","position":[-1408,96],"parameters":{"url":"https://www.on.com/en-sg/shop/mens/shoes","operation":"scrape","scrapeOptions":{"options":{"formats":{"format":[{"type":"json","prompt":"price of the shoe"}]},"headers":{}}},"requestOptions":{}},"typeVersion":1},{"id":"90ed5eb7-6236-47e1-88c6-c5278efe24fa","name":"Message a model","type":"n8n-nodes-base.perplexity","position":[-1568,0],"parameters":{"model":"sonar","options":{},"messages":{"message":[{"content":"Price of the shoe  "}]},"requestOptions":{}},"typeVersion":1},{"id":"e1e006de-d363-4e5a-adbd-77ffc901f42d","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[-1296,0],"parameters":{"options":{},"fieldToSplitOut":"citations"},"typeVersion":1},{"id":"11fdf8bc-aa37-4f42-8bbe-8e16c47c8b47","name":"Get Results Apify","type":"n8n-nodes-base.httpRequest","position":[-1216,272],"parameters":{"url":"https://api.apify.com/v2/acts/compass~google-maps-extractor/runs/last/dataset/items?token=YOUR API KEY","options":{},"authentication":"genericCredentialType","genericAuthType":"httpBearerAuth"},"typeVersion":4.2,"alwaysOutputData":true},{"id":"b6a20e25-d82a-493b-b305-066e043f6ba1","name":"Start Actor Apify","type":"n8n-nodes-base.httpRequest","position":[-1616,272],"parameters":{"url":"https://api.apify.com/v2/acts/compass~google-maps-extractor/runs?token=YOUR API KEY","method":"POST","options":{},"jsonBody":"{\n    \"language\": \"en\",\n    \"locationQuery\": \"worldwide\",\n    \"maxCrawledPlacesPerSearch\": 50,\n    \"searchStringsArray\": [\n        \"shoe stores\",\n        \"shoe shops\"\n    ],\n    \"skipClosedPlaces\": false\n}","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpBearerAuth"},"typeVersion":4.2,"alwaysOutputData":true},{"id":"47a1e71a-6bbf-4cfe-82f1-b46744d247ee","name":"Converts unstructured AI text into organized, usable data fields","type":"n8n-nodes-base.code","notes":"Parses and validates the AI extracted data","position":[-576,192],"parameters":{"jsCode":"// Parse AI response and clean data\nconst items = [];\n\nfor (const item of $input.all()) {\n  try {\n    // Parse the AI response\n    let parsed;\n    const response = item.json.choices?.[0]?.message?.content || item.json.message || '';\n    \n    // Remove markdown code blocks if present\n    const cleaned = response.replace(/```json\\n?|```\\n?/g, '').trim();\n    \n    try {\n      parsed = JSON.parse(cleaned);\n    } catch (e) {\n      // Try to extract JSON from the response\n      const jsonMatch = cleaned.match(/\\{[\\s\\S]*\\}/);\n      if (jsonMatch) {\n        parsed = JSON.parse(jsonMatch[0]);\n      } else {\n        throw new Error('Could not parse JSON from AI response');\n      }\n    }\n    \n    // Enrich with metadata\n    items.push({\n      json: {\n        ...parsed,\n        scrapedAt: new Date().toISOString(),\n        priceChange: 0, // Will be calculated in comparison\n        priceChangePercent: 0,\n        isNewLow: false,\n        alertLevel: 'none'\n      }\n    });\n  } catch (error) {\n    console.error('Failed to parse item:', error.message);\n    // Add error item for debugging\n    items.push({\n      json: {\n        error: error.message,\n        rawResponse: item.json,\n        competitorName: 'Parse Error',\n        scrapedAt: new Date().toISOString()\n      }\n    });\n  }\n}\n\nreturn items;"},"typeVersion":2},{"id":"3e8d7348-ccef-4cb5-aca4-d5ed6f210199","name":"🔀 Merge Current with Historical1","type":"n8n-nodes-base.merge","notes":"Combines current scrape with historical data for comparison","position":[-384,224],"parameters":{"mode":"combine","options":{},"fieldsToMatchString":"rawResponse.message.content"},"typeVersion":3},{"id":"7e24cbab-31e4-47ba-97f2-9a7a71335905","name":"🔍 Detect Price & Stock Changes1","type":"n8n-nodes-base.code","notes":"Intelligent change detection with alert level classification","position":[-208,224],"parameters":{"jsCode":"// Compare current prices with historical and detect changes\nconst results = [];\n\nfor (const item of $input.all()) {\n  const current = item.json;\n  \n  // Skip error items\n  if (current.error) {\n    results.push({ json: current });\n    continue;\n  }\n  \n  // Find historical data for this competitor\n  const historical = $('📊 Read Historical Data').all()\n    .find(h => h.json.competitorName === current.competitorName);\n  \n  let alertLevel = 'none';\n  let changes = [];\n  \n  if (historical && historical.json.currentPrice) {\n    const oldPrice = parseFloat(historical.json.currentPrice);\n    const newPrice = parseFloat(current.currentPrice);\n    const priceChange = newPrice - oldPrice;\n    const priceChangePercent = ((priceChange / oldPrice) * 100).toFixed(2);\n    \n    current.priceChange = priceChange;\n    current.priceChangePercent = parseFloat(priceChangePercent);\n    current.previousPrice = oldPrice;\n    \n    // Determine alert level based on price changes\n    if (Math.abs(priceChangePercent) >= 20) {\n      alertLevel = 'critical';\n      changes.push(`Price ${priceChange > 0 ? 'increased' : 'decreased'} by ${Math.abs(priceChangePercent)}%`);\n    } else if (Math.abs(priceChangePercent) >= 10) {\n      alertLevel = 'warning';\n      changes.push(`Price ${priceChange > 0 ? 'increased' : 'decreased'} by ${Math.abs(priceChangePercent)}%`);\n    } else if (Math.abs(priceChangePercent) >= 5) {\n      alertLevel = 'info';\n      changes.push(`Minor price change: ${priceChangePercent}%`);\n    }\n    \n    // Check if it's a new low price\n    const historicalLow = parseFloat(historical.json.lowestPrice || oldPrice);\n    if (newPrice < historicalLow) {\n      current.isNewLow = true;\n      alertLevel = alertLevel === 'none' ? 'info' : alertLevel;\n      changes.push('🎯 NEW LOWEST PRICE!');\n    }\n    current.lowestPrice = Math.min(newPrice, historicalLow);\n    \n    // Stock level changes\n    if (historical.json.stockLevel !== current.stockLevel) {\n      if (current.stockLevel === 'Out of Stock') {\n        alertLevel = 'critical';\n        changes.push('📦 Product went OUT OF STOCK');\n      } else if (current.stockLevel === 'Low Stock') {\n        alertLevel = alertLevel === 'none' ? 'warning' : alertLevel;\n        changes.push('⚠ Stock level is LOW');\n      } else if (historical.json.stockLevel === 'Out of Stock' && current.inStock) {\n        alertLevel = alertLevel === 'none' ? 'info' : alertLevel;\n        changes.push('✅ Back in stock!');\n      }\n    }\n    \n    // Rating changes\n    const oldRating = parseFloat(historical.json.rating || 0);\n    const newRating = parseFloat(current.rating || 0);\n    const ratingChange = newRating - oldRating;\n    \n    if (Math.abs(ratingChange) >= 0.5) {\n      alertLevel = alertLevel === 'none' ? 'info' : alertLevel;\n      changes.push(`⭐ Rating ${ratingChange > 0 ? 'improved' : 'dropped'} by ${Math.abs(ratingChange).toFixed(1)} stars`);\n    }\n    \n    // Review count changes\n    const oldReviews = parseInt(historical.json.reviewCount || 0);\n    const newReviews = parseInt(current.reviewCount || 0);\n    const reviewDiff = newReviews - oldReviews;\n    \n    if (reviewDiff > 0) {\n      changes.push(`💬 ${reviewDiff} new review${reviewDiff > 1 ? 's' : ''}`);\n    }\n  } else {\n    // First time seeing this competitor\n    alertLevel = 'info';\n    changes.push('🆕 First time tracking this competitor');\n    current.lowestPrice = current.currentPrice;\n  }\n  \n  current.alertLevel = alertLevel;\n  current.changesSummary = changes.join(' | ');\n  current.hasChanges = alertLevel !== 'none';\n  \n  results.push({ json: current });\n}\n\nreturn results;"},"typeVersion":2},{"id":"4b8b4578-e6aa-461a-ae0a-7289bd0bf7e3","name":"💾 Update Historical Data1","type":"n8n-nodes-base.googleSheets","notes":"Saves current data to historical tracking sheet","position":[-32,320],"parameters":{"columns":{"value":{"rating":"={{ $json.rating }}","inStock":"={{ $json.inStock }}","currency":"={{ $json.currency }}","scrapedAt":"={{ $json.scrapedAt }}","productUrl":"={{ $json.productUrl }}","stockLevel":"={{ $json.stockLevel }}","lowestPrice":"={{ $json.lowestPrice }}","productName":"={{ $json.productName }}","reviewCount":"={{ $json.reviewCount }}","currentPrice":"={{ $json.currentPrice }}","originalPrice":"={{ $json.originalPrice }}","competitorName":"={{ $json.competitorName }}"},"mappingMode":"defineBelow"},"options":{},"operation":"append","sheetName":{"mode":"name","value":"Historical Data"},"documentId":{"__rl":true,"mode":"id","value":"= {{ $env.GOOGLE_SHEET_ID }}"}},"typeVersion":4.7},{"id":"28d2de55-ef62-40cd-a22b-a13eee3c2dc8","name":"When clicking ‘Execute workflow’","type":"n8n-nodes-base.manualTrigger","position":[-1760,144],"parameters":{},"typeVersion":1},{"id":"62cf73d2-a328-463b-9ea5-0d3fa8e3ba56","name":"🤖 AI Extract Product Data using Claude-Sonnet 4.5","type":"@n8n/n8n-nodes-langchain.anthropic","position":[-864,192],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"claude-sonnet-4-5-20250929","cachedResultName":"claude-sonnet-4-5-20250929"},"options":{},"messages":{"values":[{"content":"You are an accurate e-commerce data parser. From the provided HTML, extract shoe details and output a pure JSON object—no markdown or extra text.\n\nInclude the following fields:\n\n- productName: string \n- currentPrice: number (numeric value only, no currency symbols) \n- originalPrice: number (if discounted, otherwise same as currentPrice) \n- currency: string (USD, EUR, etc.) \n- inStock: boolean \n- stockLevel: string (\"In Stock\", \"Low Stock\", \"Out of Stock\", \"Limited\", etc.) \n- rating: number (0-5 scale) \n- reviewCount: number \n- lastUpdated: string (current ISO timestamp) \n- productUrl: string (from context) \n- competitorName: string (from context)\n\nOutput only the JSON object—no notes, comments, or formatting.\n"}]}},"typeVersion":1},{"id":"e5998861-2d29-4fdb-a5c0-445cf79ac50e","name":"🔀 Merge Current with Historical","type":"n8n-nodes-base.merge","notes":"Combines current scrape with historical data for comparison","position":[-1024,176],"parameters":{"numberInputs":3},"typeVersion":3},{"id":"6815d6c1-43c5-49a8-8f41-eafa0ee83363","name":"📊 Read Historical Data","type":"n8n-nodes-base.googleSheets","notes":"Loads previous scan data for comparison","position":[-624,352],"parameters":{"options":{},"sheetName":{"mode":"name","value":"Historical Data"},"documentId":{"__rl":true,"mode":"id","value":"={{ $env.GOOGLE_SHEET_ID }}"}},"typeVersion":4.7},{"id":"0c300e39-74da-4947-ab75-1360158f48a1","name":"📝 Log Alert Details","type":"n8n-nodes-base.googleSheets","notes":"Logs all alerts to separate tracking sheet","position":[-48,160],"parameters":{"columns":{"value":{"rating":"={{ $json.rating }}","timestamp":"={{ $json.scrapedAt }}","alertLevel":"={{ $json.alertLevel }}","productUrl":"={{ $json.productUrl }}","stockLevel":"={{ $json.stockLevel }}","priceChange":"={{ $json.priceChange || 0 }}","productName":"={{ $json.productName }}","currentPrice":"={{ $json.currentPrice }}","previousPrice":"={{ $json.previousPrice || 'N/A' }}","changesSummary":"={{ $json.changesSummary }}","competitorName":"={{ $json.competitorName }}","priceChangePercent":"={{ $json.priceChangePercent || 0 }}"},"mappingMode":"defineBelow"},"options":{},"operation":"append","sheetName":{"mode":"name","value":"Alert Log"},"documentId":{"__rl":true,"mode":"id","value":"={{ $env.GOOGLE_SHEET_ID }}"}},"typeVersion":4.7},{"id":"1833ee8f-13ca-40f3-a3ce-e7c09bbff5fc","name":"Send a text message","type":"n8n-nodes-base.telegram","position":[112,240],"webhookId":"ae976d33-11d1-4d92-9289-fc86a1525828","parameters":{"text":"The competitors’ pricing has been finalized.","additionalFields":{}},"typeVersion":1.2},{"id":"864886e9-21d0-402f-8f1f-46216a5e1373","name":"Pause the workflow to let the Apify scraping task finish","type":"n8n-nodes-base.wait","position":[-1424,272],"webhookId":"426f22d5-31db-4344-ae7a-13dedfc46bf4","parameters":{"amount":25},"typeVersion":1.1}],"active":false,"settings":{"executionOrder":"v1"},"connections":{"Split Out":{"main":[[{"node":"🔀 Merge Current with Historical","type":"main","index":0}]]},"Message a model":{"main":[[{"node":"Split Out","type":"main","index":0}]]},"Get Results Apify":{"main":[[{"node":"🔀 Merge Current with Historical","type":"main","index":2}]]},"Start Actor Apify":{"main":[[{"node":"Pause the workflow to let the Apify scraping task finish","type":"main","index":0}]]},"📝 Log Alert Details":{"main":[[{"node":"Send a text message","type":"main","index":0}]]},"⏰ Monitor Every 6 Hours":{"main":[[{"node":"📊 Read Historical Data","type":"main","index":0}]]},"📊 Read Historical Data":{"main":[[{"node":"🔀 Merge Current with Historical1","type":"main","index":1}]]},"💾 Update Historical Data1":{"main":[[{"node":"Send a text message","type":"main","index":0}]]},"Scrape a url and get its content":{"main":[[{"node":"🔀 Merge Current with Historical","type":"main","index":1}]]},"🔀 Merge Current with Historical":{"main":[[{"node":"🤖 AI Extract Product Data using Claude-Sonnet 4.5","type":"main","index":0}]]},"🔍 Detect Price & Stock Changes1":{"main":[[{"node":"💾 Update Historical Data1","type":"main","index":0},{"node":"📝 Log Alert Details","type":"main","index":0}]]},"🔀 Merge Current with Historical1":{"main":[[{"node":"🔍 Detect Price & Stock Changes1","type":"main","index":0}]]},"When clicking ‘Execute workflow’":{"main":[[{"node":"Message a model","type":"main","index":0},{"node":"Scrape a url and get its content","type":"main","index":0},{"node":"Start Actor Apify","type":"main","index":0}]]},"🤖 AI Extract Product Data using Claude-Sonnet 4.5":{"main":[[{"node":"Converts unstructured AI text into organized, usable data fields","type":"main","index":0}]]},"Pause the workflow to let the Apify scraping task finish":{"main":[[{"node":"Get Results Apify","type":"main","index":0}]]},"Converts unstructured AI text into organized, usable data fields":{"main":[[{"node":"🔀 Merge Current with Historical1","type":"main","index":0}]]}}}


[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
{"id":"eFkkWqS5KdrxZ43P","meta":{"instanceId":"a2b23892dd6989fda7c1209b381f5850373a7d2b85609624d7c2b7a092671d44","templateCredsSetupCompleted":true},"name":"Automate video creation with Veo3 and auto-post to Instagram, TikTok via Blotato - vide","tags":[],"nodes":[{"id":"45a5a9f4-fe6a-43a7-a032-c69750826209","name":"Assign Social Media IDs","type":"n8n-nodes-base.set","position":[420,1680],"parameters":{"mode":"raw","options":{},"jsonOutput":"{\n  \"instagram_id\": \"1111\",\n  \"youtube_id\": \"1111\",\n  \"threads_id\": \"1111\",\n  \"tiktok_id\": \"1111\",\n  \"facebook_id\": \"1111\",\n  \"facebook_page_id\": \"1111\",\n  \"twitter_id\": \"1111\",\n  \"linkedin_id\": \"1111\",\n  \"pinterest_id\": \"1111\",\n  \"pinterest_board_id\": \"1111\",\n  \"bluesky_id\": \"1111\"\n}\n"},"typeVersion":3.4},{"id":"6d125a85-b626-4981-8cfc-bcac4ea0ca89","name":"Get my video","type":"n8n-nodes-base.googleSheets","position":[520,1440],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"typeVersion":4.5},{"id":"779818a1-97bd-4bf9-ba17-995c1439df6f","name":"Upload Video to Blotato","type":"n8n-nodes-base.httpRequest","position":[640,1680],"parameters":{"url":"https://backend.blotato.com/v2/media","method":"POST","options":{},"sendBody":true,"sendHeaders":true,"bodyParameters":{"parameters":[{"name":"url","value":"={{ $('Get my video').item.json['final_output'] }}"}]},"headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"113d635c-bf8f-4ed3-801e-de78b0df9437","name":"INSTAGRAM","type":"n8n-nodes-base.httpRequest","position":[920,1440],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.instagram_id }}\",\n    \"target\": {\n      \"targetType\": \"instagram\"\n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my...
```

Erreur: Node 'Get my video' has no output connection

[Assistant]
<thinking>
**Analyse de l'erreur**: Node 'Get my video' 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 my video'

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

**Workflow corrigé:**
{"id":"eFkkWqS5KdrxZ43P","meta":{"instanceId":"a2b23892dd6989fda7c1209b381f5850373a7d2b85609624d7c2b7a092671d44","templateCredsSetupCompleted":true},"name":"Automate video creation with Veo3 and auto-post to Instagram, TikTok via Blotato - vide","tags":[],"nodes":[{"id":"45a5a9f4-fe6a-43a7-a032-c69750826209","name":"Assign Social Media IDs","type":"n8n-nodes-base.set","position":[420,1680],"parameters":{"mode":"raw","options":{},"jsonOutput":"{\n  \"instagram_id\": \"1111\",\n  \"youtube_id\": \"1111\",\n  \"threads_id\": \"1111\",\n  \"tiktok_id\": \"1111\",\n  \"facebook_id\": \"1111\",\n  \"facebook_page_id\": \"1111\",\n  \"twitter_id\": \"1111\",\n  \"linkedin_id\": \"1111\",\n  \"pinterest_id\": \"1111\",\n  \"pinterest_board_id\": \"1111\",\n  \"bluesky_id\": \"1111\"\n}\n"},"typeVersion":3.4},{"id":"6d125a85-b626-4981-8cfc-bcac4ea0ca89","name":"Get my video","type":"n8n-nodes-base.googleSheets","position":[520,1440],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"typeVersion":4.5},{"id":"779818a1-97bd-4bf9-ba17-995c1439df6f","name":"Upload Video to Blotato","type":"n8n-nodes-base.httpRequest","position":[640,1680],"parameters":{"url":"https://backend.blotato.com/v2/media","method":"POST","options":{},"sendBody":true,"sendHeaders":true,"bodyParameters":{"parameters":[{"name":"url","value":"={{ $('Get my video').item.json['final_output'] }}"}]},"headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"113d635c-bf8f-4ed3-801e-de78b0df9437","name":"INSTAGRAM","type":"n8n-nodes-base.httpRequest","position":[920,1440],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.instagram_id }}\",\n    \"target\": {\n      \"targetType\": \"instagram\"\n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"instagram\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}\n\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"02aa72ee-e5b9-44ee-9cbf-e8ddbc259570","name":"YOUTUBE","type":"n8n-nodes-base.httpRequest","position":[1140,1440],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.youtube_id }}\",\n    \"target\": {\n      \"targetType\": \"youtube\",\n      \"title\": \"{{ $('Get my video').item.json.Titre }}\",\n      \"privacyStatus\": \"unlisted\",\n      \"shouldNotifySubscribers\": \"false\"\n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"youtube\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"b9e82889-b753-43e7-b417-213a99763802","name":"TIKTOK","type":"n8n-nodes-base.httpRequest","position":[1340,1440],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.tiktok_id }}\",\n    \"target\": {\n      \"targetType\": \"tiktok\",\n      \"isYourBrand\": \"false\", \n      \"disabledDuet\": \"false\",\n      \"privacyLevel\": \"PUBLIC_TO_EVERYONE\",\n      \"isAiGenerated\": \"true\",\n      \"disabledStitch\": \"false\",\n      \"disabledComments\": \"false\",\n      \"isBrandedContent\": \"false\"\n      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"tiktok\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"=YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"edf4cd31-ae48-4996-816e-8a32ac411e75","name":"FACEBOOK","type":"n8n-nodes-base.httpRequest","position":[920,1680],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.facebook_id }}\",\n    \"target\": {\n      \"targetType\": \"facebook\",\n      \"pageId\": \"{{ $('Assign Social Media IDs').item.json.facebook_page_id }}\"\n\n      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"facebook\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"=YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"edeb50af-020e-4118-af73-2a4fbb3bf6a2","name":"THREADS","type":"n8n-nodes-base.httpRequest","position":[1140,1680],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.threads_id }}\",\n    \"target\": {\n      \"targetType\": \"threads\"\n      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"threads\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"210e36e9-8db2-403c-b72a-2ec45bce2eae","name":"TWETTER","type":"n8n-nodes-base.httpRequest","position":[1340,1680],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.twitter_id }}\",\n    \"target\": {\n      \"targetType\": \"twitter\"\n      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"twitter\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"ac3069e4-4fe6-4146-a0e2-973b3c374c55","name":"LINKEDIN","type":"n8n-nodes-base.httpRequest","position":[920,1920],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.linkedin_id }}\",\n    \"target\": {\n      \"targetType\": \"linkedin\"\n      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"linkedin\",\n      \"mediaUrls\": [\n        \"{{ $json.url }}\"\n      ]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"d9c919d8-ae9c-47cf-9b6f-8cb3e7e1f500","name":"BLUESKY","type":"n8n-nodes-base.httpRequest","position":[1140,1920],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"= {\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.bluesky_id }}\",\n    \"target\": {\n      \"targetType\": \"bluesky\"\n      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"bluesky\",\n      \"mediaUrls\": [\n        \"https://pbs.twimg.com/media/GE8MgIiWEAAfsK3.jpg\"\n      ]\n    }\n  }\n}\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"a0a0a8fe-f6b0-458c-846e-409200a7b12f","name":"PINTEREST","type":"n8n-nodes-base.httpRequest","position":[1340,1920],"parameters":{"url":"https://backend.blotato.com/v2/posts","method":"POST","options":{},"jsonBody":"={\n  \"post\": {\n    \"accountId\": \"{{ $('Assign Social Media IDs').item.json.pinterest_id }}\",\n    \"target\": {\n      \"targetType\": \"pinterest\",\n      \"boardId\": \"{{ $('Assign Social Media IDs').item.json.pinterest_board_id }}\"      \n    },\n    \"content\": {\n      \"text\": \"{{ $('Get my video').item.json.DESCRIPTION }}\",\n      \"platform\": \"pinterest\",\n      \"mediaUrls\": [\n        \"https://pbs.twimg.com/media/GE8MgIiWEAAfsK3.jpg\"\n      ]\n    }\n  }\n}\n\n","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"blotato-api-key","value":"YOUR_API_HERE"}]}},"typeVersion":4.2},{"id":"38c75425-36a5-45c7-98cb-ed5eb20af249","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[640,1920],"parameters":{"columns":{"value":{"STATUS":"Publish","row_number":"={{ $('Get my video').item.json.row_number }}"},"schema":[{"id":"PROMPT","type":"string","display":true,"required":false,"displayName":"PROMPT","defaultMatch":false,"canBeUsedToMatch":true},{"id":"DESCRIPTION","type":"string","display":true,"required":false,"displayName":"DESCRIPTION","defaultMatch":false,"canBeUsedToMatch":true},{"id":"URL VIDEO","type":"string","display":true,"required":false,"displayName":"URL VIDEO","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Titre","type":"string","display":true,"required":false,"displayName":"Titre","defaultMatch":false,"canBeUsedToMatch":true},{"id":"STATUS","type":"string","display":true,"required":false,"displayName":"STATUS","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["row_number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"typeVersion":4.5},{"id":"3ac616bc-67bb-494c-bd24-3753fc03e7dc","name":"Trigger: Run Daily Script Generator","type":"n8n-nodes-base.scheduleTrigger","position":[500,560],"parameters":{"rule":{"interval":[{}]}},"typeVersion":1.2},{"id":"8ae30b31-2ac9-4b62-9094-ce36197d319d","name":"AI Agent: Generate Video Concept","type":"@n8n/n8n-nodes-langchain.agent","position":[660,560],"parameters":{"text":"Give me an idea about [a Yeti speaking to a camera and doing a Vlog through his selfie stick]. ","options":{"systemMessage":"=You are an AI designed to generate 1 immersive, realistic idea based on a user-provided topic. Your output must be formatted as a JSON array (single line) and follow all the rules below exactly.\n\nRULES:\n\nOnly return 1 idea at a time.\n\nThe user will provide a key topic (e.g. “urban farming,” “arctic survival,” “street food in Vietnam”).\n\nThe Idea must:\n\nBe under 13 words.\n\nDescribe an interesting and viral-worthy moment, action, or event related to the provided topic.\n\nCan be as surreal as you can get, doesn't have to be real-world!\n\nInvolves a character.\n\nThe Caption must be:\n\nShort, punchy, and viral-friendly.\n\nInclude one relevant emoji.\n\nInclude exactly 12 hashtags in this order:\n** 4 topic-relevant hashtags\n** 4 all-time most popular hashtags\n** 4 currently trending hashtags (based on live research)\n\nAll hashtags must be lowercase.\n\nSet Status to \"for production\" (always).\n\nThe Environment must:\n\nBe under 20 words.\n\nMatch the action in the Idea exactly.\n\nClearly describe:\n\nWhere the event is happening (e.g. rooftop, jungle trail, city alley, frozen lake)\n\nKey visuals or background details (e.g. smoke rising, neon lights, fog, birds overhead)\n\nMain participants (e.g. farmer, cook, mechanic, rescue team, animal)\n\nStyle of scene (e.g. cinematic realism, handheld docu-style, aerial tracking shot, macro close-up)\n\nOk with fictional settings\n\nOUTPUT FORMAT (single-line JSON array):\n\n\n[\n  {\n    \"Caption\": \"Short viral title with emoji #4_topic_hashtags #4_all_time_popular_hashtags #4_trending_hashtags\",\n    \"Idea\": \"Short idea under 13 words\",\n    \"Environment\": \"Brief vivid setting under 20 words matching the action\",\n    \"Status\": \"for production\"\n  }\n]\n"},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"1685126b-bd11-4798-aae9-c676d6cf743d","name":"Tool: Inject Creativity","type":"@n8n/n8n-nodes-langchain.toolThink","position":[740,820],"parameters":{},"typeVersion":1},{"id":"30b4a035-33df-4826-972d-0ed2dd8fbed9","name":"LLM: Generate Idea & Caption (GPT-4.1)","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[580,820],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1","cachedResultName":"gpt-4.1"},"options":{}},"typeVersion":1.2},{"id":"c1e92152-aa05-43dd-8522-23f1514cf0ad","name":"Parser: Extract JSON from Idea","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[900,820],"parameters":{"jsonSchemaExample":"[\n  {\n    \"Caption\": \"Diver Removes Nets Off Whale 🐋 #whalerescue #marinelife #oceanrescue #seahelpers #love #nature #instagood #explore #viral #savenature #oceanguardians #cleanoceans\",\n    \"Idea\": \"Diver carefully cuts tangled net from distressed whale in open sea\",\n    \"Environment\": \"Open ocean, sunlight beams through water, diver and whale, cinematic realism\",\n    \"Status\": \"for production\"\n  }\n]\n"},"typeVersion":1.2},{"id":"432c7648-f9f9-4807-abf5-64d8f9a6bafb","name":"Google Sheets: Save Script Idea","type":"n8n-nodes-base.googleSheets","position":[1020,560],"parameters":{"columns":{"value":{"id":"==ROW()-1","idea":"={{ $json.output[0].Idea }}","caption":"={{ $json.output[0].Caption }}","production":"={{ $json.output[0].Status }}","environment_prompt":"={{ $json.output[0].Environment }}"},"schema":[{"id":"id","type":"string","display":true,"removed":false,"required":false,"displayName":"id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"idea","type":"string","display":true,"required":false,"displayName":"idea","defaultMatch":false,"canBeUsedToMatch":true},{"id":"caption","type":"string","display":true,"required":false,"displayName":"caption","defaultMatch":false,"canBeUsedToMatch":true},{"id":"production","type":"string","display":true,"required":false,"displayName":"production","defaultMatch":false,"canBeUsedToMatch":true},{"id":"environment_prompt","type":"string","display":true,"required":false,"displayName":"environment_prompt","defaultMatch":false,"canBeUsedToMatch":true},{"id":"final_output","type":"string","display":true,"required":false,"displayName":"final_output","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["id"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"typeVersion":4.5},{"id":"02c2e969-0bb6-44fa-8707-37edc2cc77fd","name":"AI Agent: Create Veo3-Compatible Prompt","type":"@n8n/n8n-nodes-langchain.agent","position":[1180,560],"parameters":{"text":"=Give me a Veo3 prompt for this idea:\n{{ $json.idea }}\n\nThis is the environment:\n{{ $json.environment_prompt }}\n\n","options":{"systemMessage":"=SYSTEM PROMPT FOR GOOGLE VEO3 PROMPT AGENT\n\nYou are an AI agent that writes hyper-realistic, cinematic video prompts for Google VEO3. Each prompt should describe a short, vivid selfie-style video clip featuring one unnamed character speaking or acting in a specific moment. The final video should look like found footage or documentary-style film — grounded, realistic, and immersive.\n\nREQUIRED STRUCTURE (FILL IN THE BRACKETS BELOW):\n\n[Scene paragraph prompt here]\n\nMain character: [description of character]\nThey say: [insert one line of dialogue, fits the scene and mood].\nThey [describe a physical action or subtle camera movement, e.g. pans the camera, shifts position, glances around].\nTime of Day: [day / night / dusk / etc.]\nLens: [describe lens]\nAudio: (implied) [ambient sounds, e.g. lion growls, wind, distant traffic, birdsong]\nBackground: [brief restatement of what is visible behind them]\n\nRULES FOR PROMPT GENERATION\n\nSingle paragraph only, 750–1500 characters. No line breaks or headings.\n\nOnly one human character. Never give them a name.\n\nInclude one spoken line of dialogue and describe how it’s delivered.\n\nCharacter must do something physical, even if subtle (e.g. glance, smirk, pan camera).\n\nUse selfie-style framing. Always describe the lens, stock, and camera behavior.\n\nScene must feel real and cinematic — like a short clip someone might record on a stylized camera.\n\nAlways include the five key technical elements: Time of Day, Lens, Film Stock, Audio, and Background.\n\nDO NOT DO THIS:\n\nDon’t name the character.\n\nDon’t include more than one character.\n\nDon’t describe subtitles or on-screen text.\n\nDon’t break the paragraph or use formatting.\n\nDon’t write vague or abstract scenes — always keep them grounded in physical detail."},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"010485e3-7b3f-496b-bcd5-05087a41805c","name":"Tool: Build Prompt Structure","type":"@n8n/n8n-nodes-langchain.toolThink","position":[1380,820],"parameters":{},"typeVersion":1},{"id":"acec06a9-c36d-4bff-a152-4a5b8b73808d","name":"LLM: Format Prompt for Veo3 (GPT-4.1)","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1200,820],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4.1","cachedResultName":"gpt-4.1"},"options":{}},"typeVersion":1.2},{"id":"4f8e53f5-d0a1-46c1-a855-a7067b493d66","name":"Call Veo3 API to Generate Video","type":"n8n-nodes-base.httpRequest","position":[520,1100],"parameters":{"url":"https://queue.fal.run/fal-ai/veo3","body":"={ \"prompt\": \"{{ $json.output }}\" }\n","method":"POST","options":{"batching":{"batch":{"batchSize":1,"batchInterval":2000}}},"sendBody":true,"contentType":"raw","authentication":"genericCredentialType","rawContentType":"application/json","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"27881cbe-df1c-463d-8baa-5c482f0b1c04","name":"Wait for Veo3 Processing (5 mins)","type":"n8n-nodes-base.wait","position":[740,1100],"webhookId":"861e2761-369b-407b-9e88-1b176e617cd8","parameters":{},"typeVersion":1.1},{"id":"671eaf67-367a-41a0-b127-b06adbd5a3c9","name":"Retrieve Final Video URL from Veo3","type":"n8n-nodes-base.httpRequest","position":[1020,1100],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"typeVersion":4.2},{"id":"3555e042-a420-49fe-889e-62455616ed7c","name":"Google Sheets: Log Final Video Output","type":"n8n-nodes-base.googleSheets","position":[1340,1100],"parameters":{"columns":{"value":{"idea":"={{ $('Google Sheets: Save Script Idea').first().json.idea }}","production":"done","final_output":"={{ $json.video.url }}"},"schema":[{"id":"id","type":"string","display":true,"removed":false,"required":false,"displayName":"id","defaultMatch":true,"canBeUsedToMatch":true},{"id":"idea","type":"string","display":true,"removed":false,"required":false,"displayName":"idea","defaultMatch":false,"canBeUsedToMatch":true},{"id":"caption","type":"string","display":true,"required":false,"displayName":"caption","defaultMatch":false,"canBeUsedToMatch":true},{"id":"production","type":"string","display":true,"required":false,"displayName":"production","defaultMatch":false,"canBeUsedToMatch":true},{"id":"environment_prompt","type":"string","display":true,"required":false,"displayName":"environment_prompt","defaultMatch":false,"canBeUsedToMatch":true},{"id":"final_output","type":"string","display":true,"required":false,"displayName":"final_output","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["idea"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"id","value":"="},"documentId":{"__rl":true,"mode":"id","value":"="}},"typeVersion":4.5}],"active":false,"settings":{"executionOrder":"v1"},"connections":{"Get my video":{"main":[[{"node":"Assign Social Media IDs","type":"main","index":0}]]},"Assign Social Media IDs":{"main":[[{"node":"Upload Video to Blotato","type":"main","index":0}]]},"Tool: Inject Creativity":{"ai_tool":[[{"node":"AI Agent: Generate Video Concept","type":"ai_tool","index":0}]]},"Upload Video to Blotato":{"main":[[{"node":"INSTAGRAM","type":"main","index":0},{"node":"YOUTUBE","type":"main","index":0},{"node":"TIKTOK","type":"main","index":0},{"node":"FACEBOOK","type":"main","index":0},{"node":"THREADS","type":"main","index":0},{"node":"TWETTER","type":"main","index":0},{"node":"LINKEDIN","type":"main","index":0},{"node":"BLUESKY","type":"main","index":0},{"node":"PINTEREST","type":"main","index":0},{"node":"Google Sheets","type":"main","index":0}]]},"Tool: Build Prompt Structure":{"ai_tool":[[{"node":"AI Agent: Create Veo3-Compatible Prompt","type":"ai_tool","index":0}]]},"Parser: Extract JSON from Idea":{"ai_outputParser":[[{"node":"AI Agent: Generate Video Concept","type":"ai_outputParser","index":0}]]},"Call Veo3 API to Generate Video":{"main":[[{"node":"Wait for Veo3 Processing (5 mins)","type":"main","index":0}]]},"Google Sheets: Save Script Idea":{"main":[[{"node":"AI Agent: Create Veo3-Compatible Prompt","type":"main","index":0}]]},"AI Agent: Generate Video Concept":{"main":[[{"node":"Google Sheets: Save Script Idea","type":"main","index":0}]]},"Wait for Veo3 Processing (5 mins)":{"main":[[{"node":"Retrieve Final Video URL from Veo3","type":"main","index":0}]]},"Retrieve Final Video URL from Veo3":{"main":[[{"node":"Google Sheets: Log Final Video Output","type":"main","index":0}]]},"Trigger: Run Daily Script Generator":{"main":[[{"node":"AI Agent: Generate Video Concept","type":"main","index":0}]]},"Google Sheets: Log Final Video Output":{"main":[[{"node":"Get my video","type":"main","index":0}]]},"LLM: Format Prompt for Veo3 (GPT-4.1)":{"ai_languageModel":[[{"node":"AI Agent: Create Veo3-Compatible Prompt","type":"ai_languageModel","index":0}]]},"LLM: Generate Idea & Caption (GPT-4.1)":{"ai_languageModel":[[{"node":"AI Agent: Generate Video Concept","type":"ai_languageModel","index":0}]]},"AI Agent: Create Veo3-Compatible Prompt":{"main":[[{"node":"Call Veo3 API to Generate Video","type":"main","index":0}]]}}}


[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é.

[User]
Voici mon workflow:
```json
{"meta":{"instanceId":"062f0e1ec3617ffb26cbc1b3c3518f28f3e57f08ddc210c471f532bb0bd6cf07","templateCredsSetupCompleted":true},"nodes":[{"id":"fa9f137e-b5e8-4a30-8320-f74f383bbd42","name":"Scrape Instagram Posts","type":"@apify/n8n-nodes-apify.apify","position":[496,624],"parameters":{"memory":2048,"actorId":{"__rl":true,"mode":"url","value":"https://console.apify.com/actors/shu8hvrXbJbY3Eb9W/input","__regex":"https://console.apify.com/actors/([a-zA-Z0-9]+).*"},"timeout":{},"operation":"Run actor and get dataset","customBody":"={{ {\n  \"directUrls\": [\n    \"https://www.instagram.com/\" + $('Workflow Configuration1').item.json[\"ownAccount\"] + \"/\",\n    \"https://www.instagram.com/\" + JSON.parse($('Workflow Configuration1').item.json.competitors)[0] + \"/\",\n    \"https://www.instagram.com/\" + JSON.parse($('Workflow Configuration1').item.json.competitors)[1] + \"/\"\n  ].filter(url => !url.includes(\"undefined\") && !url.includes(\"null\")),\n  \"resultsType\": \"posts\",\n  \"resultsLimit\": $('Workflow Configuration1').item.json.postsCount || 10\n} }}","authentication":"apifyOAuth2Api"},"typeVersion":1},{"id":"d2f7637e-8d91-465a-937d-ab94b2ce0ad0","name":"Scrape TikTok Posts","type":"@apify/n8n-nodes-apify.apify","position":[496,800],"parameters":{"memory":2048,"actorId":{"__rl":true,"mode":"list","value":"GdWCkxBtKWOsKjdch","cachedResultUrl":"https://console.apify.com/actors/GdWCkxBtKWOsKjdch/input","cachedResultName":"TikTok Scraper (clockworks/tiktok-scraper)"},"timeout":{},"operation":"Run actor and get dataset","customBody":"={{ {\n  \"profiles\": [\n    $('Workflow Configuration1').item.json.ownAccount,\n    JSON.parse($('Workflow Configuration1').item.json.competitors)[0],\n    JSON.parse($('Workflow Configuration1').item.json.competitors)[1]\n  ].filter(p => p),\n  \"resultsPerPage\": $('Workflow Configuration1').item.json.postsCount || 10,\n  \"shouldDownloadVideos\": false\n} }}","authentication":"apifyOAuth2Api"},"typeVersion":1},{"id":"9fc5651a-1...
```

Peux-tu modifier le workflow pour qu'il envoie automatiquement un rapport hebdomadaire par email à l'équipe marketing ?

[Assistant]
<thinking>
L'automatisation des rapports est essentielle pour un suivi régulier. Il faudra ajouter un déclencheur temporel et un nœud d'envoi d'email, plus potentiellement un nœud de formatage pour présenter les données proprement.
</thinking>

**Modifications appliquées:**
Ajouter un nœud Schedule Trigger pour déclencher le workflow chaque semaine, un nœud pour formater les données en rapport HTML/PDF, et un nœud Gmail/Email pour l'envoi automatique à la liste de diffusion marketing.

**Workflow modifié:**
{"meta":{"instanceId":"062f0e1ec3617ffb26cbc1b3c3518f28f3e57f08ddc210c471f532bb0bd6cf07","templateCredsSetupCompleted":true},"nodes":[{"id":"fa9f137e-b5e8-4a30-8320-f74f383bbd42","name":"Scrape Instagram Posts","type":"@apify/n8n-nodes-apify.apify","position":[496,624],"parameters":{"memory":2048,"actorId":{"__rl":true,"mode":"url","value":"https://console.apify.com/actors/shu8hvrXbJbY3Eb9W/input","__regex":"https://console.apify.com/actors/([a-zA-Z0-9]+).*"},"timeout":{},"operation":"Run actor and get dataset","customBody":"={{ {\n  \"directUrls\": [\n    \"https://www.instagram.com/\" + $('Workflow Configuration1').item.json[\"ownAccount\"] + \"/\",\n    \"https://www.instagram.com/\" + JSON.parse($('Workflow Configuration1').item.json.competitors)[0] + \"/\",\n    \"https://www.instagram.com/\" + JSON.parse($('Workflow Configuration1').item.json.competitors)[1] + \"/\"\n  ].filter(url => !url.includes(\"undefined\") && !url.includes(\"null\")),\n  \"resultsType\": \"posts\",\n  \"resultsLimit\": $('Workflow Configuration1').item.json.postsCount || 10\n} }}","authentication":"apifyOAuth2Api"},"typeVersion":1},{"id":"d2f7637e-8d91-465a-937d-ab94b2ce0ad0","name":"Scrape TikTok Posts","type":"@apify/n8n-nodes-apify.apify","position":[496,800],"parameters":{"memory":2048,"actorId":{"__rl":true,"mode":"list","value":"GdWCkxBtKWOsKjdch","cachedResultUrl":"https://console.apify.com/actors/GdWCkxBtKWOsKjdch/input","cachedResultName":"TikTok Scraper (clockworks/tiktok-scraper)"},"timeout":{},"operation":"Run actor and get dataset","customBody":"={{ {\n  \"profiles\": [\n    $('Workflow Configuration1').item.json.ownAccount,\n    JSON.parse($('Workflow Configuration1').item.json.competitors)[0],\n    JSON.parse($('Workflow Configuration1').item.json.competitors)[1]\n  ].filter(p => p),\n  \"resultsPerPage\": $('Workflow Configuration1').item.json.postsCount || 10,\n  \"shouldDownloadVideos\": false\n} }}","authentication":"apifyOAuth2Api"},"typeVersion":1},{"id":"9fc5651a-1546-40f6-83b6-45692162aeee","name":"Analyze Images with GPT-4o Vision","type":"n8n-nodes-base.code","position":[960,720],"parameters":{"mode":"runOnceForEachItem","jsCode":"// Get OpenAI API key from Workflow Configuration node\nconst apiKey = $('Workflow Configuration1').item.json.openaiApiKey;\nconst imageUrl = $input.item.json.displayUrl || $input.item.json.coverUrl;\nconst accountName = $input.item.json.ownerUsername || $input.item.json.authorMeta?.name || 'unknown';\n\n// Detect platform based on data structure\nconst platform = $input.item.json.videoMeta ? 'TikTok' : 'Instagram';\n\n// Call OpenAI GPT-4o Vision API\nconst response = await this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://api.openai.com/v1/chat/completions',\n  headers: {\n    'Content-Type': 'application/json',\n    'Authorization': `Bearer ${apiKey}`\n  },\n  body: {\n    model: 'gpt-4o',\n    messages: [\n      {\n        role: 'user',\n        content: [\n          {\n            type: 'text',\n            text: 'Analyze this image and extract visual attributes in JSON format: color_palette (array of 3-5 dominant hex colors), composition_style (string), mood_emotion (string), text_design_elements (object with font_style, text_placement, text_content). Return only valid JSON.'\n          },\n          {\n            type: 'image_url',\n            image_url: {\n              url: imageUrl\n            }\n          }\n        ]\n      }\n    ],\n    max_tokens: 500\n  },\n  json: true\n});\n\n// Parse the AI response\nlet analysis;\ntry {\n  const content = response.choices[0].message.content;\n  const jsonMatch = content.match(/\\{[\\s\\S]*\\}/);\n  if (jsonMatch) {\n    analysis = JSON.parse(jsonMatch[0]);\n  } else {\n    analysis = JSON.parse(content);\n  }\n} catch (error) {\n  analysis = {\n    color_palette: [],\n    composition_style: 'Unable to analyze',\n    mood_emotion: 'Unable to analyze',\n    text_design_elements: {}\n  };\n}\n\n// Return analyzed image with metadata\nreturn {\n  json: {\n    imageUrl: imageUrl,\n    accountName: accountName,\n    platform: platform,\n    colorPalette: analysis.color_palette || [],\n    compositionStyle: analysis.composition_style || '',\n    moodEmotion: analysis.mood_emotion || '',\n    textDesignElements: analysis.text_design_elements || {},\n    rawAnalysis: response.choices[0].message.content\n  }\n};"},"typeVersion":2},{"id":"e795ee95-1dc4-42aa-99d3-2a35ce7cd319","name":"Aggregate All Results","type":"n8n-nodes-base.aggregate","position":[1184,720],"parameters":{"options":{},"aggregate":"aggregateAllItemData","destinationFieldName":"analysisResults"},"typeVersion":1},{"id":"17c3d793-9833-4f54-9224-857d848034e7","name":"Generate Competitive Analysis Report","type":"n8n-nodes-base.code","position":[1408,720],"parameters":{"jsCode":"// Generate Comprehensive Comparison Report using OpenAI\n\nconst items = $input.all();\nconst aggregatedData = items[0].json;\n\n// Get OpenAI API key from Workflow Configuration\nconst openaiApiKey = $('Workflow Configuration1').item.json.openaiApiKey;\n\nif (!openaiApiKey) {\n  throw new Error('OpenAI API key not found in Workflow Configuration');\n}\n\n// Prepare data summary for OpenAI prompt\nconst dataSummary = JSON.stringify(aggregatedData, null, 2);\n\n// Create comprehensive prompt for OpenAI\nconst prompt = `You are a social media visual content strategy expert. Analyze the following data from multiple social media platforms (Instagram, Pinterest, TikTok) and generate a comprehensive comparison report.\n\nData:\n${dataSummary}\n\nPlease provide a detailed report with the following sections:\n\n1. COMPETITIVE COMPARISON MATRIX\n   - Create a matrix showing visual patterns by account\n   - Compare color schemes, composition styles, content types\n   - Highlight top-performing visual elements per account\n\n2. PLATFORM-SPECIFIC WINNING PATTERNS\n   - Instagram: What visual patterns drive the most engagement?\n   - Pinterest: What visual styles get the most saves/repins?\n   - TikTok: What visual elements capture attention?\n\n3. CROSS-PLATFORM INSIGHTS AND TRENDS\n   - Common visual themes across all platforms\n   - Platform-specific vs universal visual strategies\n   - Emerging visual trends identified\n\n4. RECOMMENDED ACTIONS\n   - Specific actionable recommendations to improve visual content strategy\n   - Quick wins that can be implemented immediately\n   - Long-term strategic visual content improvements\n\nFormat the report in a clear, structured manner with headers and bullet points.`;\n\n// Call OpenAI API\nconst response = await this.helpers.httpRequest({\n  method: 'POST',\n  url: 'https://api.openai.com/v1/chat/completions',\n  headers: {\n    'Authorization': `Bearer ${openaiApiKey}`,\n    'Content-Type': 'application/json'\n  },\n  body: {\n    model: 'gpt-4',\n    messages: [\n      {\n        role: 'system',\n        content: 'You are a social media visual content strategy expert specializing in competitive analysis and actionable insights.'\n      },\n      {\n        role: 'user',\n        content: prompt\n      }\n    ],\n    temperature: 0.7,\n    max_tokens: 2500\n  },\n  json: true\n});\n\n// Extract the generated report\nconst report = response.choices[0].message.content;\n\n// Parse report into sections\nconst sections = {\n  fullReport: report,\n  competitiveMatrix: extractSection(report, 'COMPETITIVE COMPARISON MATRIX', 'PLATFORM-SPECIFIC WINNING PATTERNS'),\n  platformPatterns: extractSection(report, 'PLATFORM-SPECIFIC WINNING PATTERNS', 'CROSS-PLATFORM INSIGHTS'),\n  crossPlatformInsights: extractSection(report, 'CROSS-PLATFORM INSIGHTS', 'RECOMMENDED ACTIONS'),\n  recommendedActions: extractSection(report, 'RECOMMENDED ACTIONS', null),\n  generatedAt: new Date().toISOString(),\n  dataAnalyzed: {\n    totalAccounts: aggregatedData.totalAccounts || 0,\n    totalImages: aggregatedData.totalImages || 0,\n    platforms: aggregatedData.platforms || []\n  }\n};\n\n// Helper function to extract sections\nfunction extractSection(text, startMarker, endMarker) {\n  const startIndex = text.indexOf(startMarker);\n  if (startIndex === -1) return '';\n  \n  const contentStart = startIndex + startMarker.length;\n  \n  if (endMarker) {\n    const endIndex = text.indexOf(endMarker, contentStart);\n    if (endIndex === -1) return text.substring(contentStart).trim();\n    return text.substring(contentStart, endIndex).trim();\n  }\n  \n  return text.substring(contentStart).trim();\n}\n\n// Return formatted report with all sections\nreturn [{\n  json: sections\n}];"},"typeVersion":2},{"id":"907d303b-36c2-48e8-ac06-291d0de9313d","name":"Log Results to Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1616,720],"parameters":{"columns":{"value":{"summary":"={{ $json.fullReport.substring(0, 500) }}","platforms":"={{ $('Workflow Configuration1').item.json.platforms }}","timestamp":"={{ $now.toISO() }}","competitors":"={{ $('Workflow Configuration1').item.json.competitors }}","own_account":"={{ $('Workflow Configuration1').item.json.ownAccount }}","posts_analyzed":"={{ $('Aggregate All Results').item.json.analysisResults.length }}"},"schema":[{"id":"timestamp","required":false,"displayName":"timestamp","defaultMatch":false,"canBeUsedToMatch":true},{"id":"own_account","required":false,"displayName":"own_account","defaultMatch":false,"canBeUsedToMatch":true},{"id":"competitors","required":false,"displayName":"competitors","defaultMatch":false,"canBeUsedToMatch":true},{"id":"platforms","required":false,"displayName":"platforms","defaultMatch":false,"canBeUsedToMatch":true},{"id":"posts_analyzed","required":false,"displayName":"posts_analyzed","defaultMatch":false,"canBeUsedToMatch":true},{"id":"summary","required":false,"displayName":"summary","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["timestamp"]},"options":{},"operation":"appendOrUpdate","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"id","value":"YOUR_GOOGLE_SHEET_ID"}},"typeVersion":4.7},{"id":"f8bd3bbf-f924-49d2-b0c2-2b2536b30d97","name":"Form Trigger1","type":"n8n-nodes-base.formTrigger","position":[-160,720],"webhookId":"your-webhook-id","parameters":{"options":{"appendAttribution":false},"formTitle":"Cross-Platform Competitive Visual Intelligence","formFields":{"values":[{"fieldLabel":"Your Account/Hashtag","requiredField":true},{"fieldLabel":"Competitor 1 Account"},{"fieldLabel":"Competitor 2 Account"},{"fieldLabel":"Competitor 3 Account"},{"fieldType":"checkbox","fieldLabel":"Select Platforms","fieldOptions":{"values":[{"option":"Instagram"},{"option":"Pinterest"},{"option":"TikTok"}]},"requiredField":true},{"fieldType":"number","fieldLabel":"Number of Posts to Analyze","placeholder":"10","requiredField":true}]},"formDescription":"Analyze visual content from your brand and competitors across Instagram, Pinterest, and TikTok"},"typeVersion":2.3},{"id":"b61645e7-9be0-4791-ab99-c9cd3b5bcaca","name":"Workflow Configuration1","type":"n8n-nodes-base.set","position":[64,720],"parameters":{"options":{},"assignments":{"assignments":[{"id":"id-1","name":"ownAccount","type":"string","value":"={{ $json[\"Your Account/Hashtag\"] }}"},{"id":"id-2","name":"competitors","type":"array","value":"={{ JSON.stringify([$json[\"Competitor 1 Account\"], $json[\"Competitor 2 Account\"], $json[\"Competitor 3 Account\"]].filter(c => c)) }}"},{"id":"id-3","name":"platforms","type":"array","value":"={{ $json['Select Platforms'] }}"},{"id":"id-4","name":"postsCount","type":"number","value":"={{ $json['Number of Posts to Analyze'] }}"},{"id":"id-5","name":"openaiApiKey","type":"string","value":"YOUR_OPENAI_API_KEY"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"23c3d08b-e38e-469f-ac24-7bcfdfdc9305","name":"Platform Router1","type":"n8n-nodes-base.switch","position":[288,704],"parameters":{"rules":{"values":[{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"42237866-d2cb-4b01-9447-d1d0ab6584b6","operator":{"type":"array","operation":"contains","rightType":"any"},"leftValue":"={{ $json['Select Platforms']}}","rightValue":"Instagram"}]},"renameOutput":true},{"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"loose"},"combinator":"and","conditions":[{"id":"98782347-1e0c-48c4-8232-00ccf1780f9f","operator":{"type":"array","operation":"contains","rightType":"any"},"leftValue":"={{ $json['Select Platforms']}}","rightValue":"TikTok"}]},"renameOutput":true}]},"options":{"ignoreCase":true,"fallbackOutput":"none","allMatchingOutputs":true},"looseTypeValidation":true},"typeVersion":3.3,"alwaysOutputData":true},{"id":"63607524-f0e1-459d-a18e-7000d8d3608d","name":"Filter Images Only1","type":"n8n-nodes-base.filter","position":[736,720],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"id-1","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.type }}","rightValue":"Image"},{"id":"id-2","operator":{"type":"string","operation":"notEmpty"},"leftValue":"={{ $json.displayUrl || $json.imageUrl }}"}]}},"typeVersion":2.2}],"connections":{"Form Trigger1":{"main":[[{"node":"Workflow Configuration1","type":"main","index":0}]]},"Platform Router1":{"main":[[{"node":"Scrape Instagram Posts","type":"main","index":0}],[{"node":"Scrape TikTok Posts","type":"main","index":0}]]},"Filter Images Only1":{"main":[[{"node":"Analyze Images with GPT-4o Vision","type":"main","index":0}]]},"Scrape TikTok Posts":{"main":[[{"node":"Filter Images Only1","type":"main","index":0}]]},"Aggregate All Results":{"main":[[{"node":"Generate Competitive Analysis Report","type":"main","index":0}]]},"Scrape Instagram Posts":{"main":[[{"node":"Filter Images Only1","type":"main","index":0}]]},"Workflow Configuration1":{"main":[[{"node":"Platform Router1","type":"main","index":0}]]},"Analyze Images with GPT-4o Vision":{"main":[[{"node":"Aggregate All Results","type":"main","index":0}]]},"Generate Competitive Analysis Report":{"main":[[{"node":"Log Results to Google Sheets","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.

[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":"00e9ec826c332aaa2865e65cdec318b633185c63a1cba1b3a2500858724cc85e","templateCredsSetupCompleted":true},"nodes":[{"id":"e770fbf4-8c4f-4aaa-b722-3140ecec28f2","name":"On clicking 'execute'","type":"n8n-nodes-base.manualTrigger","position":[360,640],"parameters":{},"typeVersion":1},{"id":"7dede05f-8c5a-426e-a822-d21b7e50d976","name":"Execute Workflow Trigger","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-140,1620],"parameters":{"inputSource":"passthrough"},"typeVersion":1.1},{"id":"6df6e830-5721-421f-9b46-f99f9164eb4d","name":"List Typebots","type":"n8n-nodes-base.httpRequest","position":[800,740],"parameters":{"url":"={{ $json.typebot.url }}/api/v1/typebots","options":{},"sendQuery":true,"authentication":"genericCredentialType","genericAuthType":"httpBearerAuth","queryParameters":{"parameters":[{"name":"workspaceId","value":"={{ $json.typebot.workspace.id }}"}]}},"typeVersion":4.2},{"id":"3d44e0b2-c404-424a-8eba-7ec111738939","name":"typebot","type":"n8n-nodes-base.set","position":[1240,640],"parameters":{"options":{},"assignments":{"assignments":[{"id":"8fbbf5fa-0455-4066-80e0-1b2885343aea","name":"typebot.url","type":"string","value":"={{ $('Globals').item.json.typebot.url }}"},{"id":"5e73d2e7-4b1a-4180-8af2-047e52eb8a0a","name":"repo.owner","type":"string","value":"={{ $('Globals').item.json.repo.owner }}"},{"id":"22445c28-5431-45a5-86ca-0ab2ff26cff5","name":"repo.name","type":"string","value":"={{ $('Globals').item.json.repo.name }}"},{"id":"232d9947-a43f-48a9-b385-da1aa8f5139e","name":"origin","type":"string","value":"typebot"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"4be16d80-43fd-4cc1-b79c-11fec3c76829","name":"Get Typebot","type":"n8n-nodes-base.httpRequest","position":[300,1360],"parameters":{"url":"={{ $('Switch').item.json.typebot.url }}/api/v1/typebots/{{ $json.id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpBearerAuth"},"typeVersion":4.2},{"id":"952f2ff9-0421-4239-947d-3d8f0b7925fd","name":"Split Out","type":"n8n-nodes-base.splitOut","position":[1020,640],"parameters":{"options":{},"fieldToSplitOut":"typebots"},"typeVersion":1},{"id":"ef97c1ec-d175-44b7-a462-2c8c2a8221ad","name":"Edit Fields","type":"n8n-nodes-base.set","position":[520,1460],"parameters":{"mode":"raw","options":{},"jsonOutput":"={{ $json.typebot }}"},"typeVersion":3.4},{"id":"e68821d5-11ea-4324-9957-303433a8aad7","name":"Globals","type":"n8n-nodes-base.set","position":[580,740],"parameters":{"options":{},"assignments":{"assignments":[{"id":"45027581-a75b-4375-a0f1-ebfddb0531f7","name":"typebot.url","type":"string","value":"https://typebot.io"},{"id":"5513c8d4-1aba-45f3-ab8c-498fa36f5f59","name":"typebot.workspace.id","type":"string","value":"xxxxxxxxxxxxxxxxxxxxxxxxxxxx"},{"id":"6cf546c5-5737-4dbd-851b-17d68e0a3780","name":"repo.owner","type":"string","value":"john-doe"},{"id":"452efa28-2dc6-4ea3-a7a2-c35d100d0382","name":"repo.name","type":"string","value":"typebot-backup"}]}},"typeVersion":3.4},{"id":"3027c8bd-a477-4f47-a2a9-fd952d9f9698","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[360,840],"parameters":{"rule":{"interval":[{"triggerAtHour":7}]}},"typeVersion":1.2},{"id":"caff32a5-6d82-43c9-998c-3258342d66b3","name":"github","type":"n8n-nodes-base.set","position":[1240,840],"parameters":{"options":{},"assignments":{"assignments":[{"id":"5e73d2e7-4b1a-4180-8af2-047e52eb8a0a","name":"repo.owner","type":"string","value":"={{ $('Globals').item.json.repo.owner }}"},{"id":"22445c28-5431-45a5-86ca-0ab2ff26cff5","name":"repo.name","type":"string","value":"={{ $('Globals').item.json.repo.name }}"},{"id":"232d9947-a43f-48a9-b385-da1aa8f5139e","name":"origin","type":"string","value":"github"},{"id":"456ec816-8c15-498b-bbc5-a96abce95d59","name":"typebots","type":"array","value":"={{ $('List Typebots').item.json.typebots }}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"4333f695-81d9-4c87-8d68-9a6245dc12d5","name":"List files","type":"n8n-nodes-base.github","position":[1020,840],"webhookId":"244ea8da-851f-4afb-980c-5e5973b6a1af","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Globals').item.json.repo.owner }}"},"resource":"file","operation":"list","repository":{"__rl":true,"mode":"name","value":"={{ $('Globals').item.json.repo.name }}"},"authentication":"oAuth2"},"executeOnce":true,"typeVersion":1.1},{"id":"7eab3efa-c3e0-420a-9fb8-9cd9ff52f90e","name":"Get file data","type":"n8n-nodes-base.github","position":[520,1260],"webhookId":"5cf07ee9-70c6-48bf-b370-534315f2d48e","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.owner }}"},"filePath":"={{ $('Switch').item.json.id }}.json","resource":"file","operation":"get","repository":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.name }}"},"authentication":"oAuth2","asBinaryProperty":false,"additionalParameters":{}},"typeVersion":1,"continueOnFail":true,"alwaysOutputData":true},{"id":"5e01d7b1-c09d-494f-8df1-c241db278084","name":"Create new file","type":"n8n-nodes-base.github","position":[1620,1160],"webhookId":"93cca36a-a5f4-4919-b655-e0fa2cc2ca36","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.owner }}"},"filePath":"={{$('Switch').first().json.id}}.json","resource":"file","repository":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.name }}"},"fileContent":"={{$('isDiffOrNew').item.json[\"typebot_data_stringy\"]}}","commitMessage":"={{$('Switch').first().json.name}} ({{$json.github_status}})","authentication":"oAuth2"},"typeVersion":1},{"id":"4b8b16d4-5363-4f08-b8b5-deac7f4250f3","name":"Edit existing file","type":"n8n-nodes-base.github","position":[1620,1360],"webhookId":"286cabce-a3ec-4202-9d94-d005502d73cc","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.owner }}"},"filePath":"={{$('Switch').first().json.id}}.json","resource":"file","operation":"edit","repository":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.name }}"},"fileContent":"={{$('isDiffOrNew').item.json[\"typebot_data_stringy\"]}}","commitMessage":"={{$('Switch').first().json.name}} ({{$json.github_status}})","authentication":"oAuth2"},"typeVersion":1},{"id":"c2cb20ab-07e5-41a3-8f7d-ed6474977226","name":"Return","type":"n8n-nodes-base.set","position":[1840,1560],"parameters":{"options":{},"assignments":{"assignments":[{"id":"8d513345-6484-431f-afb7-7cf045c90f4f","name":"Done","type":"boolean","value":true}]}},"typeVersion":3.3},{"id":"7ce14355-b3b9-4cd0-a09e-6d91bfe6bfcc","name":"Delete a file","type":"n8n-nodes-base.github","position":[1620,1860],"webhookId":"592f888e-3e41-49ce-b88a-d73f8756eac8","parameters":{"owner":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.owner }}"},"filePath":"={{$('Switch').first().json.name}}","resource":"file","operation":"delete","repository":{"__rl":true,"mode":"name","value":"={{ $('Switch').item.json.repo.name }}"},"commitMessage":"={{$('Switch').first().json.name}} (deleted)","authentication":"oAuth2"},"typeVersion":1.1},{"id":"c2252937-414f-446c-a2b1-96eef623f57e","name":"If","type":"n8n-nodes-base.if","position":[1400,1780],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"bb927e0c-f27b-4dce-80df-8d7611467045","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.isDeleted }}","rightValue":""}]}},"typeVersion":2.2},{"id":"10146994-a24f-4d9e-955d-f3e76f4abae0","name":"isDeleted","type":"n8n-nodes-base.code","position":[1180,1780],"parameters":{"jsCode":"const flow = $input.first().json.typebots;\n\nconst some = flow.some(x => x.id === $input.first().json.name.split(\".\")[0])\n\nreturn [{json: { isDeleted: !some }}];"},"typeVersion":2},{"id":"d692e133-5184-4753-bbab-751f9903b1cb","name":"isDiffOrNew","type":"n8n-nodes-base.code","position":[960,1360],"parameters":{"jsCode":"const orderJsonKeys = (jsonObj) => {\n  const ordered = {};\n  Object.keys(jsonObj).sort().forEach(key => {\n    ordered[key] = jsonObj[key];\n  });\n  return ordered;\n}\n\n// Check if file returned with content\nif (Object.keys($input.all()[0].json).includes(\"content\")) {\n  // Decode base64 content and parse JSON\n  const origFlow = JSON.parse(Buffer.from($input.all()[0].json.content, 'base64').toString());\n  const typebotFlow = $input.all()[1].json;\n  \n  // Order JSON objects\n  const orderedOriginal = orderJsonKeys(origFlow);\n  const orderedActual = orderJsonKeys(typebotFlow);\n\n  // Determine difference\n  if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n    $input.all()[0].json.github_status = \"same\";\n  } else {\n    $input.all()[0].json.github_status = \"different\";\n    $input.all()[0].json.typebot_data_stringy = JSON.stringify(orderedActual, null, 2);\n  }\n  $input.all()[0].json.content_decoded = orderedOriginal;\n// No file returned / new workflow\n} else if (Object.keys($input.all()[0].json).includes(\"data\")) {\n  const origFlow = JSON.parse($input.all()[0].json.data);\n  const typebotFlow = $input.all()[1].json;\n  \n  // Order JSON objects\n  const orderedOriginal = orderJsonKeys(origFlow);\n  const orderedActual = orderJsonKeys(typebotFlow);\n\n  // Determine difference\n  if (JSON.stringify(orderedOriginal) === JSON.stringify(orderedActual)) {\n    $input.all()[0].json.github_status = \"same\";\n  } else {\n    $input.all()[0].json.github_status = \"different\";\n    $input.all()[0].json.typebot_data_stringy = JSON.stringify(orderedActual, null, 2);\n  }\n  $input.all()[0].json.content_decoded = orderedOriginal;\n\n} else {\n  // Order JSON object\n  const typebotFlow = $input.all()[1].json;\n  const orderedActual = orderJsonKeys(typebotFlow);\n  \n  // Proper formatting\n  $input.all()[0].json.github_status = \"new\";\n  $input.all()[0].json.typebot_data_stringy = JSON.stringify(orderedActual, null, 2);\n}\n\n// Return items\nreturn $input.all();"},"typeVersion":1},{"id":"bcafd96c-6fd4-44ce-b975-33c7cf2dff84","name":"Check Status","type":"n8n-nodes-base.switch","position":[1180,1360],"parameters":{"rules":{"values":[{"outputKey":"new","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"aea200f9-9f83-4e4e-a965-65fddcbb6a5f","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{$json.github_status}}","rightValue":"new"}]},"renameOutput":true},{"outputKey":"different","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"706ebf35-6f74-43b6-9f98-94cf14107947","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{$json.github_status}}","rightValue":"different"}]},"renameOutput":true},{"outputKey":"same","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"30c8c5a8-269f-424a-93ed-d2cbe52acf7c","operator":{"type":"string","operation":"equals"},"leftValue":"={{$json.github_status}}","rightValue":"same"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"aaf2d938-ec55-4152-9e34-a2e2e6769760","name":"File is different","type":"n8n-nodes-base.noOp","position":[1400,1360],"parameters":{},"typeVersion":1},{"id":"f2759b0f-3ec3-434f-acfe-36c10ebb35bb","name":"File is new","type":"n8n-nodes-base.noOp","position":[1400,1160],"parameters":{},"typeVersion":1},{"id":"785fff83-40c4-4d38-9300-369e68779412","name":"File is same","type":"n8n-nodes-base.noOp","position":[1400,1560],"parameters":{},"typeVersion":1},{"id":"54804b0b-0001-4a41-afb5-12c0c6cf653c","name":"Merge","type":"n8n-nodes-base.merge","position":[740,1360],"parameters":{},"typeVersion":3.2},{"id":"b9cb042f-d767-4c2a-86f8-5d567d23c32a","name":"Switch","type":"n8n-nodes-base.switch","position":[80,1620],"parameters":{"rules":{"values":[{"outputKey":"typebot","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"8f6b31b0-a75c-4299-a530-d15b3ff65c9a","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.origin }}","rightValue":"typebot"}]},"renameOutput":true},{"outputKey":"github","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"09e36861-1120-4343-8d38-4797e9d67eec","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.origin }}","rightValue":"github"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"eb4adeea-418b-4d2d-a8ce-36739c195d7e","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[1460,740],"parameters":{"options":{"reset":"={{ $node[\"Loop Over Items\"].context[\"done\"] }}"}},"typeVersion":3},{"id":"58fb33e4-520e-4a58-b3ea-acdb5ef02208","name":"Execute Workflow","type":"n8n-nodes-base.executeWorkflow","position":[1680,740],"parameters":{"mode":"each","options":{},"workflowId":{"__rl":true,"mode":"id","value":"={{ $workflow.id }}"},"workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2}],"connections":{"If":{"main":[[{"node":"Delete a file","type":"main","index":0}],[{"node":"Return","type":"main","index":0}]]},"Merge":{"main":[[{"node":"isDiffOrNew","type":"main","index":0}]]},"Switch":{"main":[[{"node":"Get Typebot","type":"main","index":0}],[{"node":"isDeleted","type":"main","index":0}]]},"github":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Globals":{"main":[[{"node":"List Typebots","type":"main","index":0}]]},"typebot":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Split Out":{"main":[[{"node":"typebot","type":"main","index":0}]]},"isDeleted":{"main":[[{"node":"If","type":"main","index":0}]]},"List files":{"main":[[{"node":"github","type":"main","index":0}]]},"Edit Fields":{"main":[[{"node":"Merge","type":"main","index":1}]]},"File is new":{"main":[[{"node":"Create new file","type":"main","index":0}]]},"Get Typebot":{"main":[[{"node":"Get file data","type":"main","index":0},{"node":"Edit Fields","type":"main","index":0}]]},"isDiffOrNew":{"main":[[{"node":"Check Status","type":"main","index":0}]]},"Check Status":{"main":[[{"node":"File is new","type":"main","index":0}],[{"node":"File is different","type":"main","index":0}],[{"node":"File is same","type":"main","index":0}]]},"File is same":{"main":[[{"node":"Return","type":"main","index":0}]]},"Delete a file":{"main":[[{"node":"Return","type":"main","index":0}]]},"Get file data":{"main":[[{"node":"Merge","type":"main","index":0}]]},"List Typebots":{"main":[[{"node":"List files","type":"main","index":0},{"node":"Split Out","type":"main","index":0}]]},"Create new file":{"main":[[{"node":"Return","type":"main","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Execute Workflow","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Globals","type":"main","index":0}]]},"File is different":{"main":[[{"node":"Edit existing file","type":"main","index":0}]]},"Edit existing file":{"main":[[{"node":"Return","type":"main","index":0}]]},"On clicking 'execute'":{"main":[[{"node":"Globals","type":"main","index":0}]]},"Execute Workflow Trigger":{"main":[[{"node":"Switch","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":"a88d54d0dc140647df8f628579b3d5aae0dedb13c983a1f5c11ee14f54f18774","templateCredsSetupCompleted":true},"nodes":[{"id":"7d32401a-90d3-462d-ab44-435e92371afb","name":"Generate Proposal Copy","type":"@n8n/n8n-nodes-langchain.openAi","position":[220,0],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"messages":{"values":[{"role":"system","content":"You are a helpful, intelligent writing assistant."},{"content":"=Your task is to generate a proposal using input data from a form. This proposal should be highly customized, specific, and high-quality, considering we're going to be sending it immediately after you're done.\n\nContext: we are an automation/no-code agency that develops systems revolving around growth, revenue ops, etc.\n\nThe proposal template we're using has many fields. You must return these fields in one JSON object.\n\nUse this format:\n\n{\n  \"proposalTitle\": \"\",\n  \"problemTitle\": \"\",\n  \"problemText\": \"\",\n  \"solutionTitle\": \"\",\n  \"solutionText\": \"\",\n  \"scope1\": \"\",\n  \"scope2\": \"\",\n  \"scope3\": \"\",\n  \"scope4\": \"\",\n\"deliverable1\":\"\",\n\"deliverable2\":\"\",\n\"deliverable3\":\"\",\n  \"timeline1\": \"\",\n  \"timeline2\": \"\",\n  \"timeline3\": \"\"\n}\n\nRules:\n1. Use a spartan, casual tone of voice.\n2. Be to-the-point but professional\u2014assume you're writing to a sophisticated audience.\n3. Ensure that all fields are filled out. Do not miss a field or leave any variables empty.\n4. For problemText and solutionText, make sure to number the responses (usually 3, make sure they're inside of the string).\n5. There will only ever be 4 scoping bullet points, 3 timeline and 3 deliverable bullet points\u2014stick to this precisely. For the timelines, only say the amount of days (\"x days\")"},{"content":"={\"problem\":\"Right now they're managing all of their leads & projects in a massive Google Sheet. The key issues: their syst...
```

Erreur: Type error: expected object but got string at node 'Create PandaDoc Proposal'

[Assistant]
<thinking>
**Analyse de l'erreur**: Type error: expected object but got string at node 'Create PandaDoc Proposal'

**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é:** Type de données incorrect dans 'Create PandaDoc Proposal'

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

**Workflow corrigé:**
{"meta":{"instanceId":"a88d54d0dc140647df8f628579b3d5aae0dedb13c983a1f5c11ee14f54f18774","templateCredsSetupCompleted":true},"nodes":[{"id":"7d32401a-90d3-462d-ab44-435e92371afb","name":"Generate Proposal Copy","type":"@n8n/n8n-nodes-langchain.openAi","position":[220,0],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"GPT-4O"},"options":{},"messages":{"values":[{"role":"system","content":"You are a helpful, intelligent writing assistant."},{"content":"=Your task is to generate a proposal using input data from a form. This proposal should be highly customized, specific, and high-quality, considering we're going to be sending it immediately after you're done.\n\nContext: we are an automation/no-code agency that develops systems revolving around growth, revenue ops, etc.\n\nThe proposal template we're using has many fields. You must return these fields in one JSON object.\n\nUse this format:\n\n{\n  \"proposalTitle\": \"\",\n  \"problemTitle\": \"\",\n  \"problemText\": \"\",\n  \"solutionTitle\": \"\",\n  \"solutionText\": \"\",\n  \"scope1\": \"\",\n  \"scope2\": \"\",\n  \"scope3\": \"\",\n  \"scope4\": \"\",\n\"deliverable1\":\"\",\n\"deliverable2\":\"\",\n\"deliverable3\":\"\",\n  \"timeline1\": \"\",\n  \"timeline2\": \"\",\n  \"timeline3\": \"\"\n}\n\nRules:\n1. Use a spartan, casual tone of voice.\n2. Be to-the-point but professional—assume you're writing to a sophisticated audience.\n3. Ensure that all fields are filled out. Do not miss a field or leave any variables empty.\n4. For problemText and solutionText, make sure to number the responses (usually 3, make sure they're inside of the string).\n5. There will only ever be 4 scoping bullet points, 3 timeline and 3 deliverable bullet points—stick to this precisely. For the timelines, only say the amount of days (\"x days\")"},{"content":"={\"problem\":\"Right now they're managing all of their leads & projects in a massive Google Sheet. The key issues: their system is disorganized, incapable of scaling, and provides little in the way of accountability. Team members are manually updating fields, copying and pasting data, and there is no single source of truth.\",\n\"solution\":\"Migration to a dedicated CRM & project management solution like Monday.com, and a bespoke setup that includes a CRM board to handle new leads, alongside a PM board to handle new and ongoing projects. The creation of new records, and various administrative tasks alongside them, will be handled using both built in Monday automations and third party tools. I'll also create a process library of SOPs to improve operations more generally.\",\n\"deliverables\":\"completed Monday CRM, PM boards, process library of SOPs, training materials, video\",\n\"timeline\":\"two weeks\",\n\"companyDescription\":\"Robert Half is an executive recruiting firm that works primarily out of NYC.\"}"},{"role":"assistant","content":"={\n  \"proposalTitle\": \"Scalable Project Management system for Robert Half\",\n  \"problem\": {\n    \"title\": \"Your systems don't scale & you're paying too much\",\n    \"text\": \"1. You're using systems that don't scale\\n\\nCurrently, your team spends a ridiculous amount of time manually updating fields in a Google Sheet. This is resource-intensive, inefficient, and tedious—it's easy for a small mistake to cascade into a large one, and this has happened multiple times. Perhaps more importantly, there's no accountability, so when said problems inevitably arise, it's impossible to trace it back to its root and solve it.\\n\\n2. You're doing (and paying) too much\\n\\nGoogle Sheets is free. But the impact on your business has been costly. Given the archaic nature of your current setup, specific daily tasks are difficult to operationalize—leading to a large chunk of your employee/contractor costs going to admin tasks that are easily automatable.\\n\\n3. You're missing a ton of functionality\\n\\nGoogle Sheets is primarily textual, and misses the rich functionality afforded by more intentional CRMs. For instance, you can't assign owners to records, or automatically notify team members when something needs to happen (instead, everyone has to be online all the time \"just in case\"), or take advantage of more effective views to represent data flow.\"\n  },\n  \"solution\": {\n    \"title\": \"Scalable systems & built-in project management\",\n    \"text\": \"1. First, I'll migrate & build you a scalable system:\\n\\nI'll help you migrate to Monday.com, a dedicated CRM and project management platform. This will address many of the scalability issues inherent to Google Sheets—your team will be able to assign owners to records, receive notifications on important tasks, and communicate with eachother in a public, accountable way. \\n\\nIn addition, I'll build bespoke automations (both in Monday and using a third party tool, Make.com) to eliminate the need for manual record creation and related administrative functions. This will improve cycle time, better the quality of life of your staff, and decrease the likelihood of a costly error.\\n\\n2. Then, I'll help you improve cost efficiency:\\n\\nNext, we'll operationalize your procedures, add them to a library of SOPs, and begin scoping automated solutions to improve the effectiveness of each task. Much of the knowledge in your company currently exists in conversation or hidden direct messages and threads—turning this into a central, accessible knowledge base will streamline new hire onboarding, significantly improve margins on tasks, and make your team much more flexible.\"\n  },\n  \"scope\": {\n    \"1\": \"We'll migrate your current Google Sheets set-up to Monday.com, a scalable CRM & project management system\",\n    \"2\": \"We'll create two boards—a CRM board and a Project Management board—which will be your single source of truth for business operations moving forward.\",\n    \"3\": \"We'll build you a process library that exhaustively covers your business SOPs, which will let your team train faster and delegate work more effectively.\",\n    \"4\": \"We'll produce an end-to-end piece of video documentation of the system upon delivery.\"},\n\"deliverable\": {\n    \"1\": \"Sheets -> Monday Migration\",\n    \"2\": \"SOPs & Process Library\",\n    \"3\": \"Video Documentation\"\n  }\n  \"timeline\": {\n    \"1\": \"5 business days\",\n    \"2\": \"3 business days\",\n    \"3\": \"1 business day\"\n  }\n}"},{"content":"={\"problem\":\"{{ $json.form_response.answers[5].text }}\",\n\"solutionIPitched\":\"{{ $json.form_response.answers[6].text }}\"\"\n\"deliverables\":\"{{ $json.form_response.answers[7].text }}\",\n\"timeline\":\"{{ $json.form_response.answers[8].text }}\",\n\"companyDescription\":\"{{ $json.form_response.answers[4].text }}\"}"}]},"jsonOutput":true},"typeVersion":1.8},{"id":"2526fb73-6b90-4434-93d6-d605fdd702b8","name":"Create PandaDoc Proposal","type":"n8n-nodes-base.httpRequest","position":[620,0],"parameters":{"url":"https://api.pandadoc.com/public/v1/documents","method":"POST","options":{},"jsonBody":"={\n  \"owner\": {\n    \"email\": \"abdul@builtbyabdul.com\"\n  },\n  \"template_uuid\": \"<template id>\",\n  \"name\": \"Proposal for {{ $('Sales Call Form').item.json.form_response.answers[3].text }}\",\n  \"metadata\": {\n    \"clickup_id\": \"{{ $('Sales Call Form').item.json.form_response.hidden.clickup_id }}\",\n    \"project_type\": \"proposal\",\n    \"source\": \"typeform_automation\"\n  },\n  \"fields\": {\n    \"Initials\": {\n      \"value\": \"AM\"\n    }\n  },\n  \"tokens\": [\n    {\n      \"name\": \"Client.ProposalTitle\",\n      \"value\": \"{{ $json.message.content.proposalTitle }}\"\n    },\n    {\n      \"name\": \"Client.ProblemTitle\",\n      \"value\": \"{{ $json.message.content.problemTitle }}\"\n    },\n    {\n      \"name\": \"Client.ProblemText\",\n      \"value\": \"{{ $json.message.content.problemText.replace(/\\n/g, '\\\\n') }}\"\n    },\n    {\n      \"name\": \"Client.SolutionTitle\",\n      \"value\": \"{{ $json.message.content.solutionTitle }}\"\n    },\n    {\n      \"name\": \"Client.SolutionText\",\n      \"value\": \"{{ $json.message.content.solutionText.replace(/\\n/g, '\\\\n') }}\"\n    },\n    {\n      \"name\": \"Client.Scope1\",\n      \"value\": \"{{ $json.message.content.scope1 }}\"\n    },\n    {\n      \"name\": \"Client.Scope2\",\n      \"value\": \"{{ $json.message.content.scope2 }}\"\n    },\n    {\n      \"name\": \"Client.Scope3\",\n      \"value\": \"{{ $json.message.content.scope3 }}\"\n    },\n    {\n      \"name\": \"Client.Scope4\",\n      \"value\": \"{{ $json.message.content.scope4 }}\"\n    },\n    {\n      \"name\": \"Client.Company\",\n      \"value\": \"{{ $('Sales Call Form').item.json.form_response.answers[3].text }}\"\n    },\n    {\n      \"name\": \"Client.LastName\",\n      \"value\": \"{{ $('Sales Call Form').item.json.form_response.answers[1].text }}\"\n    },\n    {\n      \"name\": \"Client.FirstName\",\n      \"value\": \"{{ $('Sales Call Form').item.json.form_response.answers[0].text }}\"\n    },\n    {\n      \"name\": \"Client.Timeline1\",\n      \"value\": \"{{ $json.message.content.timeline1 }}\"\n    },\n    {\n      \"name\": \"Client.Timeline2\",\n      \"value\": \"{{ $json.message.content.timeline2 }}\"\n    },\n    {\n      \"name\": \"Client.Timeline3\",\n      \"value\": \"{{ $json.message.content.timeline3 }}\"\n    },\n    {\n      \"name\": \"Client.Deliverable1\",\n      \"value\": \"{{ $json.message.content.deliverable1 }}\"\n    },\n    {\n      \"name\": \"Client.Deliverable2\",\n      \"value\": \"{{ $json.message.content.deliverable2 }}\"\n    },\n    {\n      \"name\": \"Client.Deliverable3\",\n      \"value\": \"{{ $json.message.content.deliverable3 }}\"\n    }\n  ],\n  \"recipients\": [\n    {\n      \"delivery_methods\": {\n        \"email\": true\n      },\n      \"redirect\": {\n        \"is_enabled\": false,\n        \"url\": \"https://example.com\"\n      },\n      \"type\": \"recipient\",\n      \"role\": \"Client\",\n      \"email\": \"{{ $('Sales Call Form').item.json.form_response.answers[2].email }}\",\n      \"first_name\": \"{{ $('Sales Call Form').item.json.form_response.answers[0].text }}\",\n      \"last_name\": \"{{ $('Sales Call Form').item.json.form_response.answers[1].text }}\"\n    }\n  ],\n  \"pricing_tables\": [\n    {\n      \"name\": \"Pricing Table 1\",\n      \"options\": {\n        \"currency\": \"USD\"\n      },\n      \"sections\": [\n        {\n          \"rows\": [\n            {\n              \"data\": {\n                \"qty\": 1,\n                \"name\": \"{{ $json.message.content.proposalTitle }}\",\n                \"price\": \"{{ $('Sales Call Form').item.json.form_response.answers[9].number }}\"\n              },\n              \"options\": {\n                \"optional\": false,\n                \"qty_editable\": false,\n                \"optional_selected\": false\n              }\n            }\n          ],\n          \"title\": \"Pricing Section\",\n          \"default\": true\n        }\n      ]\n    }\n  ]\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","headerParameters":{"parameters":[{"name":"Authorization","value":"API-Key <your_api_key>"},{"name":"accept","value":"application/json"}]}},"typeVersion":4.2},{"id":"5fa8478e-1e09-4510-86ab-54bc46f7def5","name":"ClickUp","type":"n8n-nodes-base.clickUp","position":[960,0],"parameters":{"id":"={{ $('Sales Call Form').item.json.form_response.hidden.clickup_id }}","operation":"update","updateFields":{"content":"=Company Summary: {{ $('Sales Call Form').item.json.form_response.answers[4].text }} \n\nProblem: {{ $('Sales Call Form').item.json.form_response.answers[5].text }}\n\nSolution I pitched: {{ $('Sales Call Form').item.json.form_response.answers[6].text }}\n\nDeliverables: {{ $('Sales Call Form').item.json.form_response.answers[7].text }}\n\nHow long: {{ $('Sales Call Form').item.json.form_response.answers[8].text }}"},"authentication":"oAuth2"},"typeVersion":1},{"id":"96826976-e7c8-4eee-8245-47433633a4e7","name":"Add Company Name","type":"n8n-nodes-base.clickUp","position":[1260,-260],"parameters":{"task":"={{ $json.id }}","field":"={{ $json.custom_fields[0].id }}","value":"={{ $('Sales Call Form').item.json.form_response.answers[3].text }}","operation":"setCustomField","authentication":"oAuth2"},"typeVersion":1},{"id":"b8a6c4e1-08bb-4106-ad54-71b443b25638","name":"Quote","type":"n8n-nodes-base.clickUp","position":[1260,200],"parameters":{"task":"={{ $('ClickUp').item.json.id }}","field":"={{ $('ClickUp').item.json.custom_fields[9].id }}","value":"={{ $('Sales Call Form').item.json.form_response.answers[9].number }}","operation":"setCustomField","authentication":"oAuth2"},"typeVersion":1},{"id":"67bc4dd5-1a1c-4943-bd53-2961da61106f","name":"Proposal URL","type":"n8n-nodes-base.clickUp","position":[1260,-20],"parameters":{"task":"={{ $('ClickUp').item.json.id }}","field":"={{ $json.custom_fields[8].id }}","value":"=https://app.pandadoc.com/a/#/documents/{{ $('Create PandaDoc Proposal').item.json.id }}","operation":"setCustomField","authentication":"oAuth2"},"typeVersion":1},{"id":"3cf561e4-17ee-41ab-b282-b670a381e7b6","name":"Sales Call Form","type":"n8n-nodes-base.typeformTrigger","position":[0,0],"webhookId":"28fd78a2-c166-436b-8888-9f6b305ff2ad","parameters":{"formId":"RADFsrT7","onlyAnswers":false,"simplifyAnswers":false},"typeVersion":1.1},{"id":"847ab08d-ec61-4f24-b4b3-59427080e72a","name":"Create a Draft","type":"n8n-nodes-base.gmail","position":[1560,-20],"webhookId":"44ef2e2b-9d2b-4974-94f7-d418f1bb09e4","parameters":{"message":"=Hey {{ $('Sales Call Form').item.json.form_response.answers[0].text }}, thanks for the great call.\n

\nI put together a detailed proposal for you below. Please take a look at your earliest convenience and let me know your thoughts.\n

\n(proposal link)\n

\nHit me if you have any q's. You should be redirected pay after you sign, so I can get started soon as that's sorted.\n

\nCheers,
\nAbdul","options":{"sendTo":"={{ $('Sales Call Form').item.json.form_response.answers[2].email }}"},"subject":"sent you the Proposal","resource":"draft","emailType":"html"},"typeVersion":2.1}],"connections":{"ClickUp":{"main":[[{"node":"Add Company Name","type":"main","index":0},{"node":"Quote","type":"main","index":0},{"node":"Proposal URL","type":"main","index":0}]]},"Proposal URL":{"main":[[{"node":"Create a Draft","type":"main","index":0}]]},"Sales Call Form":{"main":[[{"node":"Generate Proposal Copy","type":"main","index":0}]]},"Add Company Name":{"main":[[]]},"Generate Proposal Copy":{"main":[[{"node":"Create PandaDoc Proposal","type":"main","index":0}]]},"Create PandaDoc Proposal":{"main":[[{"node":"ClickUp","type":"main","index":0}]]}}}