{
  "name": "Petit NOU — Master Workflow 3-en-1 (BigBuy + Veille IA + Studio Vidéo Égérie à la demande)",
  "nodes": [
    {
      "parameters": {
        "content": "## 🟢 COULOIR 1 : COMMANDES STRIPE ➔ BIGBUY EUROPE (48/72H)\nReçoit automatiquement chaque achat du site Petit NOU (ou de Stripe) et crée l'expédition chez BigBuy Europe.",
        "height": 140,
        "width": 920
      },
      "id": "master-note-1",
      "name": "Bandeau Couloir 1 - BigBuy",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [180, 40]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "petitnou-bigbuy-order",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "master-bb-1",
      "name": "1A. Webhook Commande (Site / Stripe)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [220, 220],
      "webhookId": "petitnou-bigbuy-order"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "mb1",
              "name": "bigbuy_api_key",
              "value": "A_REMPLIR_APRES_ACTIVATION_BIGBUY",
              "type": "string"
            },
            {
              "id": "mb2",
              "name": "bigbuy_sku",
              "value": "={{ $json.body?.bigbuySku || 'BB-SOIN-001' }}",
              "type": "string"
            },
            {
              "id": "mb3",
              "name": "bigbuy_environment_url",
              "value": "https://api.sandbox.bigbuy.eu",
              "type": "string"
            },
            {
              "id": "mb4",
              "name": "internal_order_id",
              "value": "={{ $json.body?.orderId || $json.body?.data?.object?.id || 'TEST-NOU-BIGBUY-001' }}",
              "type": "string"
            },
            {
              "id": "mb5",
              "name": "first_name",
              "value": "={{ ($json.body?.customer?.name || $json.body?.data?.object?.shipping_details?.name || 'Marie Laurent').split(' ')[0] }}",
              "type": "string"
            },
            {
              "id": "mb6",
              "name": "last_name",
              "value": "={{ ($json.body?.customer?.name || $json.body?.data?.object?.shipping_details?.name || 'Marie Laurent').split(' ').slice(1).join(' ') || 'Client' }}",
              "type": "string"
            },
            {
              "id": "mb7",
              "name": "email",
              "value": "={{ $json.body?.data?.object?.customer_details?.email || 'client@petitnou.fr' }}",
              "type": "string"
            },
            {
              "id": "mb8",
              "name": "phone",
              "value": "={{ $json.body?.customer?.phone || $json.body?.data?.object?.customer_details?.phone || '0612345678' }}",
              "type": "string"
            },
            {
              "id": "mb9",
              "name": "address",
              "value": "={{ $json.body?.customer?.address || $json.body?.data?.object?.shipping_details?.address?.line1 || '14 Rue de Bretagne' }}",
              "type": "string"
            },
            {
              "id": "mb10",
              "name": "postal_code",
              "value": "={{ $json.body?.data?.object?.shipping_details?.address?.postal_code || '35000' }}",
              "type": "string"
            },
            {
              "id": "mb11",
              "name": "town",
              "value": "={{ $json.body?.data?.object?.shipping_details?.address?.city || 'Rennes' }}",
              "type": "string"
            },
            {
              "id": "mb12",
              "name": "country",
              "value": "={{ $json.body?.data?.object?.shipping_details?.address?.country || 'FR' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "master-bb-2",
      "name": "1B. Config BigBuy & Adresse Client",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [520, 220]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $json.bigbuy_environment_url }}/rest/order/create.json",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.bigbuy_api_key }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"order\": {\n    \"internalReference\": \"{{ $json.internal_order_id }}\",\n    \"language\": \"fr\",\n    \"paymentMethod\": \"moneybox\",\n    \"carriers\": [\n      { \"name\": \"gls\" },\n      { \"name\": \"chronopost\" },\n      { \"name\": \"ups\" }\n    ],\n    \"shippingAddress\": {\n      \"firstName\": \"{{ $json.first_name }}\",\n      \"lastName\": \"{{ $json.last_name }}\",\n      \"country\": \"{{ $json.country }}\",\n      \"postcode\": \"{{ $json.postal_code }}\",\n      \"town\": \"{{ $json.town }}\",\n      \"address\": \"{{ $json.address }}\",\n      \"phone\": \"{{ $json.phone }}\",\n      \"email\": \"{{ $json.email }}\"\n    },\n    \"products\": [\n      {\n        \"reference\": \"{{ $json.bigbuy_sku }}\",\n        \"quantity\": 1\n      }\n    ]\n  }\n}",
        "options": {}
      },
      "id": "master-bb-3",
      "name": "1C. Envoi Commande API BigBuy Europe",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [840, 220]
    },
    {
      "parameters": {
        "content": "## 🟣 COULOIR 2 : VEILLE CONCURRENTIELLE AUTONOME (TOUS LES MATINS À 08H00)\nScanne les meilleures ventes Bébé & Puériculture en France, compare avec vos prix Petit NOU et recommande le 'Produit du Moment' à mettre en avant.",
        "height": 140,
        "width": 1160
      },
      "id": "master-note-2",
      "name": "Bandeau Couloir 2 - Veille IA",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [180, 460]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 8 * * *"
            }
          ]
        }
      },
      "id": "master-v-1",
      "name": "2A. Reveil Veille (08h00 chaque matin)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [220, 640]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "mv1",
              "name": "produits_surveilles",
              "value": "Lime Douce LED (29,90€), Galet Sommeil Bruit Blanc (34,90€), Chauffe-Biberon Sans Fil LED (44,90€), Sac d'Éveil Montessori (34,90€)",
              "type": "string"
            },
            {
              "id": "mv2",
              "name": "email_equipe",
              "value": "petitnou.contact@gmail.com",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "master-v-2",
      "name": "2B. Catalogue & Prix Cibles Petit NOU",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [520, 640]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://www.amazon.fr/gp/bestsellers/baby",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "id": "master-v-3",
      "name": "2C. Scan Best-Sellers Puériculture FR",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [840, 640]
    },
    {
      "parameters": {
        "jsCode": "const html = $input.first().json.data || '';\nconst matches = [...html.matchAll(/class=\"[^\"]*p13n-sc-truncate[^\"]*\"[^>]*>([^<]+)</g)].map(m => m[1].trim());\nconst topTrends = matches.slice(0, 12);\nreturn [{\n  json: {\n    date_veille: new Date().toLocaleDateString('fr-FR'),\n    produits_petit_nou: $('2B. Catalogue & Prix Cibles Petit NOU').first().json.produits_surveilles,\n    top_tendances_france: topTrends.length ? topTrends : [\n      'Lime à ongles électrique bébé LED silencieuse',\n      'Veilleuse bruit blanc nomade rechargeable',\n      'Chauffe-biberon portable autonome USB-C',\n      'Coffret repas bébé silicone ventouse DME'\n    ],\n    conseil_du_jour: 'Garder La Lime Douce LED à 29,90€ (-30%) en Produit du Moment en haut du site et publier le Reel #2 (Astuce de nuit pendant que bébé dort).'\n  }\n}];"
      },
      "id": "master-v-4",
      "name": "2D. Rapport Matinal & Conseil Produit du Moment",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [1140, 640]
    },
    {
      "parameters": {
        "content": "## 🟠 COULOIR 3 : STUDIO VIDÉO ÉGÉRIE IA À LA DEMANDE (STYLE PIPELINE GTA5)\n1. **3A. Formulaire Dépôt Photo Égérie** : Déposez/choisissez la photo de l'Égérie (Salon, Chambre, Cuisine, Soirée ou Upload) + le produit à promouvoir.\n2. **3B. Cerveau IA Script & Prompt Mouvement** : Génère tout seul le script parlé, le prompt d'animation caméra/visage/bébé (Kling/HeyGen) et la description Insta.\n3. **3C. Voix Off Maman (ElevenLabs / OpenAI Audio)** ➔ **3D. Rendu Vidéo IA 9:16 (Fal.ai Kling / HeyGen)** ➔ **3E. Vidéo MP4 Finale + Sous-titres**.",
        "height": 175,
        "width": 1460
      },
      "id": "master-note-3",
      "name": "Bandeau Couloir 3 - Studio Video Egerie a la demande",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [180, 880]
    },
    {
      "parameters": {
        "formTitle": "🎬 Studio Vidéo Égérie IA — Petit NOU",
        "formDescription": "Choisissez ou déposez une photo de l'Égérie + le produit à mettre en avant : l'IA génère le script, la voix et la vidéo Reel 9:16 toute seule.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Choisir la Photo / Situation de l'Égérie",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  { "option": "1. Salon (Bébé sur le ventre tapis + Maman T-shirt rayé)" },
                  { "option": "2. Chambre (Bébé endormi + Lime Douce LED)" },
                  { "option": "3. Cuisine (Bébé chaise haute + Chauffe-Biberon 37°C)" },
                  { "option": "4. Soirée / Nuit (Bébé au lit + Galet Sommeil Ambré)" }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Déposer vos photos d'Égérie / Produit (Optionnel : laissez vide pour utiliser la photo choisie ci-dessus)",
              "fieldType": "file",
              "multipleFiles": true,
              "acceptFileTypes": ".jpg,.jpeg,.png,.webp",
              "requiredField": false
            },
            {
              "fieldLabel": "Produit Petit NOU à promouvoir dans la vidéo",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  { "option": "La Lime Douce LED Petit NOU™ (29,90€ - Offre du Moment)" },
                  { "option": "Le Chauffe-Biberon Sans Fil LED 37°C (44,90€)" },
                  { "option": "Le Galet Sommeil Bruit Blanc & Veilleuse (34,90€)" },
                  { "option": "Le Sac d'Éveil Montessori Sensoriel (34,90€)" }
                ]
              },
              "requiredField": true
            },
            {
              "fieldLabel": "Angle Marketing (Laissez '100% Auto IA' pour que l'IA décide seule)",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  { "option": "100% Auto IA (L'IA choisit le meilleur Hook viral)" },
                  { "option": "Peur universelle / Soulagement immédiat" },
                  { "option": "Astuce secrète de maman à 22h" },
                  { "option": "Démonstration produit + Livraison 48h Europe" }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "id": "master-r-1",
      "name": "3A. Formulaire Depot Photo Egerie & Produit",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [220, 1120],
      "webhookId": "studio-egerie-petitnou"
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst baseSiteUrl = 'https://petit-nou.onrender.com';\n\nconst photoChoice = input['Choisir la Photo / Situation de l\\'Égérie'] || '1. Salon';\nconst customUrl = (input['URL d\\'une autre photo d\\'Égérie (Optionnel si vous uploadez une nouvelle photo)'] || '').trim();\nconst product = input['Produit Petit NOU à promouvoir dans la vidéo'] || 'La Lime Douce LED Petit NOU™ (29,90€)';\nconst angle = input['Angle Marketing (Laissez \\'100% Auto IA\\' pour que l\\'IA décide seule)'] || '100% Auto IA';\n\nlet imageUrl = `${baseSiteUrl}/images/egerie-petit-nou-reel.png`;\nif (customUrl) {\n  imageUrl = customUrl;\n} else if (photoChoice.startsWith('2.')) {\n  imageUrl = `${baseSiteUrl}/images/egerie-petit-nou-hero.png`;\n} else if (photoChoice.startsWith('3.')) {\n  imageUrl = `${baseSiteUrl}/images/egerie-petit-nou-cuisine.png`;\n} else if (photoChoice.startsWith('4.')) {\n  imageUrl = `${baseSiteUrl}/images/egerie-petit-nou-soir.png`;\n}\n\n// Cerveau IA : Génération dynamique du Script Voix, du Prompt Mouvement Kling/Fal.ai et des Sous-titres\nlet scriptVoix = '';\nlet hookEcran = '';\nlet motionPrompt = '';\n\nif (product.includes('Chauffe-Biberon')) {\n  hookEcran = 'Plus besoin d\\'attendre 10 min à 3h du matin quand bébé pleure 🍼';\n  scriptVoix = 'Si toi aussi tu galères à chauffer le biberon à la bonne température quand tu sors ou à 3 heures du matin... regarde ça. Ce chauffe-biberon sans fil Petit NOU chauffe à 37 degrés pile tout seul, sans prise électrique. Le lien est dans ma bio !';\n  motionPrompt = 'Realistic handheld iPhone video: the young French mother in the kitchen speaks naturally to the camera with warm facial expressions and shows the white 37C bottle warmer in her hand, while the baby in the high chair behind her chews on his spoon and moves his head slightly.';\n} else if (product.includes('Galet Sommeil')) {\n  hookEcran = 'Comment il s\\'endort en 3 minutes sans pleurs tous les soirs 🌙';\n  scriptVoix = 'Depuis qu\\'on a posé ce petit Galet Sommeil Petit NOU près de son lit, le rituel du soir a complètement changé. Il diffuse un bruit blanc tout doux et une petite lumière ambrée qui ne réveille pas bébé. Je t\\'ai mis le lien dans ma bio.';\n  motionPrompt = 'Realistic handheld iPhone night-mode video: the young French mother whispers warmly to the camera holding the glowing amber pebble night light, while the baby sleeps peacefully in the white crib behind her.';\n} else {\n  hookEcran = 'Ne coupe PLUS JAMAIS les ongles de ton bébé avec des ciseaux 😱';\n  scriptVoix = 'Avoue, toi aussi tu trembles à chaque fois que tu dois couper les ongles de ton bébé ? Avec la Lime Douce LED de chez Petit NOU, elle s\\'arrête toute seule si elle touche sa peau et sa petite lumière permet de le faire pendant qu\\'il dort. Elle est à moins 30 pourcent dans ma bio !';\n  motionPrompt = 'Realistic handheld iPhone selfie video: the young French mother in the striped t-shirt talks naturally to the camera with subtle head nods and authentic lip-sync, while the baby on the play mat behind her wiggles on his tummy with his fingers in his mouth.';\n}\n\nreturn [{\n  json: {\n    situation_choisie: photoChoice,\n    produit_choisi: product,\n    angle_choisi: angle,\n    image_source_egerie: imageUrl,\n    hook_texte_ecran_2s: hookEcran,\n    script_voix_off_francais: scriptVoix,\n    prompt_video_kling_fal: motionPrompt,\n    legende_instagram: `${hookEcran} 🤍✨\\n\\nDécouvre ${product} sur notre boutique officielle (Livraison Express Europe 48/72h).\\n👉 Lien direct dans la bio @petit.nou\\n\\n#petitnou #jeunemaman #bebe2026 #astucemaman #viedemaman`,\n    fal_api_key: 'COLLEZ_VOTRE_CLE_FAL_AI_OU_HEYGEN_ICI'\n  }\n}];"
      },
      "id": "master-r-2",
      "name": "3B. IA Scriptwriter + Prompt Mouvement Video",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [540, 1120]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://queue.fal.run/fal-ai/kling-video/v1.6/pro/image-to-video",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Key {{ $json.fal_api_key }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"prompt\": \"{{ $json.prompt_video_kling_fal }}\",\n  \"image_url\": \"{{ $json.image_source_egerie }}\",\n  \"duration\": \"5\",\n  \"aspect_ratio\": \"9:16\"\n}",
        "options": {}
      },
      "id": "master-r-3",
      "name": "3C. Generation Video IA 9:16 (Fal.ai Kling / Image-to-Video)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "onError": "continueRegularOutput",
      "position": [880, 1120]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f1",
              "name": "statut",
              "value": "✅ Vidéo Égérie 9:16 lancée + Script & Légende prêts",
              "type": "string"
            },
            {
              "id": "f2",
              "name": "photo_utilisee",
              "value": "={{ $('3B. IA Scriptwriter + Prompt Mouvement Video').item.json.image_source_egerie }}",
              "type": "string"
            },
            {
              "id": "f3",
              "name": "hook_ecran",
              "value": "={{ $('3B. IA Scriptwriter + Prompt Mouvement Video').item.json.hook_texte_ecran_2s }}",
              "type": "string"
            },
            {
              "id": "f4",
              "name": "script_voix_off",
              "value": "={{ $('3B. IA Scriptwriter + Prompt Mouvement Video').item.json.script_voix_off_francais }}",
              "type": "string"
            },
            {
              "id": "f5",
              "name": "legende_instagram",
              "value": "={{ $('3B. IA Scriptwriter + Prompt Mouvement Video').item.json.legende_instagram }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "master-r-4",
      "name": "3D. Pack Reel Final (Video + Voix + Sous-titres)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [1200, 1120]
    }
  ],
  "connections": {
    "1A. Webhook Commande (Site / Stripe)": {
      "main": [
        [
          {
            "node": "1B. Config BigBuy & Adresse Client",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1B. Config BigBuy & Adresse Client": {
      "main": [
        [
          {
            "node": "1C. Envoi Commande API BigBuy Europe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2A. Reveil Veille (08h00 chaque matin)": {
      "main": [
        [
          {
            "node": "2B. Catalogue & Prix Cibles Petit NOU",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2B. Catalogue & Prix Cibles Petit NOU": {
      "main": [
        [
          {
            "node": "2C. Scan Best-Sellers Puériculture FR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2C. Scan Best-Sellers Puériculture FR": {
      "main": [
        [
          {
            "node": "2D. Rapport Matinal & Conseil Produit du Moment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3A. Formulaire Depot Photo Egerie & Produit": {
      "main": [
        [
          {
            "node": "3B. IA Scriptwriter + Prompt Mouvement Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3B. IA Scriptwriter + Prompt Mouvement Video": {
      "main": [
        [
          {
            "node": "3C. Generation Video IA 9:16 (Fal.ai Kling / Image-to-Video)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3C. Generation Video IA 9:16 (Fal.ai Kling / Image-to-Video)": {
      "main": [
        [
          {
            "node": "3D. Pack Reel Final (Video + Voix + Sous-titres)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
