{
  "id": "S1kEb0k5FjJfemss",
  "meta": {
    "instanceId": "267fa0f8e6ffad0c3e1050b4f520684a46385547464ed67396cb69557a66aa4e"
  },
  "name": "Forms Lead Capture to Airtable CRM with AI Email Draft Approval",
  "tags": [],
  "nodes": [
    {
      "id": "18f93941-0514-4410-a269-ebd7213d6a75",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1072,
        1600
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "slackChannel",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Slack channel ID for sales team__>"
            },
            {
              "id": "id-2",
              "name": "airtableBaseId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Airtable base ID__>"
            },
            {
              "id": "id-3",
              "name": "airtableTableId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Airtable table ID__>"
            },
            {
              "id": "id-4",
              "name": "companyName",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Your Company Name__>"
            },
            {
              "id": "id-5",
              "name": "senderName",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Your Name__>"
            },
            {
              "id": "id-6",
              "name": "senderTitle",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Your Title__>"
            },
            {
              "id": "id-7",
              "name": "companyEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Company Email__>"
            },
            {
              "id": "id-8",
              "name": "companyPhone",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Company Phone__>"
            },
            {
              "id": "id-9",
              "name": "companyAddress",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Company Address__>"
            },
            {
              "id": "id-10",
              "name": "linkedinUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__LinkedIn URL__>"
            },
            {
              "id": "id-11",
              "name": "twitterUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Twitter URL__>"
            },
            {
              "id": "id-12",
              "name": "facebookUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Facebook URL__>"
            },
            {
              "id": "id-13",
              "name": "websiteUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Website URL__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "faafb419-ad4f-4643-9b56-24b30f855cfe",
      "name": "Extract Lead Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -848,
        1600
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "leadName",
              "type": "string",
              "value": "={{ $json.body.name || 'Unknown' }}"
            },
            {
              "id": "id-2",
              "name": "leadEmail",
              "type": "string",
              "value": "={{ $json.body.email || '' }}"
            },
            {
              "id": "id-3",
              "name": "leadCompany",
              "type": "string",
              "value": "={{ $json.body.company || '' }}"
            },
            {
              "id": "id-4",
              "name": "leadPhone",
              "type": "string",
              "value": "={{ $json.body.phone || '' }}"
            },
            {
              "id": "id-5",
              "name": "leadMessage",
              "type": "string",
              "value": "={{ $json.body.message || '' }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "da6733ad-bef2-41f9-b33a-180158fb93f1",
      "name": "Generate Email Draft",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -624,
        1600
      ],
      "parameters": {
        "text": "=You are a professional sales assistant. Based on the lead information provided, write a personalized and engaging follow-up email. \n\nAlways Use the Lead details to personalize the email:\n- Name: {{ $json.Name }}\n- Email: {{ $json.Email }}\n- Company: {{ $json.Company }}\n- Phone: {{ $json.Phone }}\n- Message: {{ $json.Message }}\n\nWrite a warm, professional email that:\n1. Thanks them for their interest\n2. Addresses their specific inquiry or message\n3. Highlights how we can help\n4. Includes a clear call-to-action\n5. Maintains a friendly but professional tone\n\nReturn ONLY the email body text, no subject line.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "efe047b8-1294-4358-a52a-fc4749e29ce6",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -560,
        1824
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "credential-id",
          "name": "openAiApi Credential"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "aa0b05bd-3c27-479d-adca-d0d279ec7772",
      "name": "Wait for Approval",
      "type": "n8n-nodes-base.wait",
      "position": [
        -48,
        1600
      ],
      "webhookId": "5ff74c3e-6848-4ee1-87fc-65a4933456f5",
      "parameters": {
        "resume": "webhook",
        "options": {},
        "resumeAmount": 24,
        "limitWaitTime": true
      },
      "typeVersion": 1.1
    },
    {
      "id": "fe447420-96da-484b-965a-8c6091db3bcd",
      "name": "Check Approval Status",
      "type": "n8n-nodes-base.if",
      "position": [
        176,
        1600
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $('Wait for Approval').item.json.query.action }}",
              "rightValue": "approve"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "5727706c-2cf3-4f3c-a659-ef2791302905",
      "name": "Send Email to Lead",
      "type": "n8n-nodes-base.gmail",
      "position": [
        400,
        1504
      ],
      "webhookId": "b52725e9-16fb-416e-8b88-e41b6ffebf69",
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json.Email }}",
        "message": "=<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Thank You for Your Interest</title>\n</head>\n<body style=\"margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f4f4f4;\">\n  <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"background-color: #f4f4f4; padding: 20px 0;\">\n    <tr>\n      <td align=\"center\">\n        <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"max-width: 600px; background-color: #ffffff; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1);\">\n          \n          <!-- Main Content -->\n          <tr>\n            <td style=\"padding: 40px 30px; background-color: #ffffff;\">\n              <div style=\"color: #333333; font-size: 16px; line-height: 1.8;\">\n                {{ $('Generate Email Draft').item.json.output }}\n              </div>\n            </td>\n          </tr>\n          \n          <!-- Signature Section -->\n          <tr>\n            <td style=\"padding: 30px; background-color: #f9f9f9; border-top: 1px solid #e0e0e0;\">\n              <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n                <tr>\n                  <td>\n                    <p style=\"margin: 0 0 10px 0; color: #333333; font-size: 16px; font-weight: bold;\">Best regards,</p>\n                    <p style=\"margin: 0 0 5px 0; color: #667eea; font-size: 18px; font-weight: bold;\">{{ $('Workflow Configuration').item.json.senderName }}</p>\n                    <p style=\"margin: 0 0 5px 0; color: #666666; font-size: 14px;\">{{ $('Workflow Configuration').item.json.companyName }}</p>\n                    <p style=\"margin: 0; color: #666666; font-size: 14px;\">Email: {{ $('Workflow Configuration').item.json.companyEmail }} | Phone: {{ $('Workflow Configuration').item.json.companyPhone }}</p>\n                  </td>\n                </tr>\n              </table>\n            </td>\n          </tr>\n          \n          <!-- Footer -->\n          <tr>\n            <td style=\"padding: 30px; background-color: #2c3e50; text-align: center;\">\n              <p style=\"margin: 0 0 15px 0; color: #ffffff; font-size: 14px;\">Connect with us:</p>\n              <table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n                <tr>\n                  <td align=\"center\">\n                    <a href=\"{{ $('Workflow Configuration').item.json.linkedinUrl }}\" style=\"display: inline-block; margin: 0 10px; color: #ffffff; text-decoration: none; font-size: 14px;\">LinkedIn</a>\n                    <span style=\"color: #7f8c8d;\">|</span>\n                    <a href=\"{{ $('Workflow Configuration').item.json.twitterUrl }}\" style=\"display: inline-block; margin: 0 10px; color: #ffffff; text-decoration: none; font-size: 14px;\">Twitter</a>\n                    <span style=\"color: #7f8c8d;\">|</span>\n                    <a href=\"{{ $('Workflow Configuration').item.json.facebookUrl }}\" style=\"display: inline-block; margin: 0 10px; color: #ffffff; text-decoration: none; font-size: 14px;\">Facebook</a>\n                    <span style=\"color: #7f8c8d;\">|</span>\n                    <a href=\"{{ $('Workflow Configuration').item.json.websiteUrl }}\" style=\"display: inline-block; margin: 0 10px; color: #ffffff; text-decoration: none; font-size: 14px;\">Website</a>\n                  </td>\n                </tr>\n              </table>\n              <p style=\"margin: 20px 0 0 0; color: #95a5a6; font-size: 12px;\">© 2024 {{ $('Workflow Configuration').item.json.companyName }}. All rights reserved.</p>\n              <p style=\"margin: 10px 0 0 0; color: #95a5a6; font-size: 12px;\">{{ $('Workflow Configuration').item.json.companyAddress }}</p>\n            </td>\n          </tr>\n          \n        </table>\n      </td>\n    </tr>\n  </table>\n</body>\n</html>",
        "options": {
          "appendAttribution": false
        },
        "subject": "Thank you for your interest!"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "fbb53e8f-6523-424d-8743-785c1c8a0dd9",
      "name": "Create Lead in Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        624,
        1504
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appLEpUNTNRmFiyLf",
          "cachedResultUrl": "https://airtable.com/appLEpUNTNRmFiyLf",
          "cachedResultName": "Lead Base"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblS2zfi7bQRZgE3u",
          "cachedResultUrl": "https://airtable.com/appLEpUNTNRmFiyLf/tblS2zfi7bQRZgE3u",
          "cachedResultName": "Lead Contacts"
        },
        "columns": {
          "value": {
            "Email": "={{ $('On form submission').item.json.Email }}",
            "Notes": "={{ $('On form submission').item.json.Message }}",
            "Phone": "={{ $('On form submission').item.json.Phone }}",
            "Status": "Email Sent - Approved",
            "First Name": "={{ $('On form submission').item.json.Name }}",
            "Email Draft": "={{ $('Generate Email Draft').item.json.output }}",
            "Company Name": "={{ $('On form submission').item.json.Company }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Notes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created On",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created On",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Qualification",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Qualification",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Contacted On",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Contacted On",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Call Summary",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Call Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Interested",
              "type": "boolean",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Interested",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Proposal Sent on",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Proposal Sent on",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Modified",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Last Modified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AI Summary",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "AI Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create",
        "authentication": "airtableOAuth2Api"
      },
      "credentials": {
        "airtableOAuth2Api": {
          "id": "credential-id",
          "name": "airtableOAuth2Api Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c78f331f-1b86-486a-8c16-98883c1dea6d",
      "name": "Update Lead Status (Rejected)",
      "type": "n8n-nodes-base.airtable",
      "position": [
        400,
        1696
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appLEpUNTNRmFiyLf",
          "cachedResultUrl": "https://airtable.com/appLEpUNTNRmFiyLf",
          "cachedResultName": "Lead Base"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblS2zfi7bQRZgE3u",
          "cachedResultUrl": "https://airtable.com/appLEpUNTNRmFiyLf/tblS2zfi7bQRZgE3u",
          "cachedResultName": "Lead Contacts"
        },
        "columns": {
          "value": {
            "Email": "={{ $('On form submission').item.json.Email }}",
            "Notes": "={{ $('On form submission').item.json.Message }}",
            "Phone": "={{ $('On form submission').item.json.Phone }}",
            "Status": "Email Rejected - Needs Review",
            "First Name": "={{ $('On form submission').item.json.Name }}",
            "Email Draft": "={{ $('Generate Email Draft').item.json.output }}",
            "Company Name": "={{ $('On form submission').item.json.Company }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Budget",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Budget",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Notes",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Created On",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Created On",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Qualification",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Qualification",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Contacted On",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Contacted On",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Call Summary",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Call Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Interested",
              "type": "boolean",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Interested",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Proposal Sent on",
              "type": "dateTime",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "Proposal Sent on",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Modified",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "Last Modified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "AI Summary",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": false,
              "required": false,
              "displayName": "AI Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email Draft",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email Draft",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create",
        "authentication": "airtableOAuth2Api"
      },
      "credentials": {
        "airtableOAuth2Api": {
          "id": "credential-id",
          "name": "airtableOAuth2Api Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "f681f075-4ce2-426a-8dc7-32e875efbb1b",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1296,
        1600
      ],
      "webhookId": "bf8c24b5-5f8a-40b9-8658-9d51eb214804",
      "parameters": {
        "options": {},
        "formTitle": "Leads",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email",
              "requiredField": true
            },
            {
              "fieldLabel": "Company",
              "requiredField": true
            },
            {
              "fieldLabel": "Phone",
              "placeholder": "(222)222-2222",
              "requiredField": true
            },
            {
              "fieldLabel": "Message",
              "requiredField": true
            }
          ]
        },
        "formDescription": "We'll reach out to you soon!"
      },
      "typeVersion": 2.3
    },
    {
      "id": "9fe8ee6f-eed6-42c9-a0d6-f4abf82fcf40",
      "name": "Send Approval Request Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -272,
        1600
      ],
      "webhookId": "b90f429f-d6d8-4869-8d66-d4d67975b554",
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto; padding: 20px; background-color: #f5f5f5;\">\n  <div style=\"background-color: white; padding: 30px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1);\">\n    <h2 style=\"color: #333; margin-top: 0;\">New Lead Email Draft - Approval Required</h2>\n    \n    <div style=\"background-color: #f9f9f9; padding: 20px; border-radius: 5px; margin: 20px 0;\">\n      <h3 style=\"color: #555; margin-top: 0;\">Lead Information</h3>\n      <p><strong>Name:</strong> {{ $('On form submission').item.json.Name }}</p>\n      <p><strong>Email:</strong> {{ $('On form submission').item.json.Email }}</p>\n      <p><strong>Company:</strong> {{ $('On form submission').item.json.Company }}</p>\n      <p><strong>Phone:</strong> {{ $('On form submission').item.json.Phone }}</p>\n      <p><strong>Message:</strong> {{ $('On form submission').item.json.Message }}</p>\n    </div>\n    \n    <div style=\"background-color: #fff8e1; padding: 20px; border-radius: 5px; margin: 20px 0; border-left: 4px solid #ffc107;\">\n      <h3 style=\"color: #555; margin-top: 0;\">Generated Email Draft</h3>\n      <div style=\"white-space: pre-wrap; color: #333; line-height: 1.6;\">\n        {{ $('Generate Email Draft').item.json.output }}\n      </div>\n    </div>\n    \n    <div style=\"text-align: center; margin-top: 30px;\">\n      <p style=\"color: #666; margin-bottom: 20px;\">Please review the email draft and choose an action:</p>\n      \n      <a href=\"{{ $resumeWebhookUrl }}?action=approve\" \n         style=\"display: inline-block; padding: 12px 30px; margin: 0 10px; background-color: #4CAF50; color: white; text-decoration: none; border-radius: 5px; font-weight: bold;\">\n        ✓ Approve & Send\n      </a>\n      \n      <a href=\"{{ $resumeWebhookUrl }}?action=reject\" \n         style=\"display: inline-block; padding: 12px 30px; margin: 0 10px; background-color: #f44336; color: white; text-decoration: none; border-radius: 5px; font-weight: bold;\">\n        ✗ Reject\n      </a>\n    </div>\n  </div>\n</div>",
        "options": {
          "appendAttribution": false
        },
        "subject": "New Lead Email Draft - Approval Required"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "2157463a-b563-40b2-a2ad-f9f378421d51",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2192,
        704
      ],
      "parameters": {
        "width": 656,
        "height": 432,
        "content": "### 📌 Purpose  \nAutomatically process new leads from an n8n Form, generate an AI-written follow-up email, request approval from your sales team, and then send the approved email to the lead while logging everything into Airtable.\n\nThis workflow is ideal for:\n- Small teams that want AI to draft emails, but still keep a human review step  \n- Businesses that receive inbound inquiries and need fast, consistent follow-ups  \n- Anyone who wants an automated lead-intake → email → CRM update pipeline  \n- Teams that want to save approved/rejected drafts for future reference\n\nWhy this is helpful:\n- AI handles the writing, saving your team time  \n- Sales still decides what actually gets sent  \n- Airtable automatically stores every lead + email draft + status  \n- Everything runs from a simple form submission → no manual copying or rewriting\n\nWhy download this template:\nIt gives you a polished lead-response system with human approval, CRM logging, and automated Gmail sending — all without needing a full CRM or sales tool.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c2ce48eb-13f3-4b2e-b026-0eef2e57d14c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2192,
        1136
      ],
      "parameters": {
        "width": 656,
        "height": 416,
        "content": "### 🔧 Setup Instructions  \n1. **Connect credentials:** Gmail, Airtable, OpenAI.  \n2. **Configure Airtable Table** with the following fields:  \n   - Name  \n   - Email  \n   - Phone  \n   - Company Name  \n   - Message  \n   - Status  \n   - Email Draft  \n   - Created On  \n3. **Add Airtable Base & Table IDs** in the configuration node.  \n4. **Add company details** (your name, title, email, phone, website, etc.) so the final email is branded correctly.  \n5. **Set the sales approval email address** (where the draft should be sent for review).  \n6. Enable the **Webhooks** node used for the approval link.  \n7. Publish your n8n Form and test by submitting a new lead.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3ae04115-2e42-4875-9165-0901a7cb1c75",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        704
      ],
      "parameters": {
        "color": 3,
        "width": 720,
        "height": 336,
        "content": "### 🛠️ Troubleshooting  \n- **Approval link not working?**  \n  Make sure the Webhook node is set to “Production URL” and not “Test URL.”\n\n- **Emails not sending?**  \n  Verify Gmail credentials and that the “From” address is allowed by Google.\n\n- **Airtable fields not updating?**  \n  Check Base ID, Table ID, and field names match exactly.\n\n- **Draft missing lead details?**  \n  Ensure the Form field names match those referenced in the AI prompt.\n\n- **Stuck waiting for approval?**  \n  Confirm the approval webhook is receiving a request when clicked.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7d1343bb-fed5-414d-9421-4e36c178cbe2",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        1440
      ],
      "parameters": {
        "color": 7,
        "width": 688,
        "height": 400,
        "content": "### 📝 Lead Intake & Preparation  \nThis section receives a new lead from an n8n Form and prepares the information for AI processing.\n\nWhy:  \nWe normalize all form fields early so the AI model always receives clean, predictable data — making email generation more accurate and consistent.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b9eded9e-7f4e-4e8e-ac7e-29301622bac3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        1440
      ],
      "parameters": {
        "color": 7,
        "width": 992,
        "height": 512,
        "content": "### 🤖 Draft Generation & Human Approval  \nAI writes the initial draft, then the workflow emails it to your sales team for review and approval via a secure link.\n\nWhy:  \nThis blends automation with human judgment — speeding up response time while maintaining quality control.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5c84ef79-c18d-4143-88b2-e74b541855e4",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        1328
      ],
      "parameters": {
        "color": 7,
        "width": 544,
        "height": 544,
        "content": "### 📊 Log Lead in Airtable & Send Final Email  \nDepending on approval, this section sends the email to the lead and logs the result in Airtable.\n\nWhy:  \nYour CRM stays clean and accurate — each lead gets a clear status, timestamp, and saved email draft for reference.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "Extract Lead Data": [
      {
        "json": {
          "Name": "Calvin Cunningham",
          "Email": "calvinc4@me.com",
          "Phone": "6189789126",
          "Company": "Manna AI",
          "Message": "Need help with systems",
          "formMode": "test",
          "leadName": null,
          "leadEmail": null,
          "leadPhone": null,
          "senderName": "<__PLACEHOLDER_VALUE__Your Name__>",
          "twitterUrl": "<__PLACEHOLDER_VALUE__Twitter URL__>",
          "websiteUrl": "<__PLACEHOLDER_VALUE__Website URL__>",
          "companyName": "<__PLACEHOLDER_VALUE__Your Company Name__>",
          "facebookUrl": "<__PLACEHOLDER_VALUE__Facebook URL__>",
          "leadCompany": null,
          "leadMessage": null,
          "linkedinUrl": "<__PLACEHOLDER_VALUE__LinkedIn URL__>",
          "senderTitle": "<__PLACEHOLDER_VALUE__Your Title__>",
          "submittedAt": "2025-11-20T13:31:48.828-06:00",
          "companyEmail": "<__PLACEHOLDER_VALUE__Company Email__>",
          "companyPhone": "<__PLACEHOLDER_VALUE__Company Phone__>",
          "slackChannel": "<__PLACEHOLDER_VALUE__Slack channel ID for sales team__>",
          "airtableBaseId": "<__PLACEHOLDER_VALUE__Airtable base ID__>",
          "companyAddress": "<__PLACEHOLDER_VALUE__Company Address__>",
          "airtableTableId": "<__PLACEHOLDER_VALUE__Airtable table ID__>"
        }
      }
    ],
    "On form submission": [
      {
        "json": {
          "Name": "Calvin Cunningham",
          "Email": "calvinc4@me.com",
          "Phone": "6189789126",
          "Company": "Manna AI",
          "Message": "Need help with systems",
          "formMode": "test",
          "submittedAt": "2025-11-20T13:31:48.828-06:00"
        }
      }
    ],
    "Generate Email Draft": [
      {
        "json": {
          "output": "Hi Calvin,\n\nThank you for reaching out and showing interest in our services! I understand you’re looking for help with systems, and I’d love to learn more about your specific needs at Manna AI so we can provide the best possible support.\n\nOur team specializes in streamlining and optimizing systems to enhance efficiency and performance, and we’re confident we can help you find the right solutions tailored to your business.\n\nPlease let me know a convenient time for you to chat further or feel free to share more details about the challenges you’re facing. I’m here to assist and ensure you get the support you need.\n\nLooking forward to connecting soon!\n\nBest regards,  \n[Your Name]  \n[Your Position]  \n[Your Contact Information]"
        }
      }
    ],
    "Workflow Configuration": [
      {
        "json": {
          "Name": "Calvin Cunningham",
          "Email": "calvinc4@me.com",
          "Phone": "6189789126",
          "Company": "Manna AI",
          "Message": "Need help with systems",
          "formMode": "test",
          "senderName": "<__PLACEHOLDER_VALUE__Your Name__>",
          "twitterUrl": "<__PLACEHOLDER_VALUE__Twitter URL__>",
          "websiteUrl": "<__PLACEHOLDER_VALUE__Website URL__>",
          "companyName": "<__PLACEHOLDER_VALUE__Your Company Name__>",
          "facebookUrl": "<__PLACEHOLDER_VALUE__Facebook URL__>",
          "linkedinUrl": "<__PLACEHOLDER_VALUE__LinkedIn URL__>",
          "senderTitle": "<__PLACEHOLDER_VALUE__Your Title__>",
          "submittedAt": "2025-11-20T13:31:48.828-06:00",
          "companyEmail": "<__PLACEHOLDER_VALUE__Company Email__>",
          "companyPhone": "<__PLACEHOLDER_VALUE__Company Phone__>",
          "slackChannel": "<__PLACEHOLDER_VALUE__Slack channel ID for sales team__>",
          "airtableBaseId": "<__PLACEHOLDER_VALUE__Airtable base ID__>",
          "companyAddress": "<__PLACEHOLDER_VALUE__Company Address__>",
          "airtableTableId": "<__PLACEHOLDER_VALUE__Airtable table ID__>"
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "66c9e319-0983-4d08-94db-be79c3947e5d",
  "connections": {
    "Extract Lead Data": {
      "main": [
        [
          {
            "node": "Generate Email Draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Email Draft",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Approval": {
      "main": [
        [
          {
            "node": "Check Approval Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email to Lead": {
      "main": [
        [
          {
            "node": "Create Lead in Airtable",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Email Draft": {
      "main": [
        [
          {
            "node": "Send Approval Request Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Approval Status": {
      "main": [
        [
          {
            "node": "Send Email to Lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Lead Status (Rejected)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Extract Lead Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Approval Request Email": {
      "main": [
        [
          {
            "node": "Wait for Approval",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}