The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Tutor de Matem\u00e1ticas (con Anonimizaci\u00f3n)",
"nodes": [
{
"parameters": {
"path": "tutor-math",
"httpMethod": "POST"
},
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
250,
500
]
},
{
"parameters": {
"url": "={{'http://backend:8000/api/students/' + $json.body.student_id}}",
"options": {}
},
"name": "Obtener Datos Estudiante",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
450,
500
]
},
{
"parameters": {
"url": "={{'http://backend:8000/api/conversations/' + $json.body.student_id}}",
"options": {
"ignoreStatusCodes": [
404
]
}
},
"name": "Obtener Historial",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
650,
500
]
},
{
"parameters": {
"javascriptCode": "const student = $getNode('Obtener Datos Estudiante').json;\nconst history = $getNode('Obtener Historial').json[0] ? $getNode('Obtener Historial').json[0].messages : [];\nconst newMessage = { role: 'user', content: $json.body.message };\n\nconst studentName = `${student.first_name} ${student.last_name}`;\nconst placeholder = '[ESTUDIANTE]';\n\nconst anonymize = (text) => text.replace(new RegExp(studentName, 'gi'), placeholder);\n\nconst anonymizedHistory = history.map(msg => ({ ...msg, content: anonymize(msg.content) }));\nconst anonymizedNewMessage = { ...newMessage, content: anonymize(newMessage.content) };\n\nreturn {\n anonymizedHistory,\n anonymizedNewMessage,\n studentName,\n placeholder\n};"
},
"name": "Anonimizar Conversaci\u00f3n",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
850,
500
]
},
{
"parameters": {
"model": "gpt-4-turbo",
"messages": {
"json": "={{[{ 'role': 'system', 'content': 'Eres un tutor de matem\u00e1ticas amigable y experto... Tu placeholder para el nombre del estudiante es [ESTUDIANTE].' }, ...$node['Anonimizar Conversaci\u00f3n'].json.anonymizedHistory, $node['Anonimizar Conversaci\u00f3n'].json.anonymizedNewMessage]}}"
}
},
"name": "OpenAI Chat",
"type": "n8n-nodes-base.openAiChat",
"typeVersion": 1,
"position": [
1050,
500
],
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"javascriptCode": "const assistantResponse = $getNode('OpenAI Chat').json.choices[0].message.content;\nconst { studentName, placeholder } = $getNode('Anonimizar Conversaci\u00f3n').json;\n\nconst deanonymizedResponse = assistantResponse.replace(new RegExp(placeholder.replace(/[\\[\\]]/g, '\\\\$&'), 'gi'), studentName);\n\nreturn {\n role: 'assistant',\n content: deanonymizedResponse\n};"
},
"name": "De-anonimizar Respuesta",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
1250,
500
]
},
{
"parameters": {
"url": "={{$node['Obtener Historial'].json[0] ? 'http://backend:8000/api/conversations/' + $node['Obtener Historial'].json[0].id : 'http://backend:8000/api/conversations/'}}",
"method": "={{$node['Obtener Historial'].json[0] ? 'PUT' : 'POST'}}",
"bodyParameters": {
"json": "={{$node['Obtener Historial'].json[0] ? [ ...$node['Obtener Historial'].json[0].messages, { role: 'user', content: $json.body.message }, $node['De-anonimizar Respuesta'].json ] : { 'student_id': $json.body.student_id, 'tutor_type': 'Matem\u00e1ticas', 'messages': [ { role: 'user', content: $json.body.message }, $node['De-anonimizar Respuesta'].json ] } }}"
},
"options": {}
},
"name": "Guardar Conversaci\u00f3n",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 2,
"position": [
1450,
500
]
},
{
"parameters": {
"body": "={{$node['De-anonimizar Respuesta'].json.content}}",
"options": {}
},
"name": "Responder al Webhook",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1650,
500
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Obtener Datos Estudiante",
"type": "main",
"index": 0
}
]
]
},
"Obtener Datos Estudiante": {
"main": [
[
{
"node": "Obtener Historial",
"type": "main",
"index": 0
}
]
]
},
"Obtener Historial": {
"main": [
[
{
"node": "Anonimizar Conversaci\u00f3n",
"type": "main",
"index": 0
}
]
]
},
"Anonimizar Conversaci\u00f3n": {
"main": [
[
{
"node": "OpenAI Chat",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat": {
"main": [
[
{
"node": "De-anonimizar Respuesta",
"type": "main",
"index": 0
}
]
]
},
"De-anonimizar Respuesta": {
"main": [
[
{
"node": "Guardar Conversaci\u00f3n",
"type": "main",
"index": 0
}
]
]
},
"Guardar Conversaci\u00f3n": {
"main": [
[
{
"node": "Responder al Webhook",
"type": "main",
"index": 0
}
]
]
}
},
"active": true,
"settings": {},
"id": "2"
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Tutor de Matemáticas (con Anonimización). Uses httpRequest, openAiChat. Webhook trigger; 8 nodes.
Source: https://github.com/dretureta/POC_Tutor_Virtual/blob/9afb8d480df5b0b8b143329cfde5838e495f13dc/n8n-workflows/tutor-matematicas.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Tutor de Lengua (con Anonimización). Uses httpRequest, openAiChat. Webhook trigger; 8 nodes.
BaseLinker Product Automation - Full Sanitized Workflow. Uses googleGemini, editImage, httpRequest, discord. Webhook trigger; 89 nodes.
This workflow captures new leads via webhook, enriches and scores them with Apollo and Google Gemini, logs everything in Google Sheets, and automates outreach, reply handling, follow-ups, meeting prep
This powerful n8n automation workflow is designed to execute advanced B2B lead enrichment and hyper-personalization for cold email outreach. By orchestrating a complex chain of data scraping, AI analy
Propulsar — Content Engine v3. Uses openAi, httpRequest, googleSheets. Webhook trigger; 73 nodes.