Automate Your Property Email Leads with n8n
In this tutorial, we’ll walk you through how to set up an automated workflow that watches your email for new property-related messages and determines whether they are leads for property purchases or sales. Based on this, it will draft appropriate responses and log them for further action.
Prerequisites
- An n8n account: Sign up here
- A Gmail account for watching emails
- An OpenAI account for accessing GPT
Step 1: Create a New Workflow in n8n
- Start a New Workflow: First, log in to your n8n instance and start a new workflow.
Step 2: Add a Gmail Trigger Node
- Gmail Trigger Node: Drag and drop the Gmail Trigger to start watching your inbox for new emails.
- Poll time: Set it to poll every minute.
- Filter: We’ll exclude emails sent by ourselves with the filter
-from:me
.
Step 3: Send the Email Content to GPT-4o
- OpenAI Chat Node (Assess if a message is a property purchase or sale lead):
- Model: Select GPT-4o.
- Prompt: Formulate the prompt to ask GPT-4o to categorize the email.
{
"prompt": "Subject: {{ $('Gmail Trigger').item.json.subject }}\nMessage:\n{{ $('Gmail Trigger').item.json.textAsHtml }}\nYour task is to assess if the message is a lead for a property purchase or property sale. Reply in JSON format with two boolean variables, propSaleLead and propPurchaseLead."
}
Step 4: Parse GPT-4o's Response
- JSON Parser Node:
- JSON Schema: Define the schema for parsing with two boolean values,
propSaleLead
andpropPurchaseLead
.
- JSON Schema: Define the schema for parsing with two boolean values,
{
"type": "object",
"properties": {
"propSaleLead": { "type": "boolean" },
"propPurchaseLead": { "type": "boolean" }
},
"required": ["propSaleLead", "propPurchaseLead"]
}
Step 5: Add Conditional Nodes
- Conditional Nodes:
- If prop Sale Lead: Check if
propSaleLead
is true. - If prop Purchase Lead: Check if
propPurchaseLead
is true.
- If prop Sale Lead: Check if
Step 6: Draft Responses Using GPT-4o
- OpenAI Chat Node (for drafting responses):
- Model: Use GPT-4o.
- Prompt for Sale Lead: Formulate a response template for property sale leads.
- Prompt for Purchase Lead: Formulate a response template for property purchase leads.
Step 7: Email the Responses
- Email Response Nodes:
- Draft a Response for Property Sale: Use the Gmail node to draft a response to the sender.
- Draft a Response for Property Purchase: Use the Gmail node to draft a response and notify the property team.
- Message Property Team: Send a summary email to your properties team if it’s a purchase lead.
Step 8: Log Leads
- Sticky Note: For your organization to log and manage the information in your CRM, like Salesforce.
Final Workflow Snapshot
Your n8n workflow should look something like this:
Wrapping Up
Congratulations! You’ve now set up an automated workflow to manage and categorize property-related emails using n8n and GPT-4. This workflow helps in saving time and ensures prompt responses to potential leads.
For more information on automating your business processes, you can visit n8n.
Have questions or need help setting up advanced workflows? Feel free to email us or hire us via Upwork.
Happy automating! 🚀