{
  "name": "Client Registration",
  "nodes": [
    {
      "parameters": {
        "url": "https://api.genderize.io/",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $('On form submission').item.json.Name }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        160,
        112
      ],
      "id": "85c81c7a-392b-436a-9b53-12ec82c0b0ce",
      "name": "HTTP Request",
      "notes": "For gender"
    },
    {
      "parameters": {
        "url": "https://api.nationalize.io/",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $('On form submission').item.json.Name }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        352,
        112
      ],
      "id": "7a22ba28-cfb3-4c88-9ccf-8cc76b49a6b7",
      "name": "HTTP Request1"
    },
    {
      "parameters": {
        "url": "https://api.agify.io/",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $('On form submission').item.json.Name }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        544,
        112
      ],
      "id": "29ee4cdf-4139-4450-909d-80368c9175bd",
      "name": "HTTP Request2"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "messages": {
          "values": [
            {
              "content": "=You are an assistant helping to generate two emails in JSON format.\n\nGiven the following client details:\n\n- Name: {{ $json[\"Name\"] }}\n- Email: {{ $json[\"Email\"] }}\n- Budget: {{ $json[\"Budget\"] }}\n- Gender: {{ $json[\"Gender\"] }}\n- Age: {{ $json[\"Age\"] }}\n- Nationality: {{ $json[\"Nationality\"] }}\n\nGenerate two emails:\n\n1. **User Email** (to the person who filled the form)\n   - A friendly welcome message\n   - Thank them for registering\n   - Mention someone from the team will follow up\n   - Keep it short and professional (under 70 words)\n   - Include `subject` and `body` fields\n\n2. **Admin Email** (internal notification)\n   - Notify admin of new registration\n   - Include all client details clearly\n   - Professional tone\n   - Include `subject` and `body` fields\n\n\u26a0\ufe0f Return the output as a JSON object with the following structure:\n\n```json\n{\n  \"user_email\": {\n    \"subject\": \"string\",\n    \"body\": \"string\"\n  },\n  \"admin_email\": {\n    \"subject\": \"string\",\n    \"body\": \"string\"\n  }\n}\n"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        976,
        112
      ],
      "id": "95ae80e6-a6a4-4bd4-a572-6e27671e2835",
      "name": "Message a model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "formTitle": "Client Registration Form",
        "formDescription": "Please fill out the following form to register as a client. This information will help us understand your needs and provide you with the best possible service. All details will be kept confidential and used solely for onboarding and communication purposes.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name",
              "placeholder": "Your name",
              "requiredField": true
            },
            {
              "fieldLabel": "Email",
              "fieldType": "email",
              "placeholder": "Your email",
              "requiredField": true
            },
            {
              "fieldLabel": "Mobile Number (with country code)",
              "fieldType": "number",
              "placeholder": "Number",
              "requiredField": true
            },
            {
              "fieldLabel": "Budget (in rupees)",
              "placeholder": "Budget",
              "requiredField": true
            }
          ]
        },
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.3,
      "position": [
        -272,
        112
      ],
      "id": "c79c956d-ec6a-4d44-af8d-79afdec439e0",
      "name": "On form submission"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1Oi8TtUM-DfmzLLEfBwZSWYtk-oQKLc195peeJ3t29tQ",
          "mode": "list",
          "cachedResultName": "Customers",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Oi8TtUM-DfmzLLEfBwZSWYtk-oQKLc195peeJ3t29tQ/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Name": "={{ $json.Name }}",
            "Number": "={{ $json['Mobile Number (with country code)'] }}",
            "Budget": "={{ $json['Budget (in rupees)'] }}",
            "Email": "={{ $json.Email }}",
            "Id": "={{ $json.user_id }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Id",
              "displayName": "Id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Number",
              "displayName": "Number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget",
              "displayName": "Budget",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Gender",
              "displayName": "Gender",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Nationality",
              "displayName": "Nationality",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Age",
              "displayName": "Age",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -48,
        112
      ],
      "id": "cfab76c3-a0a5-4d74-8bda-89f59da47eca",
      "name": "Append row in sheet"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1Oi8TtUM-DfmzLLEfBwZSWYtk-oQKLc195peeJ3t29tQ",
          "mode": "list",
          "cachedResultName": "Customers",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/YOUR_GOOGLE_SHEETS_ID/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Number": "={{ $('Append row in sheet').item.json.Number }}",
            "Name": "={{ $('Append row in sheet').item.json.Name }}",
            "Budget": "={{ $('Append row in sheet').item.json.Budget }}",
            "Gender": "={{ $('HTTP Request').item.json.gender }}",
            "Nationality": "={{ $('HTTP Request1').item.json.country[0].country_id }}",
            "Age": "={{ $json.age }}",
            "Email": "={{ $('Append row in sheet').item.json.Email }}"
          },
          "matchingColumns": [
            "Number"
          ],
          "schema": [
            {
              "id": "Id",
              "displayName": "Id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Number",
              "displayName": "Number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Budget",
              "displayName": "Budget",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Gender",
              "displayName": "Gender",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Nationality",
              "displayName": "Nationality",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Age",
              "displayName": "Age",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "displayName": "Email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        752,
        112
      ],
      "id": "6aea52ca-3b41-4cc1-b29c-afb397774529",
      "name": "Append or update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sendTo": "={{ $('Append or update row in sheet').item.json.Email }}",
        "subject": "={{ $json.message.content.user_email.subject }}",
        "emailType": "text",
        "message": "={{ $json.message.content.user_email.body }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1312,
        16
      ],
      "id": "b7082a22-469c-43b4-8243-3508801220b6",
      "name": "To Client"
    },
    {
      "parameters": {
        "sendTo": "admin@yourcompany.com",
        "subject": "={{ $json.message.content.admin_email.subject }}",
        "emailType": "text",
        "message": "={{ $json.message.content.admin_email.body }}",
        "options": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1312,
        208
      ],
      "id": "464dfa51-2663-4d2f-a8fc-cc18fbb712ca",
      "name": "Send a message",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "HTTP Request": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "HTTP Request2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request2": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "To Client",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "To Client": {
      "main": [
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b03506fd-b415-49e9-8e00-c6858b062931",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "0CmofmlNItrDYSf1",
  "tags": [
    {
      "createdAt": "2025-10-03T16:35:45.143Z",
      "updatedAt": "2025-10-03T16:35:45.143Z",
      "id": "Ie1T8I5F5dfoBo9S",
      "name": "learning"
    },
    {
      "createdAt": "2025-10-05T06:00:43.469Z",
      "updatedAt": "2025-10-05T06:00:43.469Z",
      "id": "NGeawxRP7LaXFbvD",
      "name": "api"
    },
    {
      "createdAt": "2025-10-05T04:27:36.751Z",
      "updatedAt": "2025-10-05T04:27:36.751Z",
      "id": "SNO8LfARlW1bOFyo",
      "name": "learnn8n"
    }
  ]
}