{
  "name": "Portfolio Contact Form",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "portfolio-contact",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        100,
        300
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "name",
              "value": "={{$json.body.name || 'Anonymous'}}"
            },
            {
              "name": "email",
              "value": "={{$json.body.email || 'no-email@test.com'}}"
            },
            {
              "name": "subject",
              "value": "={{$json.body.subject || 'Portfolio Contact'}}"
            },
            {
              "name": "message",
              "value": "={{$json.body.message || 'Empty message'}}"
            }
          ]
        },
        "options": {}
      },
      "name": "Format Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        300,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.groq.com/openai/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "groqApi",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "llama3-8b-8192"
            },
            {
              "name": "messages",
              "value": "={{ [ {\"role\": \"system\", \"content\": \"You are a helpful assistant. Draft a short, professional 1-sentence reply to acknowledge this message.\"}, {\"role\": \"user\", \"content\": $json.message} ] }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Groq AI Gen",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        500,
        200
      ]
    },
    {
      "parameters": {
        "sendTo": "hamroun1969@gmail.com",
        "subject": "={{$node[\"Format Data\"].json[\"subject\"]}}",
        "message": "=New Message from {{$node[\"Format Data\"].json[\"name\"]}} ({{$node[\"Format Data\"].json[\"email\"]}})\n\nContent:\n{{$node[\"Format Data\"].json[\"message\"]}}\n\n---\nAI Suggestion:\n{{$json.choices[0].message.content}}",
        "options": {}
      },
      "name": "Email Alert",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2,
      "position": [
        750,
        200
      ]
    },
    {
      "parameters": {
        "authentication": "webhook",
        "text": "=\ud83d\udea8 Portfolio Message: {{$node[\"Format Data\"].json.name}} says: {{$node[\"Format Data\"].json.message}}"
      },
      "name": "Slack Alert",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 1,
      "position": [
        750,
        400
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Format Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Data": {
      "main": [
        [
          {
            "node": "Groq AI Gen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq AI Gen": {
      "main": [
        [
          {
            "node": "Email Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}