{
  "name": "AI Support Email Drafter",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "support-request",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "asd00001-0001-4000-8000-000000000001",
      "name": "Support Request Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "field1",
              "name": "customerName",
              "value": "={{ $json.body.customerName }}",
              "type": "string"
            },
            {
              "id": "field2",
              "name": "issueDescription",
              "value": "={{ $json.body.issueDescription }}",
              "type": "string"
            },
            {
              "id": "field3",
              "name": "productName",
              "value": "={{ $json.body.productName }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "asd00001-0002-4000-8000-000000000002",
      "name": "Extract Request Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [460, 300]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a helpful customer support agent. Write professional, empathetic email replies to customer support requests. Keep replies concise, action-oriented, and end with next steps."
            },
            {
              "role": "user",
              "content": "Customer name: {{ $json.customerName }}\nProduct: {{ $json.productName }}\nIssue: {{ $json.issueDescription }}\n\nWrite a support reply email draft."
            }
          ]
        },
        "options": {
          "temperature": 0.7,
          "maxTokens": 500
        }
      },
      "id": "asd00001-0003-4000-8000-000000000003",
      "name": "Draft Reply with OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [680, 300]
    },
    {
      "parameters": {
        "operation": "create",
        "subject": "Re: Support Request from {{ $('Extract Request Fields').item.json.customerName }}",
        "message": "={{ $json.message.content }}",
        "toList": "={{ $('Extract Request Fields').item.json.customerEmail }}",
        "options": {
          "sendReply": false,
          "threadId": ""
        }
      },
      "id": "asd00001-0004-4000-8000-000000000004",
      "name": "Save as Gmail Draft",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [900, 300]
    }
  ],
  "connections": {
    "Support Request Webhook": {
      "main": [[{ "node": "Extract Request Fields", "type": "main", "index": 0 }]]
    },
    "Extract Request Fields": {
      "main": [[{ "node": "Draft Reply with OpenAI", "type": "main", "index": 0 }]]
    },
    "Draft Reply with OpenAI": {
      "main": [[{ "node": "Save as Gmail Draft", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
