{
  "name": "Nextosoft - Form Talebi → Google Sheets + WhatsApp",
  "nodes": [
    {
      "parameters": {
        "content": "## Nextosoft · Form → WhatsApp otomasyonu\n\nRehber: https://nextosoft.com/rehber/form-whatsapp-otomasyonu\n\n**Kurulum**\n1. *Form Webhook* düğümünün adresini formunuzun gönderim adresi yapın.\n2. *Talebi Kaydet* düğümüne Google hesabınızı bağlayıp tablonuzu seçin (ilk satır: ad, telefon, email, hizmet, mesaj, kaynak, tarih).\n3. n8n ortam değişkenleri:\n   - `WHATSAPP_TOKEN` – Meta WhatsApp Cloud API erişim anahtarı\n   - `WHATSAPP_PHONE_NUMBER_ID` – gönderen numaranın kimliği\n   - `SALES_WHATSAPP_NUMBER` – bildirimin gideceği numara (905xxxxxxxxx)\n4. Meta'da `yeni_talep` adlı, Türkçe, 3 değişkenli ({{1}} ad, {{2}} hizmet, {{3}} telefon) bir mesaj şablonu oluşturup onaylatın.\n\nKurulumla uğraşmak istemezseniz: wa.me/905527096900",
        "height": 420,
        "width": 420
      },
      "id": "5f0c2a10-7a1e-4c55-9d3a-1b2c3d4e5f01",
      "name": "Kurulum Notu",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [-1080, -160]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "nextosoft-form-talebi",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "5f0c2a10-7a1e-4c55-9d3a-1b2c3d4e5f02",
      "name": "Form Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [-600, 0],
      "webhookId": "6a1d2e3f-4b5c-4d6e-8f70-81920a1b2c03"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ad",
              "name": "ad",
              "value": "={{ $json.body.name || $json.body.ad || $json.body.isim || 'İsimsiz' }}",
              "type": "string"
            },
            {
              "id": "telefon",
              "name": "telefon",
              "value": "={{ '+' + String($json.body.phone || $json.body.telefon || '').replace(/\\D/g, '').replace(/^0/, '90').replace(/^(5\\d{9})$/, '90$1') }}",
              "type": "string"
            },
            {
              "id": "email",
              "name": "email",
              "value": "={{ $json.body.email || $json.body.eposta || '' }}",
              "type": "string"
            },
            {
              "id": "hizmet",
              "name": "hizmet",
              "value": "={{ $json.body.subject || $json.body.service || $json.body.hizmet || 'Belirtilmedi' }}",
              "type": "string"
            },
            {
              "id": "mesaj",
              "name": "mesaj",
              "value": "={{ $json.body.message || $json.body.mesaj || '' }}",
              "type": "string"
            },
            {
              "id": "kaynak",
              "name": "kaynak",
              "value": "={{ $json.body.source || $json.body.kaynak || 'Web sitesi' }}",
              "type": "string"
            },
            {
              "id": "tarih",
              "name": "tarih",
              "value": "={{ $now.setZone('Europe/Istanbul').toFormat('dd.MM.yyyy HH:mm') }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "5f0c2a10-7a1e-4c55-9d3a-1b2c3d4e5f03",
      "name": "Alanları Düzenle",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [-360, 0]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": []
        },
        "options": {}
      },
      "id": "5f0c2a10-7a1e-4c55-9d3a-1b2c3d4e5f04",
      "name": "Talebi Kaydet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [-120, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/v21.0/{{ $env.WHATSAPP_PHONE_NUMBER_ID }}/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.WHATSAPP_TOKEN }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"{{ $env.SALES_WHATSAPP_NUMBER }}\",\n  \"type\": \"template\",\n  \"template\": {\n    \"name\": \"yeni_talep\",\n    \"language\": { \"code\": \"tr\" },\n    \"components\": [\n      {\n        \"type\": \"body\",\n        \"parameters\": [\n          { \"type\": \"text\", \"text\": {{ JSON.stringify($('Alanları Düzenle').item.json.ad) }} },\n          { \"type\": \"text\", \"text\": {{ JSON.stringify($('Alanları Düzenle').item.json.hizmet) }} },\n          { \"type\": \"text\", \"text\": {{ JSON.stringify($('Alanları Düzenle').item.json.telefon) }} }\n        ]\n      }\n    ]\n  }\n}",
        "options": {}
      },
      "id": "5f0c2a10-7a1e-4c55-9d3a-1b2c3d4e5f05",
      "name": "WhatsApp Bildirimi",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [120, 0]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={ \"ok\": true, \"message\": \"Talebiniz alındı, en kısa sürede dönüyoruz.\" }",
        "options": {
          "responseCode": 201
        }
      },
      "id": "5f0c2a10-7a1e-4c55-9d3a-1b2c3d4e5f06",
      "name": "Başarılı Yanıt",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [360, 0]
    }
  ],
  "pinData": {},
  "connections": {
    "Form Webhook": {
      "main": [[{ "node": "Alanları Düzenle", "type": "main", "index": 0 }]]
    },
    "Alanları Düzenle": {
      "main": [[{ "node": "Talebi Kaydet", "type": "main", "index": 0 }]]
    },
    "Talebi Kaydet": {
      "main": [[{ "node": "WhatsApp Bildirimi", "type": "main", "index": 0 }]]
    },
    "WhatsApp Bildirimi": {
      "main": [[{ "node": "Başarılı Yanıt", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "versionId": "7d2e9c41-5a6b-4c7d-8e9f-0a1b2c3d4e07",
  "meta": { "templateCredsSetupCompleted": false },
  "tags": []
}
