{
  "id": "3eW3wF9n85GCnkx2",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Follow up Email Tracker",
  "tags": [
    {
      "id": "8ulFDfMlcOKqevTT",
      "name": "B2B marketing",
      "createdAt": "2025-10-08T08:51:11.271Z",
      "updatedAt": "2025-10-08T08:51:11.271Z"
    },
    {
      "id": "VKCvL0SyGclKbiYG",
      "name": "Course",
      "createdAt": "2025-10-08T08:51:15.748Z",
      "updatedAt": "2025-10-08T08:51:15.748Z"
    }
  ],
  "nodes": [
    {
      "id": "8668c1b5-0c2c-4b48-bf85-1ca03158d9b4",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -464,
        -48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "2f9cecd1-16cc-45a2-a8c9-7ba274633b2d",
      "name": "Get many messages",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -256,
        -48
      ],
      "parameters": {
        "limit": 10,
        "simple": false,
        "filters": {
          "q": "subject: <template of your introductory email>",
          "labelIds": [
            "CATEGORY_PERSONAL"
          ]
        },
        "options": {},
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7e059416-b501-4125-b951-0029c2c06e9c",
      "name": "Update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -48,
        -48
      ],
      "parameters": {
        "columns": {
          "value": {
            "Email ID": "={{ $json.headers.from.match(/<([^>]+)>/) ? $json.headers.from.match(/<([^>]+)>/)[1] : '' }}",
            "Reminder 1 needed?": "No"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Information",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Information",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Designation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Designation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Intro email Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Intro email Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 1 needed?",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 1 needed?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 1 Email Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 1 Email Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 2 needed? ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 2 needed? ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 2 Email Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 2 Email Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ/edit#gid=0",
          "cachedResultName": "Form Filled"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ/edit?usp=drivesdk",
          "cachedResultName": "Course 2 - S4Lec1-Lead generation and nurturing"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "07ba7bb9-1f81-49c2-bfad-78ddb7f5ad59",
      "name": "Get row(s) in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        -48
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Reminder 1 needed?"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ/edit#gid=0",
          "cachedResultName": "Form Filled"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ/edit?usp=drivesdk",
          "cachedResultName": "Course 2 - S4Lec1-Lead generation and nurturing"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5166bf33-d099-4e6b-b81e-93747eddd293",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        368,
        -48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "404d1305-33b7-413e-a3d7-e80137aaedcd",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ DateTime.fromFormat($json[\"Intro email Date\"], \"dd/MM/yyyy\").toMillis() }}",
              "rightValue": "={{ DateTime.now().minus({ days: 5 }).toMillis() }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "3e7f9b29-db24-494d-b263-a7aac9baca07",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        576,
        -144
      ],
      "parameters": {
        "text": "=You are helpful B2B marketing assistant writing a reminder email to your previous introductory email to specific clients. These clients have filled a form related to a specific query about your company.\nYour company - BuildmyAiflow.agency\nClientEmail -  {{ $json['Email ID'] }}\nClientMessage - {{ $json.Message }}\nIntroductory email sent on - {{ $json['Intro email Date'] }}\nClientCompany - {{ $json['Company Name'] }}\nClient First name - {{ $json['First Name'] }} \nClient last name - {{ $json['Last Name'] }}\n\nWrite a short first reminder email requesting a simple follow up on the [message] they wrote to your company.\nThis email would be replied on the original introductory email, so no new subject should be written.\n\nKeep it casual and friendly.\n\nFollow the below structure\n----------------\nHi [ First name]\n\n[Reminder about the last email sent on day (monday, tue etc) Dont mention exact date] about [ pain point highlighted in message]\n\n[Highlight that it is a common issue that your company is already working for with other similar clients]\n\n[CTA - We can do a quick chat for 15 mins when client is available]\n\n\n---------------------\n\nOutput should be in below format.\n\nClientEmail\": \"Email id\"\nClientEmailBody\":\"Email body\"\n\n",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "7e332385-9ab9-4c6a-851b-a9205fed9bd7",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        576,
        64
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "e103253a-ca6e-42f5-9426-cff9d199812f",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequestTool",
      "position": [
        768,
        64
      ],
      "parameters": {
        "url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "6ccd3da9-b3c2-47d3-b328-ad6d06deeb8f",
      "name": "Get many messages1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1136,
        -144
      ],
      "parameters": {
        "filters": {
          "q": "=to: {{ $json.ClientEmail }} subject: Following up your interest",
          "labelIds": [
            "SENT"
          ]
        },
        "operation": "getAll"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "590b0e23-0cc9-4e5e-bbe8-196b5fcf94f1",
      "name": "Reply to a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1344,
        -144
      ],
      "parameters": {
        "message": "={{ $('Edit Fields').item.json.ClientEmailBody }}",
        "options": {
          "senderName": "< your sales team name>",
          "replyToSenderOnly": false
        },
        "resource": "thread",
        "threadId": "={{ $json.threadId }}",
        "messageId": "={{ $json.id }}",
        "operation": "reply"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "ac6c4fd7-d214-4875-bae5-2298527d841a",
      "name": "Update row in sheet1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1552,
        -144
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Reminder 1 Drafted",
            "Email ID": "={{ $('Get many messages1').item.json.To }}",
            "First Name": "=",
            "Reminder 1 needed?": "Yes",
            "Reminder 1 Email Date": "={{ $now.format('dd-MMM-yyyy') }}"
          },
          "schema": [
            {
              "id": "First Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "First Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Last Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Last Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Email ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company Information",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company Information",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Designation",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Designation",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Message",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Intro email Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Intro email Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 1 needed?",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 1 needed?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 1 Email Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 1 Email Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 2 needed? ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 2 needed? ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Reminder 2 Email Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Reminder 2 Email Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Email ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ/edit#gid=0",
          "cachedResultName": "Form Filled"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZG7J29NF134RxUKbTTmTi3A0uBD0gIi7qccrr3sdHWQ/edit?usp=drivesdk",
          "cachedResultName": "Course 2 - S4Lec1-Lead generation and nurturing"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "0db790fb-7514-4f16-a1cd-b82f2cb6757b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        -256
      ],
      "parameters": {
        "width": 640,
        "height": 448,
        "content": "## Check if a client replied\n**Exclude leads that have already replied to your email** \nUpdate the status in your tracker\n\nUpdate the search term for subjection of original email sent."
      },
      "typeVersion": 1
    },
    {
      "id": "cb621586-2395-48f6-845e-bd7ec65fc2a7",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        128,
        -256
      ],
      "parameters": {
        "color": 4,
        "width": 928,
        "height": 448,
        "content": "## Identify who to send reminder to\nIf client did not responds in **5 days**, we should send reminder. \nEmails are personalized based on original query message and company details."
      },
      "typeVersion": 1
    },
    {
      "id": "51207e43-55f3-483a-b209-5226dcff430e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -256
      ],
      "parameters": {
        "color": 6,
        "width": 688,
        "height": 448,
        "content": "## Send reminder on introductory email thread\nFind the original introductory email in sent items. Reply on that with new email body. Update the sheet with when the reminder was sent."
      },
      "typeVersion": 1
    },
    {
      "id": "0c367183-5e09-4828-a7f2-5887bb7c8442",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -160,
        -160
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "6d921fbc-dd0d-4c5e-814f-39961d0d7474",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        896,
        48
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"ClientEmail\": \"email id\",\n\t\"ClientEmailBody\": \"Content of email id\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "d6930e19-5e27-47e8-acf1-406cca5ff721",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        928,
        -144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "43407e7b-62b8-4665-b7b7-2cfabcec3773",
              "name": "ClientEmail",
              "type": "string",
              "value": "={{ $json.output.ClientEmail }}"
            },
            {
              "id": "163f0f02-9eed-4a5f-b863-197db469c9c1",
              "name": "ClientEmailBody",
              "type": "string",
              "value": "={{ $json.output.ClientEmailBody }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f7c2642c-4dfe-4072-ae5a-955cfc09f748",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -672
      ],
      "parameters": {
        "width": 624,
        "height": 400,
        "content": "## Main Sticky\n**How it works** \nThe flow captures to see if you clients have replied to your introductory email. This is identified by a specific search query in your inbox. (customize that for yourself)\nIf no reply than after 5 days of no reply, it writes a personalized reminder email to the same person.\n\nYou can use this with my other flow of writing introductory emails to new leads\n\n**How to setup** \n1- Identify the email id through which introductory email was sent. Update that in first part.\n2- Use the sheet shared to track the original query raised by clients. Agent will use that to write reminder.\n3- Feel free to customize the prompt of agent.\n4- Need to setup Google sheet and email access"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "241b300d-a909-49be-ac9c-a58f71a6273b",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Get many messages1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages": {
      "main": [
        [
          {
            "node": "Update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many messages1": {
      "main": [
        [
          {
            "node": "Reply to a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply to a message": {
      "main": [
        [
          {
            "node": "Update row in sheet1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update row in sheet": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get many messages",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}