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,522 @@
{
"id": "177",
"meta": {
"instanceId": "dfdeafd1c3ed2ee08eeab8c2fa0c3f522066931ed8138ccd35dc20a1e69decd3"
},
"name": "Telegram AI-bot",
"tags": [
{
"id": "15",
"name": "tutorial",
"createdAt": "2022-10-04T20:07:25.607Z",
"updatedAt": "2022-10-04T20:07:25.607Z"
}
],
"nodes": [
{
"id": "ea71a467-a646-4aca-b72e-cef1249c74e2",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
20,
340
],
"webhookId": "51942fbb-ca0e-4ec4-9423-5fcc7d3c4281",
"parameters": {
"updates": [
"*"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "1cbe43d4-ea8b-4178-bc10-4bfad7abe143",
"name": "CheckCommand",
"type": "n8n-nodes-base.switch",
"position": [
980,
360
],
"parameters": {
"rules": {
"rules": [
{
"value2": "/",
"operation": "notStartsWith"
},
{
"output": 1,
"value2": "/start",
"operation": "startsWith"
},
{
"output": 2,
"value2": "=/image ",
"operation": "startsWith"
}
]
},
"value1": "={{ $json.message?.text }}",
"dataType": "string",
"fallbackOutput": 3
},
"typeVersion": 1
},
{
"id": "074e907f-634b-4242-b669-33fa064f8472",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
581.661764705882
],
"parameters": {
"width": 316.1071428571428,
"height": 231.22373949579838,
"content": "## Error fallback for unsupported commands"
},
"typeVersion": 1
},
{
"id": "2aa961b8-f0af-4d5c-a6af-1be56ea4b2e6",
"name": "Settings",
"type": "n8n-nodes-base.set",
"position": [
380,
340
],
"parameters": {
"values": {
"number": [
{
"name": "model_temperature",
"value": 0.8
},
{
"name": "token_length",
"value": 500
}
],
"string": [
{
"name": "system_command",
"value": "=You are a friendly chatbot. User name is {{ $json?.message?.from?.first_name }}. User system language is {{ $json?.message?.from?.language_code }}. First, detect user text language. Next, provide your reply in the same language. Include several suitable emojis in your answer."
},
{
"name": "bot_typing",
"value": "={{ $json?.message?.text.startsWith('/image') ? \"upload_photo\" : \"typing\" }}"
}
]
},
"options": {}
},
"typeVersion": 2
},
{
"id": "2d2fe268-1e3e-483b-847c-4412e586c1ca",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1240,
-240
],
"parameters": {
"width": 330.5019024637719,
"height": 233,
"content": "## Chatbot mode by default\n### (when no command is provided)"
},
"typeVersion": 1
},
{
"id": "09a9c0b4-ac6e-46eb-b2e0-ef2b55e94ada",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1240,
20
],
"parameters": {
"width": 330.7863484403046,
"height": 219.892857142857,
"content": "## Welcome message\n### /start"
},
"typeVersion": 1
},
{
"id": "088cffee-5720-488b-a4ec-cfdccbf77e75",
"name": "Chat_mode",
"type": "n8n-nodes-base.openAi",
"position": [
1340,
-160
],
"parameters": {
"model": "gpt-4",
"prompt": {
"messages": [
{
"role": "system",
"content": "={{ $json.system_command }}"
},
{
"content": "={{ $json.message.text }}"
}
]
},
"options": {
"maxTokens": "={{ $json.token_length }}",
"temperature": "={{ $json.model_temperature }}"
},
"resource": "chat"
},
"credentials": {
"openAiApi": {
"id": "63",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "41248697-6474-4a8f-a8b8-038c96465948",
"name": "Greeting",
"type": "n8n-nodes-base.openAi",
"position": [
1340,
80
],
"parameters": {
"prompt": {
"messages": [
{
"role": "system",
"content": "={{ $json.system_command }}"
},
{
"content": "=This is the first message from a user. Please welcome a new user in `{{ $json.message.from.language_code }}` language"
}
]
},
"options": {
"maxTokens": "={{ $json.token_length }}",
"temperature": "={{ $json.model_temperature }}"
},
"resource": "chat"
},
"credentials": {
"openAiApi": {
"id": "63",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "20c2e7fa-5d65-441b-8d1d-a8d46c624964",
"name": "Text reply",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
-40
],
"parameters": {
"text": "={{ $json.message.content }}",
"chatId": "={{ $('Settings').first().json.message.from.id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "30321276-ebe1-41ac-b420-9dab8daa405b",
"name": "Send Typing action",
"type": "n8n-nodes-base.telegram",
"position": [
580,
480
],
"parameters": {
"action": "={{ $json.bot_typing }}",
"chatId": "={{ $json.message.from.id }}",
"operation": "sendChatAction"
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "7d7ff2e8-b0ca-4638-a056-f7b4e2e6273d",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
800,
360
],
"parameters": {
"mode": "chooseBranch"
},
"typeVersion": 2.1
},
{
"id": "656bab5e-b7f7-47a1-8e75-4a17d2070290",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1240,
280
],
"parameters": {
"width": 329.7428571428562,
"height": 233.8785714285713,
"content": "## Create an image\n### /image + request"
},
"typeVersion": 1
},
{
"id": "ca2111d2-463a-4ef0-9436-ee09598dbf07",
"name": "Create an image",
"type": "n8n-nodes-base.openAi",
"position": [
1340,
360
],
"parameters": {
"prompt": "={{ $json.message.text.split(' ').slice(1).join(' ') }}",
"options": {
"n": 1,
"size": "512x512"
},
"resource": "image",
"responseFormat": "imageUrl"
},
"credentials": {
"openAiApi": {
"id": "63",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "e91d616b-1d5e-40e8-8468-2d0b2dda4cf7",
"name": "Send error message",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
660
],
"parameters": {
"text": "=Sorry, {{ $json.message.from.first_name }}! This command is not supported yet. Please type some text to a chat bot or try this command:\n/image \\[your prompt]\n\nEnter the command, then space and provide your request. Example:\n\n`/image a picture or a cute little kitten with big eyes. Miyazaki studio ghibli style`",
"chatId": "={{ $json.message.from.id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "125e27d2-b03b-4f02-9dd1-8fc81ecf0b6b",
"name": "Send image",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
360
],
"parameters": {
"file": "={{ $json.url }}",
"chatId": "={{ $('Settings').first().json.message.from.id }}",
"operation": "sendPhoto",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "730a51ac-223e-4956-be7f-166eadb6ed81",
"name": "PreProcessing",
"type": "n8n-nodes-base.set",
"position": [
200,
340
],
"parameters": {
"values": {
"string": [
{
"name": "message.text",
"value": "={{ $json?.message?.text || \"\" }}"
}
]
},
"options": {
"dotNotation": true
}
},
"typeVersion": 2
}
],
"active": true,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"saveManualExecutions": true,
"saveDataSuccessExecution": "all"
},
"versionId": "6ab99e3f-845d-42cc-847b-37cf19a72e93",
"connections": {
"Merge": {
"main": [
[
{
"node": "CheckCommand",
"type": "main",
"index": 0
}
]
]
},
"Greeting": {
"main": [
[
{
"node": "Text reply",
"type": "main",
"index": 0
}
]
]
},
"Settings": {
"main": [
[
{
"node": "Send Typing action",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Chat_mode": {
"main": [
[
{
"node": "Text reply",
"type": "main",
"index": 0
}
]
]
},
"CheckCommand": {
"main": [
[
{
"node": "Chat_mode",
"type": "main",
"index": 0
}
],
[
{
"node": "Greeting",
"type": "main",
"index": 0
}
],
[
{
"node": "Create an image",
"type": "main",
"index": 0
}
],
[
{
"node": "Send error message",
"type": "main",
"index": 0
}
]
]
},
"PreProcessing": {
"main": [
[
{
"node": "Settings",
"type": "main",
"index": 0
}
]
]
},
"Create an image": {
"main": [
[
{
"node": "Send image",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "PreProcessing",
"type": "main",
"index": 0
}
]
]
},
"Send Typing action": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
}
}
}

View File

@@ -0,0 +1,330 @@
{
"meta": {
"instanceId": "82a17fa4a0b8e81bf77e5ab999d980f392150f2a9541fde626dc5f74857b1f54"
},
"nodes": [
{
"id": "4ea39a4f-d8c1-438f-9738-bfbb906a3d7a",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
1020
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Send customer feedback to OpenAI for sentiment analysis"
},
"typeVersion": 1
},
{
"id": "6962ea41-7d15-4932-919f-21ac94fa1269",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1960,
1180
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Add new feedback to google sheets"
},
"typeVersion": 1
},
{
"id": "4c8a8984-2d8e-4139-866b-6f3536aced07",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
1600
],
"parameters": {
"width": 1407,
"height": 254,
"content": "## Instructions\n1. Connect Google sheets\n2. Connect your OpenAi account (api key + org Id)\n3. Create a customer feedback form, use an existing one or use the one below as example. \nAll set!\n\n\n- Here is the example google sheet being used in this workflow: https://docs.google.com/spreadsheets/d/1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4/edit?usp=sharing. You can download it to your account."
},
"typeVersion": 1
},
{
"id": "d43a9574-626d-4817-87ba-d99bdd6f41dc",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
1160
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Feedback form is submitted"
},
"typeVersion": 1
},
{
"id": "76dab2dc-935f-416e-91aa-5a1b7017ec1b",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
1180
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Merge form data and OpenAI result"
},
"typeVersion": 1
},
{
"id": "9772eac1-8df2-4305-9b2c-265d3c5a9a4a",
"name": "Add customer feedback to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
2020,
1320
],
"parameters": {
"columns": {
"value": {
"Category": "={{ $json['What is your feedback about?'] }}",
"Sentiment": "={{ $json.text }}",
"Timestamp": "={{ $json.submittedAt }}",
"Entered by": "=Form",
"Customer Name": "={{ $json.Name }}",
"Customer contact": "={{ $json['How do we get in touch with you?'] }}",
"Customer Feedback": "={{ $json['Your feedback'] }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Category",
"type": "string",
"display": true,
"required": false,
"displayName": "Category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Customer Feedback",
"type": "string",
"display": true,
"required": false,
"displayName": "Customer Feedback",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Customer Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Customer Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Customer contact",
"type": "string",
"display": true,
"required": false,
"displayName": "Customer contact",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Entered by",
"type": "string",
"display": true,
"required": false,
"displayName": "Entered by",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Urgent?",
"type": "string",
"display": true,
"required": false,
"displayName": "Urgent?",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Sentiment",
"type": "string",
"display": true,
"required": false,
"displayName": "Sentiment",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": []
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4/edit?usp=drivesdk",
"cachedResultName": "CustomerFeedback"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "3",
"name": "Google Sheets account"
}
},
"typeVersion": 4.1
},
{
"id": "12084971-c81b-4a0e-814e-120867562642",
"name": "Merge sentiment with form content",
"type": "n8n-nodes-base.merge",
"position": [
1680,
1320
],
"parameters": {
"mode": "combine",
"options": {},
"combinationMode": "multiplex"
},
"typeVersion": 2.1
},
{
"id": "235edf5b-7724-4712-8dc5-d8327a0620b8",
"name": "Classify feedback with OpenAI",
"type": "n8n-nodes-base.openAi",
"position": [
1280,
1180
],
"parameters": {
"prompt": "=Classify the sentiment in the following customer feedback: {{ $json['Your feedback'] }}",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "s2iucY0IctjYNbrb",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "af4b22aa-0925-40b1-a9ac-298f9745a98e",
"name": "Submit form with customer feedback",
"type": "n8n-nodes-base.formTrigger",
"position": [
860,
1340
],
"webhookId": "e7bf682e-48e8-40de-9815-cd180cdd1480",
"parameters": {
"options": {
"formSubmittedText": "Your response has been recorded"
},
"formTitle": "Customer Feedback",
"formFields": {
"values": [
{
"fieldLabel": "Name",
"requiredField": true
},
{
"fieldType": "dropdown",
"fieldLabel": "What is your feedback about?",
"fieldOptions": {
"values": [
{
"option": "Product"
},
{
"option": "Service"
},
{
"option": "Other"
}
]
},
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "Your feedback",
"requiredField": true
},
{
"fieldLabel": "How do we get in touch with you?"
}
]
},
"formDescription": "Please give feedback about our company orproducts."
},
"typeVersion": 1
}
],
"connections": {
"Classify feedback with OpenAI": {
"main": [
[
{
"node": "Merge sentiment with form content",
"type": "main",
"index": 0
}
]
]
},
"Merge sentiment with form content": {
"main": [
[
{
"node": "Add customer feedback to Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Submit form with customer feedback": {
"main": [
[
{
"node": "Classify feedback with OpenAI",
"type": "main",
"index": 0
},
{
"node": "Merge sentiment with form content",
"type": "main",
"index": 1
}
]
]
}
}
}

View File

@@ -0,0 +1,178 @@
{
"meta": {
"instanceId": "96cab4456c8d5d47ff3acba57e93f1f3750005103b819e4580442bcd2bb6cc4d"
},
"nodes": [
{
"id": "8b6d8462-1fe5-478b-aa15-7d10ff799aae",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
980,
900
],
"parameters": {
"fields": {
"values": [
{
"name": "prompt",
"stringValue": "\"\"\"PROMPT: The above is a n8n workflow json, please create workflow documentation for the user:. you are the master of brevity, be as concise and brief as possible, output generated documentation only. ## Guidelines for the documentation - **Provide a detailed description**: Provide a concise and informative description outlining the template's functionality and expected outcomes. Include a brief setup guide for user convenience. A detailed description not only clarifies the template's purpose but also enhances its discoverability through SEO. Its advised to use these sections in your description: - Who is this for? - What problem is this workflow solving? / use case - What this workflow does - Setup - How to customize this workflow to your needs Here is an example ``` # Who is this template for? This workflow template is designed for **Sales** and **Customer Success** professionals seeking alerts when potential high-value users, prospects, or existing customers register for a Discourse community. Leveraging Clearbit, it retrieves enriched data for the new member to assess their value. ### Example result in Slack ![Screenshot 20240221 at 13.51.29.png](https://n8niostorageaccount.blob.core.windows.net/n8nio-strapi-blobs-prod/assets/Screenshot_2024_02_21_at_13_51_29_030961dc1b.png) # How it works - Each time a new member is created in Discourse, the workflow runs (powered by Discourse's native Webhooks feature). - After filtering out popular private email accounts, we run the member's email through Clearbit to fetch available information on the member as well as their organization. - If the enriched data meets certain criteria, we send a Slack message to a channel. This message has a few quick actions: `Open LinkedIn profile` and `Email member` # Set up instructions Overview is below. Watch this [🎥 quick set up video](https://www.loom.com/share/d379895004374ddc85dc9171ca37c139?sid=bb28df29-bc91-4d32-a657-0bfbaaf50cc7) for detailed instructions on how to get the template running, as well as how to customize it. 1. Complete the `Set up credentials` step when you first open the workflow. You'll need a Discourse (admin user), Clearbit, and Slack account. 2. Set up the Webhook in Discourse, linking the `On new Discourse user` Trigger with your Discourse community. 3. Set the correct channel to send to in the `Post message in channel` step 4. After testing your workflow, swap the Test URL to Production URL in Discourse and activate your workflow Template was created in n8n `v1.29.1` ``` \"\"\""
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "9d1e972c-e737-4221-bd8b-dfd8115b9948",
"name": "OpenAI",
"type": "n8n-nodes-base.openAi",
"position": [
1400,
900
],
"parameters": {
"prompt": {
"messages": [
{
"content": "={{ $json.input }}"
}
]
},
"options": {},
"resource": "chat",
"chatModel": "gpt-4-1106-preview"
},
"credentials": {
"openAiApi": {
"id": "GrqJccjcTot1xZLv",
"name": "OpenAi account"
}
},
"typeVersion": 1.1
},
{
"id": "3071e7e7-e0d6-4fad-a6ee-fbb5b722f344",
"name": "Respond to Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1620,
900
],
"parameters": {
"options": {
"responseCode": 200,
"responseHeaders": {
"entries": [
{
"name": "Content-Type",
"value": "text/html; charset=UTF-8"
}
]
}
},
"respondWith": "text",
"responseBody": "=<!DOCTYPE html>\n<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Markdown to HTML</title>\n <style>\n main {\n font-family: Arial, sans-serif;\n margin: 0;\n display: flex;\n justify-content: center;\n height: 100vh;\n background-color: #f5f5f5;\n font-size: 24px;\n }\n\n .content-container {\n text-align: center;\n border: 1px solid #ddd;\n border-radius: 8px;\n padding: 20px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n background-color: #fff;\n max-width: 600px;\n width: 100%;\n margin: 20px;\n }\n\n #markdown-content {\n text-align: left;\n margin-top: 20px;\n }\n </style>\n </head>\n <body>\n <main>\n <div class=\"content-container\">\n <div id=\"markdown-content\"> {{ $json.message.content?.replace(/\\n/g,'<br/>') }}</div>\n </div>\n </main>\n </body>\n</html>\n"
},
"typeVersion": 1
},
{
"id": "1740cef8-d25b-46f2-a63d-50b86599dbf2",
"name": "n8n Form Trigger",
"type": "n8n-nodes-base.formTrigger",
"position": [
760,
900
],
"webhookId": "c61492e5-73ce-40d4-b758-d5f09da0fb6c",
"parameters": {
"path": "c61492e5-73ce-40d4-b758-d5f09da0fb6c",
"formTitle": "Workflow Documenter",
"formFields": {
"values": [
{
"fieldLabel": "Workflow Title",
"requiredField": true
},
{
"fieldLabel": "Workflow Json",
"requiredField": true
}
]
},
"responseMode": "responseNode",
"formDescription": "Automatically document your n8n workflow"
},
"typeVersion": 2
},
{
"id": "fde56941-46a8-4340-b099-f7e75950b336",
"name": "Create input to open ai",
"type": "n8n-nodes-base.set",
"position": [
1180,
900
],
"parameters": {
"fields": {
"values": [
{
"name": "input",
"stringValue": "=Workflow Title: {{ $json['Workflow Title'] }}\n\nWofklow JSON: ```{{ $json['Workflow Json'] }}```\n\n{{ $json.prompt }} "
}
]
},
"options": {}
},
"typeVersion": 3.2
}
],
"pinData": {},
"connections": {
"OpenAI": {
"main": [
[
{
"node": "Respond to Webhook",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Create input to open ai",
"type": "main",
"index": 0
}
]
]
},
"n8n Form Trigger": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Create input to open ai": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,131 @@
{
"nodes": [
{
"name": "Get Content Ideas",
"type": "n8n-nodes-base.googleSheets",
"position": [
200,
300
],
"parameters": {
"range": "Sheet1!A:C",
"sheetId": "YOUR_GOOGLE_SHEET_ID"
},
"credentials": {
"googleSheetsOAuth2Api": "YOUR_GOOGLE_SHEETS_CREDENTIALS"
},
"typeVersion": 1
},
{
"name": "Generate Post with OpenAI",
"type": "n8n-nodes-base.openAi",
"position": [
500,
300
],
"parameters": {
"model": "gpt-4",
"prompt": "Create a social media post for {{$node[\"Get Content Ideas\"].json[\"Platform\"]}} based on this idea: {{$node[\"Get Content Ideas\"].json[\"Idea\"]}}. Keep it engaging and concise."
},
"credentials": {
"openAIApi": "YOUR_OPENAI_CREDENTIALS"
},
"typeVersion": 1
},
{
"name": "Check Platform",
"type": "n8n-nodes-base.if",
"position": [
800,
300
],
"parameters": {
"conditions": {
"string": [
{
"value1": "{{$node[\"Get Content Ideas\"].json[\"Platform\"]}}",
"value2": "Twitter",
"operation": "equal"
}
]
}
},
"typeVersion": 1
},
{
"name": "Post to Twitter",
"type": "n8n-nodes-base.twitter",
"position": [
1000,
200
],
"parameters": {
"text": "{{$node[\"Generate Post with OpenAI\"].json[\"text\"]}}"
},
"credentials": {
"twitterOAuth1Api": "YOUR_TWITTER_CREDENTIALS"
},
"typeVersion": 1
},
{
"name": "Update Google Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1200,
300
],
"parameters": {
"range": "Sheet1!D:F",
"values": "Posted,{{$node[\"Generate Post with OpenAI\"].json[\"text\"]}},{{Date.now()}}",
"sheetId": "YOUR_GOOGLE_SHEET_ID",
"updateOperation": "append"
},
"credentials": {
"googleSheetsOAuth2Api": "YOUR_GOOGLE_SHEETS_CREDENTIALS"
},
"typeVersion": 1
}
],
"connections": {
"Check Platform": {
"main": [
[
{
"node": "Post to Twitter",
"type": "main"
}
]
]
},
"Post to Twitter": {
"main": [
[
{
"node": "Update Google Sheet",
"type": "main"
}
]
]
},
"Get Content Ideas": {
"main": [
[
{
"node": "Generate Post with OpenAI",
"type": "main"
}
]
]
},
"Generate Post with OpenAI": {
"main": [
[
{
"node": "Check Platform",
"type": "main"
}
]
]
}
}
}

View File

@@ -0,0 +1,367 @@
{
"id": "8FLJK1NsduFL0Y5P",
"meta": {
"instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a"
},
"name": "Qualify new leads in Google Sheets via OpenAI's GPT-4",
"tags": [
{
"id": "y9tvM3hISJKT2jeo",
"name": "Ted's Tech Talks",
"createdAt": "2023-08-15T22:12:34.260Z",
"updatedAt": "2023-08-15T22:12:34.260Z"
}
],
"nodes": [
{
"id": "1f179325-0bec-4e5c-8ebd-0a2bb3ebefaa",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
1440,
340
],
"parameters": {
"mode": "combine",
"options": {},
"combinationMode": "mergeByPosition"
},
"typeVersion": 2.1
},
{
"id": "7b548661-2b32-451f-ba52-91ca86728f1e",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
358,
136.3642172523962
],
"parameters": {
"width": 442,
"height": 360.6357827476038,
"content": "### 1. Create a Google Sheet document\n* This template uses Google Sheet document connected to Google Forms, but a standalone Sheet document will work too\n* Adapt initial trigger to your needs: check for new entries periodically or add a manual trigger\n\n[Link to the Google Sheet template](https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs)"
},
"typeVersion": 1
},
{
"id": "308b4dce-4656-47bd-b217-69565b1c34f6",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
820,
420
],
"parameters": {
"width": 471,
"height": 322,
"content": "### 2. Provide lead qualification instructions\n* Create a __system message__ with overall instructions\n* Add a __user message__ with the JSON variables\n* Set node parses the resulting JSON object, but you can also request a plain string response in the system message"
},
"typeVersion": 1
},
{
"id": "c00442ca-98cf-4296-b084-f0881ce4fd39",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1320,
222.18785942492013
],
"parameters": {
"width": 355,
"height": 269.81214057507987,
"content": "### 3. Combine the initial data with GPT response\n* This Merge node puts together original records from the google sheet and responses from the OpenAI"
},
"typeVersion": 1
},
{
"id": "62643a4c-a69c-4351-9960-20413285ff33",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1700,
220
],
"parameters": {
"width": 398,
"height": 265,
"content": "### 4. Update the Google Sheet document\n* Provide __Column to Match On__ (usually a timestamp in case of Google Forms)\n* Enter the result from GPT into a separate column"
},
"typeVersion": 1
},
{
"id": "4cd58340-81c4-46c7-b346-25a9b6ef2910",
"name": "Update lead status",
"type": "n8n-nodes-base.googleSheets",
"position": [
1860,
340
],
"parameters": {
"columns": {
"value": {
"Rating": "={{ $json.reply.rating }}",
"Timestamp": "={{ $json.Timestamp }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Email Address",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Email Address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Your name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Your name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Your business area",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Your business area",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Your team size",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Your team size",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Rating",
"type": "string",
"display": true,
"required": false,
"displayName": "Rating",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Timestamp"
]
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 72739218,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit#gid=72739218",
"cachedResultName": "Form Responses 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit?usp=drivesdk",
"cachedResultName": "Join Community (Responses)"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "RtRiRezoxiWkzZQt",
"name": "Ted's Tech Talks Google account"
}
},
"typeVersion": 4.2
},
{
"id": "fea0acee-13b6-441a-8cf9-c8fedbc4617d",
"name": "Extract JSON reply",
"type": "n8n-nodes-base.set",
"position": [
1120,
580
],
"parameters": {
"fields": {
"values": [
{
"name": "reply",
"type": "objectValue",
"objectValue": "={{ JSON.parse($json.message.content) }}"
}
]
},
"include": "selected",
"options": {}
},
"typeVersion": 3.2
},
{
"id": "0a0608fe-894f-4eb5-b690-233c6dfc0428",
"name": "Qualify leads with GPT",
"type": "n8n-nodes-base.openAi",
"position": [
900,
580
],
"parameters": {
"prompt": {
"messages": [
{
"role": "system",
"content": "Your task is to qualify incoming leads. Leads are form submissions to a closed community group. Use the following criteria for a quality lead:\n\n1. We are looking for decision makers who run companies or who have some teams. The bigger the team - the better. Basically, everyone with some level of responsibility should be accepted. This is the main criterion.\n2. Email from a non-standard domain. Ideally this should be a corporate domain, but this is a secondary criterion.\n\nPlease thing step by step whether a lead is quality or not?\n\nIf at least one of the criteria satisfy, reply with \"qualified\" in response. Otherwise reply \"not qualified\". Reply with a JSON of the following structure: {\"rating\":\"string\",\"explanation\":\"string\"}. Reply only with with the JSON and nothing more!"
},
{
"content": "=Here's a lead info:\nName: {{ $json['Your name'] }}\nEmail: {{ $json['Email Address'] }}\nBusiness area: {{ $json['Your business area'] }}\nSize of the team: {{ $json['Your team size'] }}"
}
]
},
"options": {
"temperature": 0.3
},
"resource": "chat",
"chatModel": "gpt-4-turbo-preview"
},
"credentials": {
"openAiApi": {
"id": "rveqdSfp7pCRON1T",
"name": "Ted's Tech Talks OpenAi"
}
},
"typeVersion": 1.1
},
{
"id": "22fdec69-a4a9-430d-9950-79195799ae7a",
"name": "Check for new entries",
"type": "n8n-nodes-base.googleSheetsTrigger",
"position": [
520,
340
],
"parameters": {
"event": "rowAdded",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 72739218,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit#gid=72739218",
"cachedResultName": "Form Responses 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit?usp=drivesdk",
"cachedResultName": "Join Community (Responses)"
}
},
"credentials": {
"googleSheetsTriggerOAuth2Api": {
"id": "m33qCYf9eEvSgo0x",
"name": "Ted's Tech Talks Google Sheets Trigger"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1",
"saveManualExecutions": true,
"saveExecutionProgress": true,
"saveDataSuccessExecution": "all"
},
"versionId": "ffad0998-1a6b-469d-9297-6d7fd88387b9",
"connections": {
"Merge": {
"main": [
[
{
"node": "Update lead status",
"type": "main",
"index": 0
}
]
]
},
"Extract JSON reply": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Check for new entries": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
},
{
"node": "Qualify leads with GPT",
"type": "main",
"index": 0
}
]
]
},
"Qualify leads with GPT": {
"main": [
[
{
"node": "Extract JSON reply",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,330 @@
{
"meta": {
"instanceId": "82a17fa4a0b8e81bf77e5ab999d980f392150f2a9541fde626dc5f74857b1f54"
},
"nodes": [
{
"id": "4ea39a4f-d8c1-438f-9738-bfbb906a3d7a",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1200,
1020
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Send customer feedback to OpenAI for sentiment analysis"
},
"typeVersion": 1
},
{
"id": "6962ea41-7d15-4932-919f-21ac94fa1269",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1960,
1180
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Add new feedback to google sheets"
},
"typeVersion": 1
},
{
"id": "4c8a8984-2d8e-4139-866b-6f3536aced07",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
1600
],
"parameters": {
"width": 1407,
"height": 254,
"content": "## Instructions\n1. Connect Google sheets\n2. Connect your OpenAi account (api key + org Id)\n3. Create a customer feedback form, use an existing one or use the one below as example. \nAll set!\n\n\n- Here is the example google sheet being used in this workflow: https://docs.google.com/spreadsheets/d/1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4/edit?usp=sharing. You can download it to your account."
},
"typeVersion": 1
},
{
"id": "d43a9574-626d-4817-87ba-d99bdd6f41dc",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
800,
1160
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Feedback form is submitted"
},
"typeVersion": 1
},
{
"id": "76dab2dc-935f-416e-91aa-5a1b7017ec1b",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
1180
],
"parameters": {
"width": 253,
"height": 342,
"content": "## Merge form data and OpenAI result"
},
"typeVersion": 1
},
{
"id": "9772eac1-8df2-4305-9b2c-265d3c5a9a4a",
"name": "Add customer feedback to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
2020,
1320
],
"parameters": {
"columns": {
"value": {
"Category": "={{ $json['What is your feedback about?'] }}",
"Sentiment": "={{ $json.text }}",
"Timestamp": "={{ $json.submittedAt }}",
"Entered by": "=Form",
"Customer Name": "={{ $json.Name }}",
"Customer contact": "={{ $json['How do we get in touch with you?'] }}",
"Customer Feedback": "={{ $json['Your feedback'] }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Category",
"type": "string",
"display": true,
"required": false,
"displayName": "Category",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Customer Feedback",
"type": "string",
"display": true,
"required": false,
"displayName": "Customer Feedback",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Customer Name",
"type": "string",
"display": true,
"required": false,
"displayName": "Customer Name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Customer contact",
"type": "string",
"display": true,
"required": false,
"displayName": "Customer contact",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Entered by",
"type": "string",
"display": true,
"required": false,
"displayName": "Entered by",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Urgent?",
"type": "string",
"display": true,
"required": false,
"displayName": "Urgent?",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Sentiment",
"type": "string",
"display": true,
"required": false,
"displayName": "Sentiment",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": []
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1omWdRbiT6z6GNZ6JClu9gEsRhPQ6J0EJ2yXyFH9Zng4/edit?usp=drivesdk",
"cachedResultName": "CustomerFeedback"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "3",
"name": "Google Sheets account"
}
},
"typeVersion": 4.1
},
{
"id": "12084971-c81b-4a0e-814e-120867562642",
"name": "Merge sentiment with form content",
"type": "n8n-nodes-base.merge",
"position": [
1680,
1320
],
"parameters": {
"mode": "combine",
"options": {},
"combinationMode": "multiplex"
},
"typeVersion": 2.1
},
{
"id": "235edf5b-7724-4712-8dc5-d8327a0620b8",
"name": "Classify feedback with OpenAI",
"type": "n8n-nodes-base.openAi",
"position": [
1280,
1180
],
"parameters": {
"prompt": "=Classify the sentiment in the following customer feedback: {{ $json['Your feedback'] }}",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "s2iucY0IctjYNbrb",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "af4b22aa-0925-40b1-a9ac-298f9745a98e",
"name": "Submit form with customer feedback",
"type": "n8n-nodes-base.formTrigger",
"position": [
860,
1340
],
"webhookId": "e7bf682e-48e8-40de-9815-cd180cdd1480",
"parameters": {
"options": {
"formSubmittedText": "Your response has been recorded"
},
"formTitle": "Customer Feedback",
"formFields": {
"values": [
{
"fieldLabel": "Name",
"requiredField": true
},
{
"fieldType": "dropdown",
"fieldLabel": "What is your feedback about?",
"fieldOptions": {
"values": [
{
"option": "Product"
},
{
"option": "Service"
},
{
"option": "Other"
}
]
},
"requiredField": true
},
{
"fieldType": "textarea",
"fieldLabel": "Your feedback",
"requiredField": true
},
{
"fieldLabel": "How do we get in touch with you?"
}
]
},
"formDescription": "Please give feedback about our company orproducts."
},
"typeVersion": 1
}
],
"connections": {
"Classify feedback with OpenAI": {
"main": [
[
{
"node": "Merge sentiment with form content",
"type": "main",
"index": 0
}
]
]
},
"Merge sentiment with form content": {
"main": [
[
{
"node": "Add customer feedback to Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Submit form with customer feedback": {
"main": [
[
{
"node": "Classify feedback with OpenAI",
"type": "main",
"index": 0
},
{
"node": "Merge sentiment with form content",
"type": "main",
"index": 1
}
]
]
}
}
}

View File

@@ -0,0 +1,367 @@
{
"id": "8FLJK1NsduFL0Y5P",
"meta": {
"instanceId": "fb924c73af8f703905bc09c9ee8076f48c17b596ed05b18c0ff86915ef8a7c4a"
},
"name": "Qualify new leads in Google Sheets via OpenAI's GPT-4",
"tags": [
{
"id": "y9tvM3hISJKT2jeo",
"name": "Ted's Tech Talks",
"createdAt": "2023-08-15T22:12:34.260Z",
"updatedAt": "2023-08-15T22:12:34.260Z"
}
],
"nodes": [
{
"id": "1f179325-0bec-4e5c-8ebd-0a2bb3ebefaa",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
1440,
340
],
"parameters": {
"mode": "combine",
"options": {},
"combinationMode": "mergeByPosition"
},
"typeVersion": 2.1
},
{
"id": "7b548661-2b32-451f-ba52-91ca86728f1e",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
358,
136.3642172523962
],
"parameters": {
"width": 442,
"height": 360.6357827476038,
"content": "### 1. Create a Google Sheet document\n* This template uses Google Sheet document connected to Google Forms, but a standalone Sheet document will work too\n* Adapt initial trigger to your needs: check for new entries periodically or add a manual trigger\n\n[Link to the Google Sheet template](https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs)"
},
"typeVersion": 1
},
{
"id": "308b4dce-4656-47bd-b217-69565b1c34f6",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
820,
420
],
"parameters": {
"width": 471,
"height": 322,
"content": "### 2. Provide lead qualification instructions\n* Create a __system message__ with overall instructions\n* Add a __user message__ with the JSON variables\n* Set node parses the resulting JSON object, but you can also request a plain string response in the system message"
},
"typeVersion": 1
},
{
"id": "c00442ca-98cf-4296-b084-f0881ce4fd39",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1320,
222.18785942492013
],
"parameters": {
"width": 355,
"height": 269.81214057507987,
"content": "### 3. Combine the initial data with GPT response\n* This Merge node puts together original records from the google sheet and responses from the OpenAI"
},
"typeVersion": 1
},
{
"id": "62643a4c-a69c-4351-9960-20413285ff33",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1700,
220
],
"parameters": {
"width": 398,
"height": 265,
"content": "### 4. Update the Google Sheet document\n* Provide __Column to Match On__ (usually a timestamp in case of Google Forms)\n* Enter the result from GPT into a separate column"
},
"typeVersion": 1
},
{
"id": "4cd58340-81c4-46c7-b346-25a9b6ef2910",
"name": "Update lead status",
"type": "n8n-nodes-base.googleSheets",
"position": [
1860,
340
],
"parameters": {
"columns": {
"value": {
"Rating": "={{ $json.reply.rating }}",
"Timestamp": "={{ $json.Timestamp }}"
},
"schema": [
{
"id": "Timestamp",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Timestamp",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Email Address",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Email Address",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Your name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Your name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Your business area",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Your business area",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Your team size",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "Your team size",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Rating",
"type": "string",
"display": true,
"required": false,
"displayName": "Rating",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "row_number",
"type": "string",
"display": true,
"removed": true,
"readOnly": true,
"required": false,
"displayName": "row_number",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"Timestamp"
]
},
"options": {},
"operation": "update",
"sheetName": {
"__rl": true,
"mode": "list",
"value": 72739218,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit#gid=72739218",
"cachedResultName": "Form Responses 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit?usp=drivesdk",
"cachedResultName": "Join Community (Responses)"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "RtRiRezoxiWkzZQt",
"name": "Ted's Tech Talks Google account"
}
},
"typeVersion": 4.2
},
{
"id": "fea0acee-13b6-441a-8cf9-c8fedbc4617d",
"name": "Extract JSON reply",
"type": "n8n-nodes-base.set",
"position": [
1120,
580
],
"parameters": {
"fields": {
"values": [
{
"name": "reply",
"type": "objectValue",
"objectValue": "={{ JSON.parse($json.message.content) }}"
}
]
},
"include": "selected",
"options": {}
},
"typeVersion": 3.2
},
{
"id": "0a0608fe-894f-4eb5-b690-233c6dfc0428",
"name": "Qualify leads with GPT",
"type": "n8n-nodes-base.openAi",
"position": [
900,
580
],
"parameters": {
"prompt": {
"messages": [
{
"role": "system",
"content": "Your task is to qualify incoming leads. Leads are form submissions to a closed community group. Use the following criteria for a quality lead:\n\n1. We are looking for decision makers who run companies or who have some teams. The bigger the team - the better. Basically, everyone with some level of responsibility should be accepted. This is the main criterion.\n2. Email from a non-standard domain. Ideally this should be a corporate domain, but this is a secondary criterion.\n\nPlease thing step by step whether a lead is quality or not?\n\nIf at least one of the criteria satisfy, reply with \"qualified\" in response. Otherwise reply \"not qualified\". Reply with a JSON of the following structure: {\"rating\":\"string\",\"explanation\":\"string\"}. Reply only with with the JSON and nothing more!"
},
{
"content": "=Here's a lead info:\nName: {{ $json['Your name'] }}\nEmail: {{ $json['Email Address'] }}\nBusiness area: {{ $json['Your business area'] }}\nSize of the team: {{ $json['Your team size'] }}"
}
]
},
"options": {
"temperature": 0.3
},
"resource": "chat",
"chatModel": "gpt-4-turbo-preview"
},
"credentials": {
"openAiApi": {
"id": "rveqdSfp7pCRON1T",
"name": "Ted's Tech Talks OpenAi"
}
},
"typeVersion": 1.1
},
{
"id": "22fdec69-a4a9-430d-9950-79195799ae7a",
"name": "Check for new entries",
"type": "n8n-nodes-base.googleSheetsTrigger",
"position": [
520,
340
],
"parameters": {
"event": "rowAdded",
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"sheetName": {
"__rl": true,
"mode": "list",
"value": 72739218,
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit#gid=72739218",
"cachedResultName": "Form Responses 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jk8ZbfOMObvHGGImc0sBJTZB_hracO4jRqfbryMgzEs/edit?usp=drivesdk",
"cachedResultName": "Join Community (Responses)"
}
},
"credentials": {
"googleSheetsTriggerOAuth2Api": {
"id": "m33qCYf9eEvSgo0x",
"name": "Ted's Tech Talks Google Sheets Trigger"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"executionOrder": "v1",
"saveManualExecutions": true,
"saveExecutionProgress": true,
"saveDataSuccessExecution": "all"
},
"versionId": "ffad0998-1a6b-469d-9297-6d7fd88387b9",
"connections": {
"Merge": {
"main": [
[
{
"node": "Update lead status",
"type": "main",
"index": 0
}
]
]
},
"Extract JSON reply": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Check for new entries": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 0
},
{
"node": "Qualify leads with GPT",
"type": "main",
"index": 0
}
]
]
},
"Qualify leads with GPT": {
"main": [
[
{
"node": "Extract JSON reply",
"type": "main",
"index": 0
}
]
]
}
}
}

View File

@@ -0,0 +1,522 @@
{
"id": "177",
"meta": {
"instanceId": "dfdeafd1c3ed2ee08eeab8c2fa0c3f522066931ed8138ccd35dc20a1e69decd3"
},
"name": "Telegram AI-bot",
"tags": [
{
"id": "15",
"name": "tutorial",
"createdAt": "2022-10-04T20:07:25.607Z",
"updatedAt": "2022-10-04T20:07:25.607Z"
}
],
"nodes": [
{
"id": "ea71a467-a646-4aca-b72e-cef1249c74e2",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
20,
340
],
"webhookId": "51942fbb-ca0e-4ec4-9423-5fcc7d3c4281",
"parameters": {
"updates": [
"*"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "1cbe43d4-ea8b-4178-bc10-4bfad7abe143",
"name": "CheckCommand",
"type": "n8n-nodes-base.switch",
"position": [
980,
360
],
"parameters": {
"rules": {
"rules": [
{
"value2": "/",
"operation": "notStartsWith"
},
{
"output": 1,
"value2": "/start",
"operation": "startsWith"
},
{
"output": 2,
"value2": "=/image ",
"operation": "startsWith"
}
]
},
"value1": "={{ $json.message?.text }}",
"dataType": "string",
"fallbackOutput": 3
},
"typeVersion": 1
},
{
"id": "074e907f-634b-4242-b669-33fa064f8472",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
1600,
581.661764705882
],
"parameters": {
"width": 316.1071428571428,
"height": 231.22373949579838,
"content": "## Error fallback for unsupported commands"
},
"typeVersion": 1
},
{
"id": "2aa961b8-f0af-4d5c-a6af-1be56ea4b2e6",
"name": "Settings",
"type": "n8n-nodes-base.set",
"position": [
380,
340
],
"parameters": {
"values": {
"number": [
{
"name": "model_temperature",
"value": 0.8
},
{
"name": "token_length",
"value": 500
}
],
"string": [
{
"name": "system_command",
"value": "=You are a friendly chatbot. User name is {{ $json?.message?.from?.first_name }}. User system language is {{ $json?.message?.from?.language_code }}. First, detect user text language. Next, provide your reply in the same language. Include several suitable emojis in your answer."
},
{
"name": "bot_typing",
"value": "={{ $json?.message?.text.startsWith('/image') ? \"upload_photo\" : \"typing\" }}"
}
]
},
"options": {}
},
"typeVersion": 2
},
{
"id": "2d2fe268-1e3e-483b-847c-4412e586c1ca",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1240,
-240
],
"parameters": {
"width": 330.5019024637719,
"height": 233,
"content": "## Chatbot mode by default\n### (when no command is provided)"
},
"typeVersion": 1
},
{
"id": "09a9c0b4-ac6e-46eb-b2e0-ef2b55e94ada",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
1240,
20
],
"parameters": {
"width": 330.7863484403046,
"height": 219.892857142857,
"content": "## Welcome message\n### /start"
},
"typeVersion": 1
},
{
"id": "088cffee-5720-488b-a4ec-cfdccbf77e75",
"name": "Chat_mode",
"type": "n8n-nodes-base.openAi",
"position": [
1340,
-160
],
"parameters": {
"model": "gpt-4",
"prompt": {
"messages": [
{
"role": "system",
"content": "={{ $json.system_command }}"
},
{
"content": "={{ $json.message.text }}"
}
]
},
"options": {
"maxTokens": "={{ $json.token_length }}",
"temperature": "={{ $json.model_temperature }}"
},
"resource": "chat"
},
"credentials": {
"openAiApi": {
"id": "63",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "41248697-6474-4a8f-a8b8-038c96465948",
"name": "Greeting",
"type": "n8n-nodes-base.openAi",
"position": [
1340,
80
],
"parameters": {
"prompt": {
"messages": [
{
"role": "system",
"content": "={{ $json.system_command }}"
},
{
"content": "=This is the first message from a user. Please welcome a new user in `{{ $json.message.from.language_code }}` language"
}
]
},
"options": {
"maxTokens": "={{ $json.token_length }}",
"temperature": "={{ $json.model_temperature }}"
},
"resource": "chat"
},
"credentials": {
"openAiApi": {
"id": "63",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "20c2e7fa-5d65-441b-8d1d-a8d46c624964",
"name": "Text reply",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
-40
],
"parameters": {
"text": "={{ $json.message.content }}",
"chatId": "={{ $('Settings').first().json.message.from.id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "30321276-ebe1-41ac-b420-9dab8daa405b",
"name": "Send Typing action",
"type": "n8n-nodes-base.telegram",
"position": [
580,
480
],
"parameters": {
"action": "={{ $json.bot_typing }}",
"chatId": "={{ $json.message.from.id }}",
"operation": "sendChatAction"
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "7d7ff2e8-b0ca-4638-a056-f7b4e2e6273d",
"name": "Merge",
"type": "n8n-nodes-base.merge",
"position": [
800,
360
],
"parameters": {
"mode": "chooseBranch"
},
"typeVersion": 2.1
},
{
"id": "656bab5e-b7f7-47a1-8e75-4a17d2070290",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1240,
280
],
"parameters": {
"width": 329.7428571428562,
"height": 233.8785714285713,
"content": "## Create an image\n### /image + request"
},
"typeVersion": 1
},
{
"id": "ca2111d2-463a-4ef0-9436-ee09598dbf07",
"name": "Create an image",
"type": "n8n-nodes-base.openAi",
"position": [
1340,
360
],
"parameters": {
"prompt": "={{ $json.message.text.split(' ').slice(1).join(' ') }}",
"options": {
"n": 1,
"size": "512x512"
},
"resource": "image",
"responseFormat": "imageUrl"
},
"credentials": {
"openAiApi": {
"id": "63",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "e91d616b-1d5e-40e8-8468-2d0b2dda4cf7",
"name": "Send error message",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
660
],
"parameters": {
"text": "=Sorry, {{ $json.message.from.first_name }}! This command is not supported yet. Please type some text to a chat bot or try this command:\n/image \\[your prompt]\n\nEnter the command, then space and provide your request. Example:\n\n`/image a picture or a cute little kitten with big eyes. Miyazaki studio ghibli style`",
"chatId": "={{ $json.message.from.id }}",
"additionalFields": {
"parse_mode": "Markdown"
}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "125e27d2-b03b-4f02-9dd1-8fc81ecf0b6b",
"name": "Send image",
"type": "n8n-nodes-base.telegram",
"position": [
1700,
360
],
"parameters": {
"file": "={{ $json.url }}",
"chatId": "={{ $('Settings').first().json.message.from.id }}",
"operation": "sendPhoto",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"id": "70",
"name": "Telegram bot"
}
},
"typeVersion": 1
},
{
"id": "730a51ac-223e-4956-be7f-166eadb6ed81",
"name": "PreProcessing",
"type": "n8n-nodes-base.set",
"position": [
200,
340
],
"parameters": {
"values": {
"string": [
{
"name": "message.text",
"value": "={{ $json?.message?.text || \"\" }}"
}
]
},
"options": {
"dotNotation": true
}
},
"typeVersion": 2
}
],
"active": true,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"saveManualExecutions": true,
"saveDataSuccessExecution": "all"
},
"versionId": "6ab99e3f-845d-42cc-847b-37cf19a72e93",
"connections": {
"Merge": {
"main": [
[
{
"node": "CheckCommand",
"type": "main",
"index": 0
}
]
]
},
"Greeting": {
"main": [
[
{
"node": "Text reply",
"type": "main",
"index": 0
}
]
]
},
"Settings": {
"main": [
[
{
"node": "Send Typing action",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"Chat_mode": {
"main": [
[
{
"node": "Text reply",
"type": "main",
"index": 0
}
]
]
},
"CheckCommand": {
"main": [
[
{
"node": "Chat_mode",
"type": "main",
"index": 0
}
],
[
{
"node": "Greeting",
"type": "main",
"index": 0
}
],
[
{
"node": "Create an image",
"type": "main",
"index": 0
}
],
[
{
"node": "Send error message",
"type": "main",
"index": 0
}
]
]
},
"PreProcessing": {
"main": [
[
{
"node": "Settings",
"type": "main",
"index": 0
}
]
]
},
"Create an image": {
"main": [
[
{
"node": "Send image",
"type": "main",
"index": 0
}
]
]
},
"Telegram Trigger": {
"main": [
[
{
"node": "PreProcessing",
"type": "main",
"index": 0
}
]
]
},
"Send Typing action": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
}
}
}