Skip to content

Instantly share code, notes, and snippets.

@leifermendez
Created January 16, 2025 19:03
Show Gist options
  • Save leifermendez/ef9bb68929467a32fcead84ddab82dd8 to your computer and use it in GitHub Desktop.
Save leifermendez/ef9bb68929467a32fcead84ddab82dd8 to your computer and use it in GitHub Desktop.
template-n8n-nocode-db.json
{
"name": "Gestionar Leads",
"nodes": [
{
"parameters": {
"authentication": "nocoDbApiToken",
"operation": "getAll",
"workspaceId": "w3ec7sio",
"projectId": "pu3qowvlwu121f9",
"table": "myexlxkv6mt86w9",
"returnAll": true,
"options": {}
},
"id": "9fdc3886-3e91-4541-878a-9da0873b7b2f",
"name": "[LIST] Leads1",
"type": "n8n-nodes-base.nocoDb",
"typeVersion": 3,
"position": [
800,
840
],
"alwaysOutputData": true,
"credentials": {
"nocoDbApiToken": {
"id": "VK2yFjsnlhttOkZM",
"name": "NocoDB Token account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "c6e11d23-8d8f-4d29-8c3c-957cea5c5121",
"leftValue": "={{ $('Webhook').item.json.body.phone }}",
"operator": {
"type": "string",
"operation": "exists",
"singleValue": true
},
"rightValue": "={{ $('Webhook').item.json.body.phone.toString() }}"
},
{
"id": "dc425e73-b583-4386-8d15-abab1266d64f",
"leftValue": "={{$('Filter').item.json.keys().length}}",
"rightValue": 0,
"operator": {
"type": "number",
"operation": "gt"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "2106efe0-9c85-4973-bdfe-3275b31ff069",
"name": "If1",
"type": "n8n-nodes-base.if",
"typeVersion": 2.1,
"position": [
1680,
840
],
"executeOnce": true,
"alwaysOutputData": false
},
{
"parameters": {
"authentication": "nocoDbApiToken",
"operation": "update",
"workspaceId": "w3ec7sio",
"projectId": "pu3qowvlwu121f9",
"table": "myexlxkv6mt86w9",
"fieldsUi": {
"fieldValues": [
{
"fieldName": "Id",
"fieldValue": "={{ $('Filter').item.json.Id }}"
},
{
"fieldName": "notifications",
"fieldValue": "0"
},
{
"fieldName": "summary",
"fieldValue": "={{ $('OpenAI').item.json.message.content }}"
},
{
"fieldName": "score",
"fieldValue": "={{ $('Score').item.json.message.content.replaceAll('-','').trim() }}"
}
]
}
},
"id": "6e020be3-ac4e-4cfd-b497-fc93d9438c4d",
"name": "NocoDB2",
"type": "n8n-nodes-base.nocoDb",
"typeVersion": 3,
"position": [
2080,
640
],
"credentials": {
"nocoDbApiToken": {
"id": "VK2yFjsnlhttOkZM",
"name": "NocoDB Token account"
}
}
},
{
"parameters": {
"authentication": "nocoDbApiToken",
"operation": "create",
"workspaceId": "w3ec7sio",
"projectId": "pu3qowvlwu121f9",
"table": "myexlxkv6mt86w9",
"fieldsUi": {
"fieldValues": [
{
"fieldName": "phone",
"fieldValue": "={{ $('Webhook').item.json.body.phone }}"
},
{
"fieldName": "summary",
"fieldValue": "={{ $('OpenAI').item.json.message.content }}"
},
{
"fieldName": "notifications",
"fieldValue": "0"
},
{
"fieldName": "name",
"fieldValue": "={{ $('Webhook').item.json.body.name }}"
},
{
"fieldName": "score",
"fieldValue": "={{ $json.message.content }}"
}
]
}
},
"id": "9cac762b-9fa7-4ca0-ad28-b0f6606810b1",
"name": "NocoDB3",
"type": "n8n-nodes-base.nocoDb",
"typeVersion": 3,
"position": [
2080,
940
],
"credentials": {
"nocoDbApiToken": {
"id": "VK2yFjsnlhttOkZM",
"name": "NocoDB Token account"
}
}
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "4463590d-59d2-49f0-9623-7ca7a0aa234b",
"leftValue": "={{ $json.phone }}",
"rightValue": "={{ $('Webhook').item.json.body.phone.toString() }}",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "59630922-e4f0-4fbc-b72c-b8b6efd89c8b",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"typeVersion": 2.1,
"position": [
1020,
840
],
"executeOnce": false,
"alwaysOutputData": true
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4",
"mode": "list",
"cachedResultName": "GPT-4"
},
"messages": {
"values": [
{
"content": "=Actua como un setter de ventas, y dame una lista de las prioridades del cliente basado en la conversacion.\n\n---- CONVERSACION ----\n\n{{ JSON.stringify($json.body.history) }}",
"role": "system"
}
]
},
"options": {}
},
"id": "4bd537f3-9386-42a3-86ad-f1b4e20de5a3",
"name": "OpenAI",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.4,
"position": [
360,
840
],
"credentials": {
"openAiApi": {
"id": "Fb429zp6KOtgui0Y",
"name": "OpenAi account"
}
}
},
{
"parameters": {
"httpMethod": "POST",
"path": "1f039635-b291-4310-a172-a2923e7a7647",
"responseMode": "lastNode",
"responseData": "allEntries",
"options": {}
},
"id": "704e0c08-b56a-4e23-9f73-59887ea56145",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
60,
840
],
"webhookId": "1f039635-b291-4310-a172-a2923e7a7647"
},
{
"parameters": {
"modelId": {
"__rl": true,
"value": "gpt-4o-mini",
"mode": "list",
"cachedResultName": "GPT-4O-MINI"
},
"messages": {
"values": [
{
"content": "=Tu proposito es calificar a este cliente basado en su historial de conversacionl solo debes responder\n- Perdido\n- Ganado\n- Recuperable\n\n{{ JSON.stringify($json.body.history) }}\n\nRespuesta:",
"role": "system"
}
]
},
"options": {}
},
"id": "1313f1f8-83f7-459c-98eb-ea2317d41f86",
"name": "Score",
"type": "@n8n/n8n-nodes-langchain.openAi",
"typeVersion": 1.4,
"position": [
1240,
840
],
"credentials": {
"openAiApi": {
"id": "Fb429zp6KOtgui0Y",
"name": "OpenAi account"
}
}
}
],
"pinData": {},
"connections": {
"[LIST] Leads1": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"If1": {
"main": [
[
{
"node": "NocoDB2",
"type": "main",
"index": 0
}
],
[
{
"node": "NocoDB3",
"type": "main",
"index": 0
}
]
]
},
"Filter": {
"main": [
[
{
"node": "Score",
"type": "main",
"index": 0
}
]
]
},
"OpenAI": {
"main": [
[
{
"node": "[LIST] Leads1",
"type": "main",
"index": 0
}
]
]
},
"Webhook": {
"main": [
[
{
"node": "OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Score": {
"main": [
[
{
"node": "If1",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {
"executionOrder": "v1"
},
"versionId": "26e65a0f-4f83-4d5c-bd1f-d62cd02fb1dd",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "d0f987951de7569035b031362d8fc78632c198138a90bb9d876ba12e7978466f"
},
"id": "aP0tXkjhiL8q169T",
"tags": [
{
"createdAt": "2024-09-22T19:11:07.207Z",
"updatedAt": "2024-09-22T19:11:07.207Z",
"id": "6jjXluY4ykzG1b4D",
"name": "leifer"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment