feat: add folder support for workflows (fixes #70)

This commit is contained in:
Praveen Mudalgeri
2025-08-05 09:40:47 +05:30
parent 307d530f9b
commit c4885eee92
2057 changed files with 985290 additions and 974268 deletions

View File

@@ -0,0 +1,397 @@
{
"meta": {
"instanceId": "f0a68da631efd4ed052a324b63ff90f7a844426af0398a68338f44245d1dd9e5"
},
"nodes": [
{
"id": "44b2e0ac-1ec9-4acd-bf00-7e280378b8df",
"name": "Lemlist - Unsubscribe",
"type": "n8n-nodes-base.lemlist",
"position": [
1300,
-180
],
"parameters": {
"email": "={{ $json[\"leadEmail\"] }}",
"resource": "lead",
"operation": "unsubscribe",
"campaignId": "={{$json[\"campaignId\"]}}"
},
"credentials": {
"lemlistApi": {
"id": "45",
"name": "Lemlist - \"lemlist\" team API key"
}
},
"typeVersion": 1
},
{
"id": "75dd6db8-5e59-4521-a4be-2272e2914494",
"name": "follow up task",
"type": "n8n-nodes-base.hubspot",
"position": [
1520,
640
],
"parameters": {
"type": "task",
"metadata": {
"subject": "=OOO - Follow up with {{ $json[\"properties\"][\"firstname\"][\"value\"] }} {{ $json[\"properties\"][\"lastname\"][\"value\"] }}"
},
"resource": "engagement",
"authentication": "oAuth2",
"additionalFields": {
"associations": {
"contactIds": "={{ $json[\"vid\"] }}"
}
}
},
"credentials": {
"hubspotOAuth2Api": {
"id": "14",
"name": "Hubspot account"
}
},
"typeVersion": 1
},
{
"id": "0ba95d5d-fe73-4687-8e21-02b97b19924f",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
380,
300
],
"parameters": {
"rules": {
"rules": [
{
"value2": "Unsubscribe"
},
{
"output": 1,
"value2": "Interested"
},
{
"output": 2,
"value2": "Out of Office"
}
]
},
"value1": "={{ $json[\"text\"].trim() }}",
"dataType": "string",
"fallbackOutput": 3
},
"typeVersion": 1
},
{
"id": "abdb4925-4b2a-48e0-aa3d-042e1112150a",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
140,
300
],
"parameters": {
"mode": "combine",
"options": {
"clashHandling": {
"values": {
"resolveClash": "preferInput1"
}
}
},
"combinationMode": "mergeByPosition"
},
"typeVersion": 2
},
{
"id": "b911bd29-9141-43ac-87d4-3922be5cbe5c",
"name": "lemlist - Mark as interested",
"type": "n8n-nodes-base.httpRequest",
"position": [
1300,
160
],
"parameters": {
"url": "=https://api.lemlist.com/api/campaigns/YOUR_CAMPAIGN_ID/leads/{{$json[\"leadEmail\"]}}/interested",
"options": {},
"requestMethod": "POST",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "lemlistApi"
},
"credentials": {
"lemlistApi": {
"id": "45",
"name": "Lemlist - \"lemlist\" team API key"
}
},
"typeVersion": 2
},
{
"id": "510adb64-fb3a-4d56-abf3-ab9cc0d3e683",
"name": "HubSpot - Create Deal",
"type": "n8n-nodes-base.hubspot",
"position": [
1520,
380
],
"parameters": {
"stage": "79009480",
"authentication": "oAuth2",
"additionalFields": {
"dealName": "=New Deal with {{ $json[\"identity-profiles\"][0][\"identities\"][0][\"value\"] }}",
"associatedVids": "={{$json[\"canonical-vid\"]}}"
}
},
"credentials": {
"hubspotOAuth2Api": {
"id": "14",
"name": "Hubspot account"
}
},
"typeVersion": 1
},
{
"id": "635e40a2-0546-4c3e-8080-26d72fc5ea35",
"name": "HubSpot - Get contact ID",
"type": "n8n-nodes-base.hubspot",
"position": [
1300,
380
],
"parameters": {
"email": "={{ $json[\"leadEmail\"] }}",
"resource": "contact",
"authentication": "oAuth2",
"additionalFields": {
"lastName": "={{ $json[\"leadLastName\"] }}",
"firstName": "={{ $json[\"leadFirstName\"] }}"
}
},
"credentials": {
"hubspotOAuth2Api": {
"id": "14",
"name": "Hubspot account"
}
},
"typeVersion": 1
},
{
"id": "a072f9bb-09ca-4edb-b4ae-76c768be681f",
"name": "Slack",
"type": "n8n-nodes-base.slack",
"position": [
1740,
380
],
"parameters": {
"text": "=Hello a new lead is interested. \n\nMore info in Hubspot here: \nhttps://app-eu1.hubspot.com/contacts/25897606/deal/{{$json[\"dealId\"]}}",
"channel": "Your channel name",
"attachments": [],
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 1
},
{
"id": "db18ac14-8e18-4d86-853d-19590a09b7cc",
"name": "HubSpot - Get contact ID1",
"type": "n8n-nodes-base.hubspot",
"position": [
1300,
640
],
"parameters": {
"email": "={{ $json[\"leadEmail\"] }}",
"resource": "contact",
"authentication": "oAuth2",
"additionalFields": {
"lastName": "={{ $json[\"leadLastName\"] }}",
"firstName": "={{ $json[\"leadFirstName\"] }}"
}
},
"credentials": {
"hubspotOAuth2Api": {
"id": "14",
"name": "Hubspot account"
}
},
"typeVersion": 1
},
{
"id": "9153abd0-4606-423c-8e9b-7cdcf7a9c490",
"name": "Slack1",
"type": "n8n-nodes-base.slack",
"position": [
1300,
900
],
"parameters": {
"text": "=Hello a lead replied to your emails. \n\nMore info in lemlist here: \nhttps://app.lemlist.com/teams/{{$json[\"teamId\"]}}/reports/campaigns/{{$json[\"campaignId\"]}}",
"channel": "Your channel name",
"attachments": [],
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 1
},
{
"id": "42b93264-df66-4528-ab02-c038ea0d8758",
"name": "Lemlist - Lead Replied",
"type": "n8n-nodes-base.lemlistTrigger",
"position": [
-520,
320
],
"webhookId": "c8f49f36-7ab6-4607-bc5a-41c9555ebd09",
"parameters": {
"event": "emailsReplied",
"options": {
"isFirst": true
}
},
"credentials": {
"lemlistApi": {
"id": "45",
"name": "Lemlist - \"lemlist\" team API key"
}
},
"typeVersion": 1
},
{
"id": "c3b52828-e6d6-41a0-b9ca-101cec379dbf",
"name": "OpenAI",
"type": "n8n-nodes-base.openAi",
"position": [
-240,
140
],
"parameters": {
"prompt": "=The following is a list of emails and the categories they fall into:\nCategories=[\"interested\", \"Out of office\", \"unsubscribe\", \"other\"]\n\nInterested is when the reply is positive.\"\n\n{{$json[\"text\"].replaceAll(/^\\s+|\\s+$/g, '').replace(/(\\r\\n|\\n|\\r)/gm, \"\")}}\\\"\nCategory:",
"options": {
"topP": 1,
"maxTokens": 6,
"temperature": 0
}
},
"credentials": {
"openAiApi": {
"id": "67",
"name": "Lucas Open AI"
}
},
"typeVersion": 1
}
],
"connections": {
"Merge": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "Lemlist - Unsubscribe",
"type": "main",
"index": 0
}
],
[
{
"node": "lemlist - Mark as interested",
"type": "main",
"index": 0
},
{
"node": "HubSpot - Get contact ID",
"type": "main",
"index": 0
}
],
[
{
"node": "HubSpot - Get contact ID1",
"type": "main",
"index": 0
}
],
[
{
"node": "Slack1",
"type": "main",
"index": 0
}
]
]
},
"HubSpot - Create Deal": {
"main": [
[
{
"node": "Slack",
"type": "main",
"index": 0
}
]
]
},
"Lemlist - Lead Replied": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"HubSpot - Get contact ID": {
"main": [
[
{
"node": "HubSpot - Create Deal",
"type": "main",
"index": 0
}
]
]
},
"HubSpot - Get contact ID1": {
"main": [
[
{
"node": "follow up task",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,472 @@
{
"meta": {
"instanceId": "2b1cc1a8b0a2fb9caab11ab2d5eb3712f9973066051b2e898cf4041a1f2a7757",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "7786165e-5e74-4614-b065-86db19482b72",
"name": "Format text with Markdown",
"type": "n8n-nodes-base.markdown",
"position": [
-1200,
980
],
"parameters": {
"html": "={{ $json.text }}",
"options": {},
"destinationKey": "textClean"
},
"typeVersion": 1,
"continueOnFail": true
},
{
"id": "8f73d4d6-2473-4fdf-8797-c049d6df6967",
"name": "Lemlist Trigger - On new reply",
"type": "n8n-nodes-base.lemlistTrigger",
"position": [
-1600,
980
],
"webhookId": "039bb443-8d2a-4eb3-9c16-772943a46db7",
"parameters": {
"event": "emailsReplied",
"options": {
"isFirst": true
}
},
"typeVersion": 1
},
{
"id": "1f94d672-0a70-45ad-bf96-72c4aecabcd0",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1700,
680
],
"parameters": {
"width": 304.92548549441915,
"height": 504.9663351162785,
"content": "### Get your lemlist API key\n\n1. Go to your lemlist account or create one [HERE](https://app.lemlist.com/create-account)\n\n2. Go to Settings -> Integrations\n\n3. Generate your API Key and copy it\n\n4. On this node, click on create new credential and paste your API key"
},
"typeVersion": 1
},
{
"id": "3032b04c-76a2-4f7c-a790-ede26b102254",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2040,
680
],
"parameters": {
"width": 319.6621253622332,
"height": 507.1074887209538,
"content": "# Read me\n\nThis workflow send email replies of your lemlist campaigns to the Slack channel of your choice.\n\nThe OpenAI node will classify the reply status. \n\nThe Slack alert is structured in a way that make it easy to read for the user."
},
"typeVersion": 1
},
{
"id": "df142fcb-f5ec-475d-8f90-c0bd064d390c",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-760,
1320
],
"parameters": {
"model": "gpt-4o",
"options": {}
},
"typeVersion": 1
},
{
"id": "1fa6d12c-2555-42c6-8f80-b24dc3608ed7",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-600,
1320
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"category\": {\n\t\t\t\"type\": \"string\"\n }\n\t}\n}"
},
"typeVersion": 1.2
},
{
"id": "734013f9-d058-4f08-9026-a41cd5877a3b",
"name": "Send alert to Slack",
"type": "n8n-nodes-base.slack",
"position": [
320,
700
],
"parameters": {
"text": "=",
"select": "channel",
"blocksUi": "={\n\t\"blocks\": [\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \":raised_hands: New reply in lemlist!\\n\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"fields\": [\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Categorized as:*\\n{{ $json[\"output\"][\"category\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Campaign:*\\n<https://app.lemlist.com/teams/{{ $json[\"teamId\"] }}/reports/campaigns/{{ $json[\"campaignId\"] }}|{{ $json[\"campaignName\"] }}>\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Sender Email:*\\n{{ $json[\"sendUserEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Lead Email:*\\n{{ $json[\"leadEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Linkedin URL:*\\n{{ $json[\"linkedinUrl\"] }}\"\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Reply preview*:\\n{{ JSON.stringify($json[\"textClean\"]).replace(/^\"(.+(?=\"$))\"$/, '$1').substring(0, 100) }}\"\n\t\t\t}\n\t\t}\n\t]\n}",
"channelId": {
"__rl": true,
"mode": "name",
"value": "automated_outbound_replies"
},
"messageType": "block",
"otherOptions": {
"botProfile": {
"imageValues": {
"icon_emoji": ":fire:",
"profilePhotoType": "emoji"
}
},
"unfurl_links": false,
"includeLinkToWorkflow": false
}
},
"typeVersion": 2.1
},
{
"id": "0558c166-16d7-4c26-a09c-fb46c2b6b687",
"name": "Lemlist - Unsubscribe",
"type": "n8n-nodes-base.lemlist",
"position": [
300,
1000
],
"parameters": {
"email": "={{ $json[\"leadEmail\"] }}",
"resource": "lead",
"operation": "unsubscribe",
"campaignId": "={{$json[\"campaignId\"]}}"
},
"typeVersion": 1
},
{
"id": "79d17d20-a60a-4b5a-a83c-821cac265b17",
"name": "lemlist - Mark as interested",
"type": "n8n-nodes-base.httpRequest",
"position": [
300,
1260
],
"parameters": {
"url": "=https://api.lemlist.com/api/campaigns/{{$json[\"campaignId\"]}}/leads/{{$json[\"leadEmail\"]}}/interested",
"options": {},
"requestMethod": "POST",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "lemlistApi"
},
"typeVersion": 2
},
{
"id": "04f74337-903c-481a-95ca-a1d4a5985b9e",
"name": "Categorize lemlist reply",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
-780,
1120
],
"parameters": {
"text": "=Classify the [email_content] in one only of the following categories: \n\nCategories=[\"Interested\", \"Out of office\", \"Unsubscribe\", \"Not interested\", \"Other\"] \n\n- Interested is when the reply is positive, and the person want more information or a meeting \n\nDon't output quotes like in the next example: \nemail_content_example:Hey I would like to know more \ncategory:Interested\n\nemail_content:\"{{ $json.textClean }}\" \n\nOnly answer with JSON in the following format:\n{\"replyStatus\":category}\n\nJSON:",
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.4
},
{
"id": "c1d66785-e096-4fd7-90de-51c7b9117413",
"name": "Merge data",
"type": "n8n-nodes-base.merge",
"position": [
-280,
1000
],
"parameters": {
"mode": "combine",
"options": {},
"combinationMode": "mergeByPosition"
},
"typeVersion": 2.1
},
{
"id": "bf21f5b9-6978-4657-a0a2-847265cff31e",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
520
],
"parameters": {
"width": 480.38008828116847,
"height": 341.5885389153657,
"content": "### Create a Slack notification for each new replies\n\n1. Connect your Slack account by clicking to add Credentials\n\n2. Write the name of the channel where you want to send the Slack alert"
},
"typeVersion": 1
},
{
"id": "024b4399-8e20-4974-986d-6c1ee4103fa0",
"name": "Route reply to the right branch",
"type": "n8n-nodes-base.switch",
"position": [
-100,
1000
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Send all replies to Slack",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.output.category }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Unsubscribe",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9ad6f5cd-8c50-4710-8eaf-085e8f11f202",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.category }}",
"rightValue": "Unsubscribe"
}
]
},
"renameOutput": true
},
{
"outputKey": "Interested",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cb410bcc-a70c-4430-aec1-b71f3f615c4d",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.category }}",
"rightValue": "Interested"
}
]
},
"renameOutput": true
}
]
},
"options": {
"allMatchingOutputs": true
}
},
"typeVersion": 3
},
{
"id": "f9f23daa-f7a9-49f9-8ffb-16798656af73",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
900
],
"parameters": {
"width": 480.38008828116847,
"height": 256.5682017131378,
"content": "### Save time by automatically unsubscribing leads that don't want to receive emails from you"
},
"typeVersion": 1
},
{
"id": "63c536bd-e624-4118-b0c8-38c07f2d1955",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
1200
],
"parameters": {
"width": 480.38008828116847,
"height": 256.5682017131378,
"content": "### Mark interested leads as interested in lemlist"
},
"typeVersion": 1
},
{
"id": "8ed8b714-8196-4593-87b8-18c6a7318fbe",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
875.46282303881
],
"parameters": {
"width": 480.38008828116847,
"height": 608.2279357257166,
"content": "### Categorize the reply with OpenAI"
},
"typeVersion": 1
},
{
"id": "6b1846df-0214-4383-87cf-55232093ae2a",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1320,
880
],
"parameters": {
"width": 336.62085535637357,
"height": 311.3046602455328,
"content": "### This node will clean the text and make sure it looks pretty on Slack"
},
"typeVersion": 1
},
{
"id": "f7378ecd-e8d2-4204-a883-3161be601ffc",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
880
],
"parameters": {
"width": 336.62085535637357,
"height": 311.3046602455328,
"content": "### Trigger a different scenario according to the category of the reply"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge data": {
"main": [
[
{
"node": "Route reply to the right branch",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Categorize lemlist reply",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Categorize lemlist reply": {
"main": [
[
{
"node": "Merge data",
"type": "main",
"index": 1
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Categorize lemlist reply",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Format text with Markdown": {
"main": [
[
{
"node": "Merge data",
"type": "main",
"index": 0
},
{
"node": "Categorize lemlist reply",
"type": "main",
"index": 0
}
]
]
},
"Lemlist Trigger - On new reply": {
"main": [
[
{
"node": "Format text with Markdown",
"type": "main",
"index": 0
}
]
]
},
"Route reply to the right branch": {
"main": [
[
{
"node": "Send alert to Slack",
"type": "main",
"index": 0
}
],
[
{
"node": "Lemlist - Unsubscribe",
"type": "main",
"index": 0
}
],
[
{
"node": "lemlist - Mark as interested",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,472 @@
{
"meta": {
"instanceId": "2b1cc1a8b0a2fb9caab11ab2d5eb3712f9973066051b2e898cf4041a1f2a7757",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "7786165e-5e74-4614-b065-86db19482b72",
"name": "Format text with Markdown",
"type": "n8n-nodes-base.markdown",
"position": [
-1200,
980
],
"parameters": {
"html": "={{ $json.text }}",
"options": {},
"destinationKey": "textClean"
},
"typeVersion": 1,
"continueOnFail": true
},
{
"id": "8f73d4d6-2473-4fdf-8797-c049d6df6967",
"name": "Lemlist Trigger - On new reply",
"type": "n8n-nodes-base.lemlistTrigger",
"position": [
-1600,
980
],
"webhookId": "039bb443-8d2a-4eb3-9c16-772943a46db7",
"parameters": {
"event": "emailsReplied",
"options": {
"isFirst": true
}
},
"typeVersion": 1
},
{
"id": "1f94d672-0a70-45ad-bf96-72c4aecabcd0",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1700,
680
],
"parameters": {
"width": 304.92548549441915,
"height": 504.9663351162785,
"content": "### Get your lemlist API key\n\n1. Go to your lemlist account or create one [HERE](https://app.lemlist.com/create-account)\n\n2. Go to Settings -> Integrations\n\n3. Generate your API Key and copy it\n\n4. On this node, click on create new credential and paste your API key"
},
"typeVersion": 1
},
{
"id": "3032b04c-76a2-4f7c-a790-ede26b102254",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2040,
680
],
"parameters": {
"width": 319.6621253622332,
"height": 507.1074887209538,
"content": "# Read me\n\nThis workflow send email replies of your lemlist campaigns to the Slack channel of your choice.\n\nThe OpenAI node will classify the reply status. \n\nThe Slack alert is structured in a way that make it easy to read for the user."
},
"typeVersion": 1
},
{
"id": "df142fcb-f5ec-475d-8f90-c0bd064d390c",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-760,
1320
],
"parameters": {
"model": "gpt-4o",
"options": {}
},
"typeVersion": 1
},
{
"id": "1fa6d12c-2555-42c6-8f80-b24dc3608ed7",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-600,
1320
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"category\": {\n\t\t\t\"type\": \"string\"\n }\n\t}\n}"
},
"typeVersion": 1.2
},
{
"id": "734013f9-d058-4f08-9026-a41cd5877a3b",
"name": "Send alert to Slack",
"type": "n8n-nodes-base.slack",
"position": [
320,
700
],
"parameters": {
"text": "=",
"select": "channel",
"blocksUi": "={\n\t\"blocks\": [\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \":raised_hands: New reply in lemlist!\\n\"\n\t\t\t}\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"fields\": [\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Categorized as:*\\n{{ $json[\"output\"][\"category\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Campaign:*\\n<https://app.lemlist.com/teams/{{ $json[\"teamId\"] }}/reports/campaigns/{{ $json[\"campaignId\"] }}|{{ $json[\"campaignName\"] }}>\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Sender Email:*\\n{{ $json[\"sendUserEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Lead Email:*\\n{{ $json[\"leadEmail\"] }}\"\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\t\"text\": \"*Linkedin URL:*\\n{{ $json[\"linkedinUrl\"] }}\"\n\t\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"type\": \"section\",\n\t\t\t\"text\": {\n\t\t\t\t\"type\": \"mrkdwn\",\n\t\t\t\t\"text\": \"*Reply preview*:\\n{{ JSON.stringify($json[\"textClean\"]).replace(/^\"(.+(?=\"$))\"$/, '$1').substring(0, 100) }}\"\n\t\t\t}\n\t\t}\n\t]\n}",
"channelId": {
"__rl": true,
"mode": "name",
"value": "automated_outbound_replies"
},
"messageType": "block",
"otherOptions": {
"botProfile": {
"imageValues": {
"icon_emoji": ":fire:",
"profilePhotoType": "emoji"
}
},
"unfurl_links": false,
"includeLinkToWorkflow": false
}
},
"typeVersion": 2.1
},
{
"id": "0558c166-16d7-4c26-a09c-fb46c2b6b687",
"name": "Lemlist - Unsubscribe",
"type": "n8n-nodes-base.lemlist",
"position": [
300,
1000
],
"parameters": {
"email": "={{ $json[\"leadEmail\"] }}",
"resource": "lead",
"operation": "unsubscribe",
"campaignId": "={{$json[\"campaignId\"]}}"
},
"typeVersion": 1
},
{
"id": "79d17d20-a60a-4b5a-a83c-821cac265b17",
"name": "lemlist - Mark as interested",
"type": "n8n-nodes-base.httpRequest",
"position": [
300,
1260
],
"parameters": {
"url": "=https://api.lemlist.com/api/campaigns/{{$json[\"campaignId\"]}}/leads/{{$json[\"leadEmail\"]}}/interested",
"options": {},
"requestMethod": "POST",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "lemlistApi"
},
"typeVersion": 2
},
{
"id": "04f74337-903c-481a-95ca-a1d4a5985b9e",
"name": "Categorize lemlist reply",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
-780,
1120
],
"parameters": {
"text": "=Classify the [email_content] in one only of the following categories: \n\nCategories=[\"Interested\", \"Out of office\", \"Unsubscribe\", \"Not interested\", \"Other\"] \n\n- Interested is when the reply is positive, and the person want more information or a meeting \n\nDon't output quotes like in the next example: \nemail_content_example:Hey I would like to know more \ncategory:Interested\n\nemail_content:\"{{ $json.textClean }}\" \n\nOnly answer with JSON in the following format:\n{\"replyStatus\":category}\n\nJSON:",
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 1.4
},
{
"id": "c1d66785-e096-4fd7-90de-51c7b9117413",
"name": "Merge data",
"type": "n8n-nodes-base.merge",
"position": [
-280,
1000
],
"parameters": {
"mode": "combine",
"options": {},
"combinationMode": "mergeByPosition"
},
"typeVersion": 2.1
},
{
"id": "bf21f5b9-6978-4657-a0a2-847265cff31e",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
520
],
"parameters": {
"width": 480.38008828116847,
"height": 341.5885389153657,
"content": "### Create a Slack notification for each new replies\n\n1. Connect your Slack account by clicking to add Credentials\n\n2. Write the name of the channel where you want to send the Slack alert"
},
"typeVersion": 1
},
{
"id": "024b4399-8e20-4974-986d-6c1ee4103fa0",
"name": "Route reply to the right branch",
"type": "n8n-nodes-base.switch",
"position": [
-100,
1000
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Send all replies to Slack",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"leftValue": "={{ $json.output.category }}",
"rightValue": ""
}
]
},
"renameOutput": true
},
{
"outputKey": "Unsubscribe",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9ad6f5cd-8c50-4710-8eaf-085e8f11f202",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.category }}",
"rightValue": "Unsubscribe"
}
]
},
"renameOutput": true
},
{
"outputKey": "Interested",
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cb410bcc-a70c-4430-aec1-b71f3f615c4d",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.output.category }}",
"rightValue": "Interested"
}
]
},
"renameOutput": true
}
]
},
"options": {
"allMatchingOutputs": true
}
},
"typeVersion": 3
},
{
"id": "f9f23daa-f7a9-49f9-8ffb-16798656af73",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
900
],
"parameters": {
"width": 480.38008828116847,
"height": 256.5682017131378,
"content": "### Save time by automatically unsubscribing leads that don't want to receive emails from you"
},
"typeVersion": 1
},
{
"id": "63c536bd-e624-4118-b0c8-38c07f2d1955",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
260,
1200
],
"parameters": {
"width": 480.38008828116847,
"height": 256.5682017131378,
"content": "### Mark interested leads as interested in lemlist"
},
"typeVersion": 1
},
{
"id": "8ed8b714-8196-4593-87b8-18c6a7318fbe",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-880,
875.46282303881
],
"parameters": {
"width": 480.38008828116847,
"height": 608.2279357257166,
"content": "### Categorize the reply with OpenAI"
},
"typeVersion": 1
},
{
"id": "6b1846df-0214-4383-87cf-55232093ae2a",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1320,
880
],
"parameters": {
"width": 336.62085535637357,
"height": 311.3046602455328,
"content": "### This node will clean the text and make sure it looks pretty on Slack"
},
"typeVersion": 1
},
{
"id": "f7378ecd-e8d2-4204-a883-3161be601ffc",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-220,
880
],
"parameters": {
"width": 336.62085535637357,
"height": 311.3046602455328,
"content": "### Trigger a different scenario according to the category of the reply"
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"Merge data": {
"main": [
[
{
"node": "Route reply to the right branch",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Categorize lemlist reply",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Categorize lemlist reply": {
"main": [
[
{
"node": "Merge data",
"type": "main",
"index": 1
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Categorize lemlist reply",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"Format text with Markdown": {
"main": [
[
{
"node": "Merge data",
"type": "main",
"index": 0
},
{
"node": "Categorize lemlist reply",
"type": "main",
"index": 0
}
]
]
},
"Lemlist Trigger - On new reply": {
"main": [
[
{
"node": "Format text with Markdown",
"type": "main",
"index": 0
}
]
]
},
"Route reply to the right branch": {
"main": [
[
{
"node": "Send alert to Slack",
"type": "main",
"index": 0
}
],
[
{
"node": "Lemlist - Unsubscribe",
"type": "main",
"index": 0
}
],
[
{
"node": "lemlist - Mark as interested",
"type": "main",
"index": 0
}
]
]
}
}
}