{
  "name": "Yapay zeka e-posta asistanı",
  "nodes": [
    {
      "parameters": {
        "postProcessAction": "read",
        "format": "simple",
        "options": {}
      },
      "type": "n8n-nodes-base.emailReadImap",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "id": "n1",
      "name": "Yeni e-posta",
      "credentials": {
        "imap": {
          "id": "",
          "name": "Posta kutum (IMAP)"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-3.5-flash-lite:generateContent",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ contents: [{ parts: [{ text: 'Aşağıdaki e-postayı oku. Türkçe, en fazla iki kısa cümleyle özetle ve önemini 1 ile 10 arasında puanla (10: hemen ilgilenilmeli, 7 ve üstü: bugün bakılmalı, 1: önemsiz bülten ya da reklam). Gönderen: ' + $json.from + ' | Konu: ' + $json.subject + ' | E-posta metni: ' + ($json.textPlain || $json.text) }] }], generationConfig: { responseMimeType: 'application/json', responseSchema: { type: 'OBJECT', properties: { ozet: { type: 'STRING' }, puan: { type: 'INTEGER' } }, required: ['ozet', 'puan'] } } }) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        300,
        0
      ],
      "id": "n2",
      "name": "Gemini ile özetle ve puanla",
      "credentials": {
        "httpHeaderAuth": {
          "id": "",
          "name": "Gemini API anahtarı"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "ozet",
              "type": "string",
              "value": "={{ JSON.parse($json.candidates[0].content.parts[0].text).ozet }}"
            },
            {
              "id": "a2",
              "name": "puan",
              "type": "number",
              "value": "={{ JSON.parse($json.candidates[0].content.parts[0].text).puan }}"
            },
            {
              "id": "a3",
              "name": "konu",
              "type": "string",
              "value": "={{ $('Yeni e-posta').item.json.subject }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        600,
        0
      ],
      "id": "n3",
      "name": "Sonucu ayıkla"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.puan }}",
              "rightValue": 7,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        900,
        0
      ],
      "id": "n4",
      "name": "Önemli mi? (puan 7 ve üstü)"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://ntfy/",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ topic: 'gizli-konu-adin-buraya', title: 'Önem ' + $json.puan + '/10: ' + $json.konu, message: $json.ozet, priority: $json.puan >= 9 ? 5 : 4, tags: ['email'] }) }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1200,
        -100
      ],
      "id": "n5",
      "name": "Telefona bildirim gönder (ntfy)"
    }
  ],
  "connections": {
    "Yeni e-posta": {
      "main": [
        [
          {
            "node": "Gemini ile özetle ve puanla",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini ile özetle ve puanla": {
      "main": [
        [
          {
            "node": "Sonucu ayıkla",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sonucu ayıkla": {
      "main": [
        [
          {
            "node": "Önemli mi? (puan 7 ve üstü)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Önemli mi? (puan 7 ve üstü)": {
      "main": [
        [
          {
            "node": "Telefona bildirim gönder (ntfy)",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {}
}