AutomationFlowsMarketing & Ads › Lead Status Update Based on Email Response

Lead Status Update Based on Email Response

Lead Status Update Based on Email Response. Uses emailReadImap, httpRequest. Manual trigger; 12 nodes.

Manual trigger★★★★☆ complexity12 nodesEmail Read ImapHTTP Request
Marketing & Ads Trigger: Manual Nodes: 12 Complexity: ★★★★☆ Added:

This workflow follows the Emailreadimap → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Lead Status Update Based on Email Response",
  "nodes": [
    {
      "parameters": {
        "authentication": "predefinedCredentialType",
        "mailbox": "INBOX",
        "options": {
          "onlyUnread": true,
          "download": true
        }
      },
      "name": "IMAP Email",
      "type": "n8n-nodes-base.emailReadImap",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json[\"subject\"].toLowerCase().includes(\"re:\") }}",
              "operation": "contains",
              "value2": true
            }
          ]
        }
      },
      "name": "Is Reply?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Extract email address from the From field\nconst fromEmail = $input.item.from.toLowerCase();\nconst emailRegex = /[\\w.-]+@[\\w.-]+\\.[\\w.-]+/;\nconst match = fromEmail.match(emailRegex);\n\nif (match) {\n  const email = match[0];\n  $input.item.extractedEmail = email;\n  return $input.item;\n} else {\n  $input.item.extractedEmail = null;\n  return $input.item;\n}"
      },
      "name": "Extract Email",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        200
      ]
    },
    {
      "parameters": {
        "authentication": "headerAuth",
        "requestMethod": "GET",
        "url": "=https://your-crm-api.com/api/leads?search={{ $json.extractedEmail }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "={{ $env.CRM_API_KEY }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Find Lead in CRM",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        850,
        200
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.length }}",
              "operation": ">",
              "value2": 0
            }
          ]
        }
      },
      "name": "Lead Found?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1050,
        200
      ]
    },
    {
      "parameters": {
        "functionCode": "// Get the first lead from the array\nreturn $input.item[0];"
      },
      "name": "Get Lead",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        1250,
        100
      ]
    },
    {
      "parameters": {
        "authentication": "headerAuth",
        "requestMethod": "PUT",
        "url": "=https://your-crm-api.com/api/leads/{{ $json.id }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "={{ $env.CRM_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n  \"status\": \"engaged\"\n}"
      },
      "name": "Update Lead Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1450,
        100
      ]
    },
    {
      "parameters": {
        "authentication": "headerAuth",
        "requestMethod": "POST",
        "url": "=https://your-crm-api.com/api/activities",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "={{ $env.CRM_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n  \"lead_id\": {{ $json.id }},\n  \"activity_type\": \"email\",\n  \"title\": \"Email reply received\",\n  \"description\": \"Lead replied to our outreach email. Subject: {{ $node[\"IMAP Email\"].json[\"subject\"] }}\",\n  \"completed_at\": \"{{ $now.toISOString() }}\"\n}"
      },
      "name": "Log Email Activity",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1650,
        100
      ]
    },
    {
      "parameters": {
        "authentication": "headerAuth",
        "requestMethod": "POST",
        "url": "=https://your-crm-api.com/api/activities",
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "={{ $env.CRM_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "jsonParameters": true,
        "options": {},
        "bodyParametersJson": "={\n  \"lead_id\": {{ $json.id }},\n  \"activity_type\": \"call\",\n  \"title\": \"Follow-up call\",\n  \"description\": \"Schedule a follow-up call to discuss next steps\",\n  \"scheduled_at\": \"{{ $today.plus(1, 'days').toISOString() }}\"\n}"
      },
      "name": "Schedule Follow-up Call",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1850,
        100
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "message",
              "value": "=No lead found with email: {{ $json.extractedEmail }}"
            }
          ]
        },
        "options": {}
      },
      "name": "No Lead Found",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": false,
        "queryParameters": {},
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "text",
              "value": "=New email reply from unknown contact: {{ $json.extractedEmail }}. Subject: {{ $node[\"IMAP Email\"].json[\"subject\"] }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Send Notification",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 3,
      "position": [
        1450,
        300
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "message",
              "value": "=Not a reply email: {{ $json[\"subject\"] }}"
            }
          ]
        },
        "options": {}
      },
      "name": "Not a Reply",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        650,
        400
      ]
    }
  ],
  "connections": {
    "IMAP Email": {
      "main": [
        [
          {
            "node": "Is Reply?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Reply?": {
      "main": [
        [
          {
            "node": "Extract Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not a Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Email": {
      "main": [
        [
          {
            "node": "Find Lead in CRM",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Lead in CRM": {
      "main": [
        [
          {
            "node": "Lead Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead Found?": {
      "main": [
        [
          {
            "node": "Get Lead",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Lead Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Lead": {
      "main": [
        [
          {
            "node": "Update Lead Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Lead Status": {
      "main": [
        [
          {
            "node": "Log Email Activity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Email Activity": {
      "main": [
        [
          {
            "node": "Schedule Follow-up Call",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Lead Found": {
      "main": [
        [
          {
            "node": "Send Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "8b4e6a2f-7a5d-4e6d-b1a2-c3d4e5f6a7b9",
  "id": "124",
  "tags": [
    {
      "name": "CRM"
    },
    {
      "name": "Lead Management"
    },
    {
      "name": "Email"
    }
  ]
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Lead Status Update Based on Email Response. Uses emailReadImap, httpRequest. Manual trigger; 12 nodes.

Source: https://github.com/MainfactAI/CRM/blob/a5ab06985f98ceb28ff91ddead4889bfe791d499/examples/n8n/lead_status_update_workflow.json — original creator credit. Request a take-down →

More Marketing & Ads workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Marketing & Ads

Lead Gen -> Outreach -> Reply Digest. Uses googleSheets, httpRequest, emailSend, emailReadImap. Event-driven trigger; 36 nodes.

Google Sheets, HTTP Request, Email Send +1
Marketing & Ads

Django CRM - Enviar Comunicaciones de Campaña. Uses start, httpRequest, emailSend, twilio. Manual trigger; 17 nodes.

Start, HTTP Request, Email Send +1
Marketing & Ads

Lead Search Scoring Engine. Uses httpRequest. Manual trigger; 3 nodes.

HTTP Request
Marketing & Ads

AI Lead Auto-Responder. Uses gmail, httpRequest. Manual trigger; 7 nodes.

Gmail, HTTP Request
Marketing & Ads

Smartlead Campaign Pull. Uses n8n-nodes-smartlead, httpRequest. Manual trigger; 3 nodes.

N8N Nodes Smartlead, HTTP Request