{
  "name": "DzRouter · 08 · Annonce Ouedkniss / Marketplace",
  "nodes": [
    {
      "id": "dfdb935f-5752-5849-9b0f-d106f68f4e6a",
      "name": "Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -260
      ],
      "parameters": {
        "content": "## Annonces Ouedkniss / Marketplace\n\n1. Installez le nœud communautaire **n8n-nodes-dzrouter** (Paramètres → Community nodes).\n2. Ouvrez chaque nœud DzRouter et choisissez votre identifiant **DzRouter API** (clé `sk-dz-…`).\n3. Cliquez **Test workflow** : un exemple algérien est déjà chargé.\n\n---\n\n<div dir=\"rtl\">\n\n### إعلانات واد كنيس\n\n1. ثبّت العقدة **n8n-nodes-dzrouter** (الإعدادات ← Community nodes).\n2. افتح كل عقدة DzRouter واختر بيانات اعتماد **DzRouter API** (مفتاح `sk-dz-…`).\n3. اضغط **Test workflow**: مثال جزائري جاهز للتجربة.\n\n</div>\n\n---\n\n### Listing writer\n\n1. Install the **n8n-nodes-dzrouter** community node (Settings → Community nodes).\n2. Open each DzRouter node and pick your **DzRouter API** credential (`sk-dz-…` key).\n3. Click **Test workflow**: an Algerian sample is already loaded.",
        "height": 560,
        "width": 440,
        "color": 4
      }
    },
    {
      "id": "9572091f-a73f-5257-909c-b86fee4098db",
      "name": "Form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        0,
        0
      ],
      "parameters": {
        "formTitle": "🏷️ Rédacteur d'annonces",
        "formDescription": "Ouedkniss · Facebook Marketplace · Instagram",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Produit",
              "fieldType": "text",
              "requiredField": true
            },
            {
              "fieldLabel": "Caractéristiques",
              "fieldType": "textarea",
              "placeholder": "état, marque, taille, couleur, garantie…"
            },
            {
              "fieldLabel": "Prix (DA)",
              "fieldType": "number"
            },
            {
              "fieldLabel": "Ville / wilaya",
              "fieldType": "text"
            },
            {
              "fieldLabel": "Plateforme",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Ouedkniss"
                  },
                  {
                    "option": "Facebook Marketplace"
                  },
                  {
                    "option": "Instagram"
                  }
                ]
              }
            }
          ]
        },
        "responseMode": "lastNode",
        "options": {
          "appendAttribution": false
        }
      }
    },
    {
      "id": "443ccb1e-ccc1-59ec-9904-e29c32520cca",
      "name": "Write listing",
      "type": "n8n-nodes-dzrouter.dzRouter",
      "typeVersion": 1,
      "position": [
        260,
        0
      ],
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "openai/gpt-4o-mini"
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=Tu rédiges des annonces efficaces pour le marché algérien ({{ $json.Plateforme }}). Prix en dinars (DA). Réponds uniquement en JSON : {\"title\":\"…\",\"description_fr\":\"…\",\"description_ar\":\"…\",\"darja_hook\":\"…\",\"keywords\":[\"…\"],\"tips\":[\"…\"]}. Pas d'informations inventées : n'utilise que les détails fournis. tips = 3 conseils pour mieux vendre (photos, prix, réponse aux messages)."
            },
            {
              "role": "user",
              "content": "=Produit : {{ $json.Produit }}\nCaractéristiques : {{ $json['Caractéristiques'] }}\nPrix : {{ $json['Prix (DA)'] }} DA\nLieu : {{ $json['Ville / wilaya'] }}"
            }
          ]
        },
        "simplify": true,
        "options": {
          "temperature": 0.6,
          "maxTokens": 1500,
          "responseFormat": "json_object"
        }
      }
    },
    {
      "id": "b4e74219-fc0b-50b3-9fdd-fba6ccbf08e6",
      "name": "Build page",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        0
      ],
      "parameters": {
        "jsCode": "const esc = (s) => String(s ?? '').replace(/[&<>\"]/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '\"': '&quot;' }[c]));\nconst page = (title, body) => `<div style=\"font-family:system-ui,Segoe UI,Tahoma,sans-serif;max-width:720px;margin:0 auto;line-height:1.6;color:#0f1c16\">\n<h2 style=\"color:#007f00;margin:0 0 12px\">${esc(title)}</h2>${body}\n<p style=\"color:#4f6158;font-size:13px;margin-top:24px\">Généré avec DzRouter · dzrouter.com</p></div>`;\n\nconst r = $('Write listing').first().json.json ?? {};\nconst block = (t, v, dir = 'auto') => `<h3>${t}</h3><div dir=\"${dir}\" style=\"padding:10px;background:#f1f6f2;border-radius:8px\">${esc(v).replace(/\\n/g, '<br>')}</div>`;\nconst body = block('Titre', r.title) + block('Description (FR)', r.description_fr, 'ltr') + block('الوصف (AR)', r.description_ar, 'rtl') +\n  block('Accroche darja', r.darja_hook) + `<h3>Mots-clés</h3><p>${(r.keywords ?? []).map(esc).join(' · ')}</p>` +\n  `<h3>Conseils</h3><ul>${(r.tips ?? []).map((t) => `<li>${esc(t)}</li>`).join('')}</ul>`;\nreturn [{ json: { html: page('🏷️ Votre annonce', body) } }];"
      }
    },
    {
      "id": "a49b3ce4-bd81-5b8e-a6e0-efc880ee7dac",
      "name": "Show result",
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        780,
        0
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "={{ $json.html }}"
      }
    }
  ],
  "connections": {
    "Form": {
      "main": [
        [
          {
            "node": "Write listing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write listing": {
      "main": [
        [
          {
            "node": "Build page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build page": {
      "main": [
        [
          {
            "node": "Show result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {
    "Form": [
      {
        "json": {
          "Produit": "iPhone 13 128 Go",
          "Caractéristiques": "Très bon état, batterie 89 %, couleur bleu, avec boîte et chargeur, jamais réparé",
          "Prix (DA)": 98000,
          "Ville / wilaya": "Blida",
          "Plateforme": "Ouedkniss",
          "submittedAt": "2026-10-13T10:00:00.000+01:00",
          "formMode": "test"
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false,
    "templateId": "dzrouter"
  }
}
