{
  "name": "Speed to Lead",
  "nodes": [
    {
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -576,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "What do you want us to help?",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Full Name"
            },
            {
              "fieldType": "email",
              "fieldLabel": "Email"
            },
            {
              "fieldType": "number",
              "fieldLabel": "Phone Number"
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Budget",
              "fieldOptions": {
                "values": [
                  {
                    "option": "$1,000 \u2013 $5,000"
                  },
                  {
                    "option": "$5,000 \u2013 $10,000"
                  }
                ]
              }
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "Timeline",
              "fieldOptions": {
                "values": [
                  {
                    "option": "ASAP / This week"
                  },
                  {
                    "option": "Within a month"
                  },
                  {
                    "option": "In 2\u20133 months"
                  },
                  {
                    "option": "Just exploring"
                  }
                ]
              }
            },
            {
              "fieldLabel": "Service Needed"
            }
          ]
        },
        "formDescription": "We'll be in touch ASAP"
      },
      "typeVersion": 2.5
    },
    {
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -368,
        0
      ],
      "parameters": {
        "text": "You are a lead qualification assistant. Analyze the lead data and return ONLY one word: HOT, WARM, or COLD.\n\nRules:\n- HOT: Budget is $5,000 or above AND timeline is ASAP or this week. High motivation.\n- WARM: Budget is $1,000\u2013$5,000 OR timeline is within a month. Interested but not urgent.\n- COLD: Budget under $1,000 OR just exploring OR vague answers.\n\nReturn ONLY the single word. No explanation. No punctuation.",
        "options": {
          "systemMessage": "=Name: {{ $json[\"Full Name\"] }}\nEmail: {{ $json[\"Email\"] }}\nBudget: {{ $json[\"Budget\"] }}\nTimeline: {{ $json[\"Timeline\"] }}\nService: {{ $json[\"Service Needed\"] }}\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -416,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "typeVersion": 1.3
    },
    {
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        112,
        -16
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "HOT",
                    "rightValue": "={{$json.output.score}}"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "WARM",
                    "rightValue": "={{$json.output.score}}"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "COLD",
                    "rightValue": "={{$json.output.score}}"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "name": "Send a message",
      "type": "n8n-nodes-base.slack",
      "position": [
        368,
        -192
      ],
      "parameters": {
        "text": "=\ud83d\udd25 HOT LEAD \u2014 Call NOW\n\nName: {{ $json.Name }}\nEmail: {{ $json.Email }}\nPhone: {{ $json.Phone }}\nBudget: {{ $json.budget }}\nTimeline: {{ $json.reason }}\nService: {{ $json['Service needed'] }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "<SLACK_CHANNEL_ID>",
          "cachedResultName": "channel-placeholder"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.4
    },
    {
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -208,
        176
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"score\": \"HOT | WARM | COLD\",\n  \"reason\": \"short explanation\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        -64,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "Score",
              "type": "string",
              "value": "={{ $json.output.score }}"
            },
            {
              "name": "reason",
              "type": "string",
              "value": "={{ $json.output.reason }}"
            },
            {
              "name": "Name",
              "type": "string",
              "value": "={{ $('On form submission').item.json['Full Name'] }}"
            },
            {
              "name": "Email",
              "type": "string",
              "value": "={{ $('On form submission').item.json.Email }}"
            },
            {
              "name": "Phone",
              "type": "number",
              "value": "={{ $('On form submission').item.json['Phone Number'] }}"
            },
            {
              "name": "budget",
              "type": "string",
              "value": "={{ $('On form submission').item.json.Budget }}"
            },
            {
              "name": "Service needed",
              "type": "string",
              "value": "={{ $('On form submission').item.json['Service Needed'] }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        368,
        0
      ],
      "parameters": {
        "sendTo": "<YOUR_TEAM_EMAIL>",
        "message": "=Hi {{ $('On form submission').item.json['Full Name'] }},\n\nThank you for reaching out! We've received your inquiry about {{ $('On form submission').item.json['Service Needed'] }}.\n\nOne of our team members will be in touch with you within 24 hours.\n\nBest regards,\n[Your Name / Company]",
        "options": {},
        "subject": "We received your inquiry",
        "emailType": "text"
      },
      "typeVersion": 2.2
    },
    {
      "name": "Send a message2",
      "type": "n8n-nodes-base.gmail",
      "position": [
        368,
        208
      ],
      "parameters": {
        "sendTo": "={{ $json.Email }}",
        "message": "=Hi {{ $('On form submission').item.json['Full Name'] }},  \n\nThanks for reaching out! We'd love to learn more about what you're looking for.  \n\nWhen you're ready to take the next step, feel free to reply to this email or book a free call with us.  \n\nBest regards, \nRaejan | CoreFlow",
        "options": {},
        "subject": "Thanks for your interest!",
        "emailType": "text"
      },
      "typeVersion": 2.2
    },
    {
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -240
      ],
      "parameters": {
        "width": 496,
        "height": 752,
        "content": "Try it out!\n\nThis n8n workflow automates a speed-to-lead system, capturing form submissions and quickly routing qualified leads to tools like Trello and Gmail for fast follow-up.\n\n\nHow it works:\n\nTriggers on form submission, feeding data into an AI Agent powered by an OpenAI Chat Model with chat memory.\n\nThe AI processes leads via a structured output parser, then a switch (rules mode) decides actions like editing fields or sending messages.\n\nOutputs route to Trello (task creation), Gmail (notifications/emails), and possibly other apps for lead nurturing.\n\nHow to use:\n\nImport the workflow into your n8n instance and connect credentials for OpenAI, Trello, Gmail, and your form tool (e.g., Google Forms).\n\nTest by submitting a form; monitor the AI agent for lead qualification and verify outputs in Trello/Gmail.\n\nActivate the workflow to run live, ensuring webhooks or triggers are set for production forms.\n\nRequirements:\n\nn8n account (self-hosted or cloud); API keys for OpenAI, Trello, Gmail OAuth2.\n\nForm tool integration (e.g., Google Forms webhook).\n\nFor verified creator status: Submit 2-3 approved public workflows via n8n Creator Portal, including this one, to gain the badge and directory listing\n\n"
      },
      "typeVersion": 1
    },
    {
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -400
      ],
      "parameters": {
        "width": 336,
        "height": 368,
        "content": "Use the PROMPT:\n\nYou are a lead qualification assistant. Analyze the lead data and return ONLY one word: HOT, WARM, or COLD.\n\nRules:\n- HOT: Budget is $5,000 or above AND timeline is ASAP or this week. High motivation.\n- WARM: Budget is $1,000\u2013$5,000 OR timeline is within a month. Interested but not urgent.\n- COLD: Budget under $1,000 OR just exploring OR vague answers.\n\nReturn ONLY the single word. No explanation. No punctuation."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "connections": {
    "Switch": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send a message2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}