This workflow follows the HTTP Request → Postgres recipe pattern — see all workflows that pair these two integrations.
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 →
{
"nodes": [
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $('Webhook1').first().json.body.payload.image }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "3076478d-8ccf-4809-97cd-eb81fb02adaf",
"name": "Hay Foto?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-11120,
47232
]
},
{
"parameters": {
"jsCode": "\nconst msg = $node[\"Variables\"].json.mensaje_original || \"\";\n\nfunction extract(regex, defaultVal = \"\") {\n const match = msg.match(regex);\n return (match && match[1]) ? match[1].trim() : defaultVal;\n}\n\n// Regex more robust as suggested by user\nconst diagnostico = extract(/Diagn[o\u00f3]stico:[ ]*([^\\n\\r-]+)/i, msg);\nconst actividades = extract(/Acci[o\u00f3]n realizada:[ ]*([^\\n\\r-]+)/i, \"Ver diagn\u00f3stico\");\nconst hi_str = extract(/HI:[ ]*([^\\n\\r-]+)/i, \"\");\nconst hf_str = extract(/HF:[ ]*([^\\n\\r-]+)/i, \"\");\nconst observaciones = extract(/Observa[cv]iones:[ ]*([^\\n\\r-]+)/i, \"Ninguna\");\nconst uf = extract(/UF:[ ]*([^\\n\\r-]+)/i, \"N/A\");\n\nreturn {\n diagnostico,\n actividades,\n hi_str,\n hf_str,\n observaciones,\n uf\n};\n"
},
"id": "13d83f16-cfef-4de3-91f0-5f545dc1350c",
"name": "Parsear Bloque Cierre",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
-11344,
48272
]
},
{
"parameters": {
"resource": "message",
"operation": "downloadMedia",
"phoneOrGroupId": "={{ $node[\"Variables\"].json.telefono.replace('=', '') }}@s.whatsapp.net",
"messageId": "={{ $('Webhook1').item.json.body.payload.id }}"
},
"id": "d5a82aa5-3f61-4445-ac2a-af4c8d0e4921",
"name": "Descargar Foto (GOWA)",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10896,
47136
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'CERRANDO:' || split_part(status, ':', 2) || ':BLOQUE' WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "4980bc30-7871-40f5-913d-43bdfc42c07f",
"name": "Set -> BLOQUE",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11120,
49008
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE callcenter_solicitudticket \nSET \n fecha_actividades = ((to_date('{{ $node[\"Variables\"].json.mensaje_original }}', \\'DD/MM/YYYY\\') + (fecha_actividades::time)) AT TIME ZONE \\'America/Tegucigalpa\\'),\n fecha_cierre = ((to_date('{{ $node[\"Variables\"].json.mensaje_original }}', \\'DD/MM/YYYY\\') + (fecha_cierre::time)) AT TIME ZONE \\'America/Tegucigalpa\\')\nWHERE folio = split_part((SELECT status FROM bot_sessions WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}'), ':', 2);",
"options": {}
},
"id": "7f854b9e-50b1-4d36-8602-461f160b0ee8",
"name": "Actualizar Fecha Manual",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10896,
48704
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"Variables\"].json.mensaje_original.toLowerCase().trim() }}",
"rules": {
"rules": [
{
"value2": "si"
},
{
"value2": "no",
"output": 1
}
]
},
"fallbackOutput": 1
},
"id": "d540528a-cbfd-43f3-bbea-369ca3a860da",
"name": "Switch -> Rpta Hora?",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11344,
48896
]
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"Variables\"].json.mensaje_original.toLowerCase().trim() }}",
"rules": {
"rules": [
{
"value2": "si"
}
]
},
"fallbackOutput": 1
},
"id": "07da3a4e-a7f8-49ec-b6c8-84be97e8e185",
"name": "Switch -> Rpta Fecha?",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11120,
48592
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'CERRANDO:' || split_part(status, ':', 2) || ':FOTO' WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "d26d4cdc-01bf-4690-83e8-e48926e08faa",
"name": "Set -> FOTO",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10672,
48592
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\u26a0\ufe0f \u00a1Atenci\u00f3n! La hora de inicio es posterior a la hora de cierre. \u00bfEst\u00e1n bien las fechas?\n\nResponde *SI* si es correcto (ej: turno nocturno), o *NO* para volver a enviar el bloque corrigi\u00e9ndolo."
},
"id": "773b45e7-44f5-4115-be82-d8dc13c92b85",
"name": "Msg Conf Hora",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10448,
48208
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'CERRANDO:' || split_part(status, ':', 2) || ':CONF_HORA' WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "3071a84e-af77-4be2-9e25-26f60b23d1c5",
"name": "Set -> CONF_HORA",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10672,
48096
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\ud83d\udcc5 He detectado que solo introdujiste la hora. Usar\u00e9 la fecha de hoy por defecto. \u00bfEst\u00e1s de acuerdo?\n\nResponde *SI* para aceptar, o escribe la fecha correcta (ej: 16/03/2026)."
},
"id": "aa41ea43-7cae-4090-800e-becba99db494",
"name": "Msg Conf Fecha",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10448,
48400
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'CERRANDO:' || split_part(status, ':', 2) || ':CONF_FECHA' WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "7994c615-4a60-4e25-a9f7-79b711859b74",
"name": "Set -> CONF_FECHA",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10672,
48288
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"dataType": "boolean",
"value1": "={{ $json.es_negativo }}",
"rules": {
"rules": [
{
"value2": true,
"output": 1
}
]
},
"fallbackOutput": "={{ $json.hi_sin_fecha || $json.hf_sin_fecha ? 2 : 0 }}"
},
"id": "fffdfc52-0130-4c59-ba12-ace83e630091",
"name": "Switch -> Validar Bloque",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-10896,
48240
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "=\u2705 Ticket *{{ $json.folio }}* cerrado con \u00e9xito.\nAqu\u00ed tienes tu Comprobante en formato PDF: {{ $json.url }} \n\u00a1Gracias!"
},
"id": "76422482-a043-47b9-835e-015591d63d12",
"name": "Enviar Documento PDF",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-9936,
47536
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"url": "=http://kgogwsw00cwcw8g0wk0gsogg.10.30.1.11.sslip.io/callcenter/api/ticket/{{ $node[\"-> Obtener Estado\"].json.status.split(':')[1] }}/pdf/",
"options": {}
},
"id": "ca976bf2-8978-4806-9099-25657a4fd5ee",
"name": "Generar PDF (Django)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
-10448,
47808
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\u231b Ticket cerrado exitosamente. Estamos generando tu comprobante PDF..."
},
"id": "1f0dfc91-163f-45dc-9d58-937818b987f1",
"name": "Msg Cierre Final",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10672,
47712
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\ud83d\uded1 Operaci\u00f3n cancelada. El ticket no se cerr\u00f3.\nEscribe *menu* para volver."
},
"id": "e3e689e7-88c6-4e7f-b7bc-21b7084bb3b7",
"name": "Msg Abortado",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10672,
47904
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions \nSET status = 'IDLE', last_update = NOW()\nWHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "b4da79d9-04d8-436f-96e9-92aece20df24",
"name": "Abortar e IDLE",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10896,
47904
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions \nSET status = 'IDLE', last_update = NOW()\nWHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';\n\nUPDATE callcenter_solicitudticket\nSET fecha_cierre = COALESCE(fecha_cierre, NOW())\nWHERE folio = '{{ $node[\"-> Obtener Estado\"].json.status.split(':')[1] }}';",
"options": {}
},
"id": "c443b1a1-0d37-437e-8fb6-c9d24d9db0b8",
"name": "Cerrar e IDLE",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10896,
47712
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"Variables\"].json.mensaje_limpio }}",
"rules": {
"rules": [
{
"value2": "si"
},
{
"value2": "no",
"output": 1
}
]
},
"fallbackOutput": 0
},
"id": "0f244633-ba11-44d7-83b0-c3288d5f899e",
"name": "Switch -> Si / No Cierre",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11120,
47776
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "Perfecto.\n\nEscribe *SI* para confirmar el cierre del ticket y generar el PDF, o *NO* para abortar."
},
"id": "7e9962f7-52ec-40a0-9348-be8c4448d980",
"name": "Pide Confirmaci\u00f3n",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10448,
47616
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions \nSET status = 'CERRANDO:{{ $node[\"-> Obtener Estado\"].json.status.split(':')[1] }}:CONFIRMAR' \nWHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "31e38bb0-65bd-4bbb-bf30-54dedd0ca3bd",
"name": "Set -> Confirmar",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10672,
47520
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"method": "POST",
"url": "=http://kgogwsw00cwcw8g0wk0gsogg.10.30.1.11.sslip.io/callcenter/api/ticket/{{ $node[\"-> Obtener Estado\"].json.status.split(':')[1] }}/upload_evidencia/",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "file",
"inputDataFieldName": "data"
}
]
},
"options": {}
},
"id": "13f59652-9803-4271-aaeb-502620adf409",
"name": "Subir Foto (Django)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
-10448,
47136
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "OK, foto/documento recibido. \u00bfA\u00f1adir\u00e1s algo m\u00e1s? (sino, env\u00eda *Listo*)"
},
"id": "107222a3-3388-4586-a14b-3e995df66cdc",
"name": "Mensaje Recibiendo Doc",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10224,
47136
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $node[\"Variables\"].json.mensaje_limpio }}",
"value2": "listo"
}
]
}
},
"id": "4ec0f581-1057-48e9-84b5-292240eb3a4d",
"name": "IF -> Escribi\u00f3 Listo?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-10896,
47424
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\ud83d\udcf8 Adicionalmente, por favor *env\u00eda imagen(es)* como evidencia.\n\nCuando hayas enviado todo, o si no vas a enviar imagen, responde con la palabra *Listo*."
},
"id": "dacdbe5a-c967-43d5-8266-9fad6c1d11bc",
"name": "Msg Foto",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10448,
47424
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions \nSET status = 'CERRANDO:' || split_part(status, ':', 2) || ':VALIDANDO' \nWHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';\n\nUPDATE callcenter_solicitudticket \nSET \n diagnostico = $${{ $node[\"Parsear Bloque Cierre\"].json.diagnostico }}$$,\n actividades = $${{ $node[\"Parsear Bloque Cierre\"].json.actividades }}$$,\n cierre_enviado = True, -- Marcamos que ya se notific\u00f3 el cierre\n fecha_actividades = COALESCE(\n -- Caso 1: Se extrajo fecha y hora del texto HI (Hora Inicio)\n ((to_date(substring($${{ $node[\"Parsear Bloque Cierre\"].json.hi_str }}$$ from '([0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4})'), 'DD/MM/YYYY') + \n COALESCE(NULLIF(TRIM(substring($${{ $node[\"Parsear Bloque Cierre\"].json.hi_str }}$$ from '([0-9]{1,2}:[0-9]{2}[ ]*[a-zA-Z]*)')), '')::time, '00:00'::time)) AT TIME ZONE 'America/Tegucigalpa'),\n -- Caso 2: Solo hora detectada, usamos fecha local de hoy\n ((CURRENT_DATE + NULLIF(TRIM(substring($${{ $node[\"Parsear Bloque Cierre\"].json.hi_str }}$$ from '([0-9]{1,2}:[0-9]{2}[ ]*[a-zA-Z]*)')), '')::time) AT TIME ZONE 'America/Tegucigalpa'),\n fecha_actividades\n ),\n fecha_cierre = COALESCE(\n -- Caso 1: Se extrajo fecha y hora del texto HF (Hora Fin)\n ((to_date(substring($${{ $node[\"Parsear Bloque Cierre\"].json.hf_str }}$$ from '([0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4})'), 'DD/MM/YYYY') + \n COALESCE(NULLIF(TRIM(substring($${{ $node[\"Parsear Bloque Cierre\"].json.hf_str }}$$ from '([0-9]{1,2}:[0-9]{2}[ ]*[a-zA-Z]*)')), '')::time, '00:00'::time)) AT TIME ZONE 'America/Tegucigalpa'),\n -- Caso 2: Solo hora detectada, usamos fecha local de hoy\n ((CURRENT_DATE + NULLIF(TRIM(substring($${{ $node[\"Parsear Bloque Cierre\"].json.hf_str }}$$ from '([0-9]{1,2}:[0-9]{2}[ ]*[a-zA-Z]*)')), '')::time) AT TIME ZONE 'America/Tegucigalpa'),\n fecha_cierre\n ),\n observaciones = $${{ $node[\"Parsear Bloque Cierre\"].json.observaciones }}$$ || ' | UF: ' || $${{ $node[\"Parsear Bloque Cierre\"].json.uf }}$$\nWHERE folio = split_part((SELECT status FROM bot_sessions WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}'), ':', 2)\nRETURNING \n (fecha_cierre < fecha_actividades) as es_negativo,\n ($${{ $node[\"Parsear Bloque Cierre\"].json.hi_str }}$$ NOT LIKE '%/%') as hi_sin_fecha,\n ($${{ $node[\"Parsear Bloque Cierre\"].json.hf_str }}$$ NOT LIKE '%/%') as hf_sin_fecha;\n",
"options": {}
},
"id": "92bc8453-b6e3-47b3-a972-1e4df00eae90",
"name": "Procesar Bloque Cierre",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11120,
48272
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"-> Obtener Estado\"].json.status.split(':')[2] }}",
"rules": {
"rules": [
{
"value2": "FIN"
},
{
"value2": "OBS",
"output": 1
},
{
"value2": "FOTO",
"output": 2
},
{
"value2": "CONFIRMAR",
"output": 3
},
{
"value2": "VALIDANDO",
"output": 2
}
]
},
"fallbackOutput": 2
},
"id": "98cf3b56-cbce-4029-bcfa-2d82ce10b6d6",
"name": "Switch -> Cierre 2",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11344,
47232
]
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"-> Obtener Estado\"].json.status.split(':')[2] }}",
"rules": {
"rules": [
{
"value2": "BLOQUE"
},
{
"value2": "DIAGNOSTICO"
},
{
"value2": "ACCION"
},
{
"value2": "INICIO"
},
{
"value2": "CONF_FECHA",
"output": 2
},
{
"value2": "CONF_HORA",
"output": 3
}
]
},
"fallbackOutput": 1
},
"id": "7510f30e-20f0-4f6c-8036-79789d4d8933",
"name": "Switch -> Cierre 1",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11568,
48160
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "==\ud83c\udfab *DETALLES DEL TICKET*\n----------------------------------------\n\ud83d\udccc *Folio:* {{ $node[\"Validar Folio a Cerrar\"].json.folio || $node[\"Validar Folio a Cerrar\"].json.id_solicitud }}\n\ud83d\udcdd *Descripci\u00f3n:* {{ $node[\"Validar Folio a Cerrar\"].json.solicitud_descripcion || 'Sin descripci\u00f3n' }}\n\u26a0\ufe0f *Falla:* {{ $node[\"Validar Folio a Cerrar\"].json.falla_descripcion || 'Sin descripci\u00f3n' }}\n\ud83d\udcc5 *Fecha de Solicitud:* {{ $node[\"Validar Folio a Cerrar\"].json.fecha_solicitud.toDateTime().setZone('America/Tegucigalpa').toFormat('dd/MM/yyyy HH:mm') }}\n\ud83d\udccd *Ubicaci\u00f3n:* {{ $node[\"Validar Folio a Cerrar\"].json.area || 'N/A' }}\n\ud83c\udfe2 *Grupo (Torre):* {{ $node[\"Validar Folio a Cerrar\"].json.nivel || 'N/A' }}\n\ud83d\udd22 *Nivel (Piso):* {{ $node[\"Validar Folio a Cerrar\"].json.grupo || 'N/A' }}\n\ud83e\udde9 *UF:* {{ $node[\"Validar Folio a Cerrar\"].json.unidad || 'N/A' }}\n\ud83d\udc64 *Solicitante:* {{ $node[\"Validar Folio a Cerrar\"].json.solicitante || 'N/A' }}\n\n----------------------------------------\n\u2705 *EST\u00c1S A PUNTO DE CERRAR EL TICKET*\n\nPor favor, responde enviando la informaci\u00f3n con el siguiente formato exacto (puedes copiar y editar):\n----------------------------------------\nDiagn\u00f3stico: Cu\u00e1l es el diagnostico encontrado\nAcci\u00f3n realizada: qu\u00e9 acciones realiz\u00f3 para cerrar la solicitud\nHI: {{ $node[\"Validar Folio a Cerrar\"].json.fecha_solicitud.toDateTime().setZone('America/Tegucigalpa').toFormat('dd/MM/yyyy HH:mm') }}\nHF: {{ $now.setZone('America/Tegucigalpa').toFormat('dd/MM/yyyy HH:mm') }}\nObservaciones: Si no hay Ninguna"
},
"id": "b8277522-f9c6-4cb8-9110-ec6d8dcd49ea",
"name": "Pedir Bloque Cierre",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10896,
46944
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'CERRANDO:' || COALESCE('{{ $json.folio }}', CAST('{{ $json.id_solicitud }}' AS TEXT)) || ':BLOQUE' WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "5559c11c-93be-43eb-8e7c-968bbaaa23fa",
"name": "Set -> Esperar Bloque",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11120,
46944
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\u26a0\ufe0f El folio no existe.\nIntenta de nuevo o escribe *menu*."
},
"id": "e0272ae6-a11f-4f43-b88f-920fb8239087",
"name": "Error Folio",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-11120,
46752
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.id_solicitud }}",
"operation": "isEmpty"
}
]
}
},
"id": "bc0d4b52-3a09-4af5-a989-746754359070",
"name": "IF -> No Existe Folio?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-11344,
46848
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT * FROM callcenter_solicitudticket\nWHERE folio = '{{ $node[\"Variables\"].json.mensaje_original.trim() }}'\nOR CAST(id_solicitud AS TEXT) = '{{ $node[\"Variables\"].json.mensaje_original.trim() }}'\nLIMIT 1;",
"options": {}
},
"id": "a91098e5-b2b3-4708-a825-5a4163bcb9cb",
"name": "Validar Folio a Cerrar",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11568,
46848
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "=\ud83c\udfab *Ticket {{ $json.folio || $json.id_solicitud }}*\n\ud83d\udcdd *Descripci\u00f3n:* {{ $json.solicitud_descripcion || 'Sin descripci\u00f3n' }}\n*Responsable:* {{ $json.responsable || 'N/A' }}\n*Falla:* {{ $json.falla_descripcion || 'Sin descripci\u00f3n' }}\n*Ubicaci\u00f3n:* {{ $json.area || 'N/A' }}\n*Grupo (Torre):* {{ $json.nivel || 'N/A' }}\n*Nivel (Piso):* {{ $json.grupo || 'N/A' }}\n*UF:* {{ $json.unidad || 'N/A' }}\n\nEscribe *menu* para volver.\n"
},
"id": "94fa607b-600c-4c8e-ac4e-4c3f36c87475",
"name": "Enviar Info Ticket",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-11120,
46560
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\u26a0\ufe0f No encontramos ning\u00fan ticket.\nEscribe *menu* para volver."
},
"id": "aa76e859-72a2-4539-b16c-3a2cf6c4195f",
"name": "Error Consulta",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-11120,
46368
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.id_solicitud }}",
"operation": "isEmpty"
}
]
}
},
"id": "f641eab2-9b35-434c-95d4-b6e8c26f04e7",
"name": "IF -> No encontrado? (Consulta)",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-11344,
46464
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT * FROM callcenter_solicitudticket\nWHERE folio = '{{ $node[\"Variables\"].json.mensaje_original }}'\nOR CAST(id_solicitud AS TEXT) = '{{ $node[\"Variables\"].json.mensaje_original }}'\nLIMIT 1;",
"options": {}
},
"id": "12f51feb-e9ff-476b-839b-861754743e4f",
"name": "Buscar Ticket",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11568,
46464
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\ud83d\udd12 Has elegido Cerrar Ticket.\nPor favor, ingresa el *Folio* exacto del ticket que deseas cerrar:"
},
"id": "376dd137-00d7-470b-8879-0e02b3ead990",
"name": "Pedir Folio Cierre",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10896,
46144
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'ESPERANDO_CIERRE', last_update = NOW() WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "8d3d8142-27d0-4953-bd71-45286282df93",
"name": "Set -> ESPERAR_CIERRE",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11120,
45968
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\ud83d\udd0d Has elegido Consultar.\nPor favor, escribe el *Folio* o *N\u00famero* del ticket a consultar:"
},
"id": "ad674640-dc82-4202-8748-6c8e63307366",
"name": "Pedir Folio Consulta",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10896,
45952
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "UPDATE bot_sessions SET status = 'ESPERANDO_CONSULTA', last_update = NOW() WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}';",
"options": {}
},
"id": "58e725ee-0e00-47c0-a81d-93bfa8d6897c",
"name": "Set -> ESPERAR_CONSULTA",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11120,
45776
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ $json.body.payload.is_from_me }}"
}
],
"string": [
{
"value1": "={{ $json.body.event }}",
"value2": "message"
}
]
},
"combineOperation": "any"
},
"id": "98fd24d3-eea7-4413-839a-93c2c9505781",
"name": "Filtro Anti-Loop1",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-12960,
45920
]
},
{
"parameters": {
"httpMethod": "POST",
"path": "whatsapp",
"options": {}
},
"id": "8b3953be-74f0-4c81-94d4-94e743811bc9",
"name": "Webhook1",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
-13520,
45872
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\u26a0\ufe0f Opci\u00f3n no v\u00e1lida. Por favor escribe *1* o *2*, o *menu* para volver."
},
"id": "8ae3d884-45a0-4daf-b2c2-5b3ac7f9b285",
"name": "Opcion Invalida",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-11120,
45584
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"Variables\"].json.mensaje_limpio }}",
"rules": {
"rules": [
{
"value2": "1",
"output": 1
},
{
"value2": "2",
"output": 2
},
{
"value2": "3",
"output": 3
}
]
},
"fallbackOutput": 0
},
"id": "39e0967a-b9f0-48b6-a79c-36f6bc7479a6",
"name": "Switch -> Opci\u00f3n Men\u00fa",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11344,
45760
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\ud83d\udc4b *Men\u00fa Principal*\n\n1\ufe0f\u20e3 Consultar Ticket\n2\ufe0f\u20e3 Cerrar Ticket\n3\ufe0f\u20e3 Mis tickets pendientes de cierre \ud83d\udcc2\n\n_Escribe el n\u00famero de la opci\u00f3n:_"
},
"id": "85384505-0cd0-4768-b7fc-1f871167f6fd",
"name": "Enviar Men\u00fa",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-11120,
46176
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO bot_sessions (phone_number, status, last_update)\nVALUES ('{{ $node[\"Variables\"].json.telefono }}', 'IDLE', NOW())\nON CONFLICT (phone_number) DO UPDATE SET status = 'IDLE', last_update = NOW();",
"options": {}
},
"id": "e2db900e-a1f9-451b-90a7-25ad1be6e951",
"name": "Reset -> IDLE",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-11344,
46176
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $node[\"Variables\"].json.mensaje_limpio }}",
"rules": {
"rules": [
{
"value2": "hola",
"output": 1
},
{
"value2": "menu",
"output": 1
}
]
},
"fallbackOutput": 0
},
"id": "f8edf902-1bfe-4eac-a568-7b0da83077d8",
"name": "Comando Inicio?",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11568,
45760
]
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $json.status.split(':')[0].toUpperCase() }}",
"rules": {
"rules": [
{
"value2": "IDLE"
},
{
"value2": "ESPERANDO_CONSULTA",
"output": 1
},
{
"value2": "ESPERANDO_CIERRE",
"output": 2
},
{
"value2": "CERRANDO",
"output": 3
}
]
},
"fallbackOutput": 0
},
"id": "a75ce465-0a97-48ae-8a5f-cdbfc8d74535",
"name": "Switch -> Estado",
"type": "n8n-nodes-base.switch",
"typeVersion": 1,
"position": [
-11792,
46400
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "\u2705 Tu conversaci\u00f3n ha sido reiniciada.\n\nEscribe *hola* o *menu* cuando desees volver a empezar. \u00a1Adi\u00f3s! \ud83d\udc4b"
},
"id": "7283a191-b980-43a8-bc66-28d2899360e3",
"name": "Enviar Despedida",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-10672,
45696
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "INSERT INTO bot_sessions (phone_number, status, last_update)\nVALUES ('{{ $node[\"Variables\"].json.telefono }}', 'IDLE', NOW())\nON CONFLICT (phone_number) DO UPDATE SET status = 'IDLE', last_update = NOW();",
"options": {}
},
"id": "cb87baa7-f035-4758-a3b8-58a4515f52e1",
"name": "Reset -> IDLE (Adios)",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10896,
45696
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"boolean": [
{
"value1": "={{ ['adios','salir','cancelar'].includes($node[\"Variables\"].json.mensaje_limpio.replace('\u00f3', 'o')) }}",
"value2": true
}
]
}
},
"id": "8a05994a-76a2-43ad-9489-f18ffbdde9b8",
"name": "IF -> Adios?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-12016,
45984
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT COALESCE((SELECT status FROM bot_sessions WHERE phone_number = '{{ $node[\"Variables\"].json.telefono }}'), 'IDLE') as status;",
"options": {}
},
"id": "a25c5d0d-f72f-408b-9e6e-c75b195d9adf",
"name": "-> Obtener Estado",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-12240,
45984
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "Buenos d\u00edas, Usted no tiene los permisos para comunicarse con SoftCoM-CCG"
},
"id": "b611793a-a121-4d15-afca-fddd75e6aa75",
"name": "Mensaje Sin Permisos",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-12240,
45792
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.nombre }}",
"operation": "isNotEmpty"
}
]
}
},
"id": "69444afe-2245-4a8e-a2fe-b8490ee57e9a",
"name": "IF -> Usuario Existe?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
-12464,
45888
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT TRIM(U.first_name || ' ' || U.last_name) AS nombre\nFROM auth_user U\nJOIN core_perfilusuario P ON U.id = P.usuario_id\nWHERE P.telefono = '{{ $node[\"Variables\"].json.telefono }}'\nLIMIT 1;",
"options": {}
},
"id": "9d826afb-d4dd-4bde-a355-e3b3842144d1",
"name": "Verificar Usuario",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-12688,
45888
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"values": {
"string": [
{
"name": "telefono",
"value": "={{ String($json.body?.payload?.from || $json.body?.from || '').split('@')[0] }}"
},
{
"name": "mensaje_limpio",
"value": "={{ String($json.body?.payload?.body || $json.body?.body || $json.body?.message || '').toLowerCase().trim() }}"
},
{
"name": "mensaje_original",
"value": "={{ String($json.body?.payload?.body || $json.body?.body || $json.body?.message || '').trim() }}"
},
{
"name": "media_id",
"value": "={{ $json.body?.payload?.id || $json.body?.id || $json.body?.payload?.mediaId || $json.body?.mediaId || \"\" }}"
},
{
"name": "chat_id",
"value": "={{ $json.body.payload.chat_id }}"
}
],
"boolean": [
{
"name": "fromMe",
"value": "=={{ $json.body?.payload?.is_from_me === true || $json.body?.payload?.fromMe === true || $json.body?.is_from_me === true }}"
},
{
"name": "es_grupo",
"value": "={{ ($json.body.payload.chat_id || \"\").endsWith('@g.us') }}"
}
]
},
"options": {}
},
"id": "63db3bf5-f387-4fa9-a84a-818e66df906d",
"name": "Variables",
"type": "n8n-nodes-base.set",
"typeVersion": 1,
"position": [
-13312,
45888
]
},
{
"parameters": {
"url": "=http://gowa-zgs0oo8k4wgos884ckw8osow.10.30.1.11.sslip.io:3030/{{ $node[\"Descargar Foto (GOWA)\"].json.results.file_path }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-10672,
47136
],
"id": "27ab4752-e1de-403a-bf17-df9c9990d1a8",
"name": "HTTP Request"
},
{
"parameters": {
"method": "POST",
"url": "https://ce675e3ed2704594af019ed8d7d5f6.d7.environment.api.powerplatform.com:443/powerautomate/automations/direct/workflows/6260ff428abe4f88b4cd96fae4614a57/triggers/manual/paths/invoke?api-version=1&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=IMrCwJsG1SsgYIYDKimFGYRkvxBFlg0MYpJWURimsLk",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"folio\": \"{{ $node[\"Consultar Todo el Ticket\"].json.folio || $node[\"Consultar Todo el Ticket\"].json.id_solicitud }}\",\n \"solicitante\": \"{{ $node[\"Consultar Todo el Ticket\"].json.solicitante || 'N/A' }}\",\n \"descripcion_original\": \"{{ ($node[\"Consultar Todo el Ticket\"].json.solicitud_descripcion || 'N/A').toString().replace(/\\n/g, ' ') }}\",\n \"falla\":\"\" ,\n \"clasificacion_falla\":\"\" ,\n \"servicio\": \"\",\n \"ubicacion\": \"{{ $node[\"Consultar Todo el Ticket\"].json.area || 'N/A' }}\",\n \"grupo_torre\": \"{{ $node[\"Consultar Todo el Ticket\"].json.nivel || 'N/A' }}\",\n \"nivel_piso\": \"{{ $node[\"Consultar Todo el Ticket\"].json.grupo || 'N/A' }}\",\n \"unidad_funcional\": \"{{ $node[\"Consultar Todo el Ticket\"].json.unidad || 'N/A' }}\",\n \n\"fecha_apertura\": \"{{ $node[\"Consultar Todo el Ticket\"].json.fecha_solicitud ? $node[\"Consultar Todo el Ticket\"].json.fecha_solicitud.toDateTime().setZone('America/Tegucigalpa').toFormat('dd/MM/yyyy HH:mm:ss') : 'N/A' }}\",\n \"fecha_cierre\": \"{{ $node[\"Consultar Todo el Ticket\"].json.fecha_cierre ? $node[\"Consultar Todo el Ticket\"].json.fecha_cierre.toDateTime().setZone('America/Tegucigalpa').toFormat('dd/MM/yyyy HH:mm:ss') : 'N/A' }}\",\n \n \"diagnostico\": \"{{ ($node[\"Consultar Todo el Ticket\"].json.diagnostico || 'N/A').toString().replace(/\\n/g, ' ') }}\",\n \"actividades\": \"{{ ($node[\"Consultar Todo el Ticket\"].json.actividades || 'N/A').toString().replace(/\\n/g, ' ') }}\",\n \"observaciones\": \"{{ ($node[\"Consultar Todo el Ticket\"].json.observaciones || 'N/A').toString().replace(/\\n/g, ' ') }}\",\n \"pdf_url\": \"{{ $('Generar PDF (Django)').first().json.url }}\",\n \"tiempo_total_min\": {{ $('Generar PDF (Django)').first().json.tiempo_total || 0 }},\n \"cerrado_por_nombre\": \"{{ $node[\"Verificar Usuario\"].json.nombre || 'Sistema' }}\",\n \"telefono_usuario\": \"{{ $node[\"Variables\"].json.telefono }}\",\n \"email_usuario\": \"{{ $node[\"Obtener Email\"].json.email || 'N/A' }}\"\n}\n",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.4,
"position": [
-9776,
48000
],
"id": "00e998a4-47bc-4420-8be4-4eca2eb153df",
"name": "HTTP Request1",
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT * FROM callcenter_solicitudticket \nWHERE folio = '{{ $node[\"-> Obtener Estado\"].json.status.split(\":\")[1] }}' \nOR CAST(id_solicitud AS TEXT) = '{{ $node[\"-> Obtener Estado\"].json.status.split(\":\")[1] }}'\nLIMIT 1;",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-10224,
48000
],
"id": "df69225e-65fb-460c-9f33-bf6150dca139",
"name": "Consultar Todo el Ticket",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT u.email \nFROM auth_user u\nJOIN core_perfilusuario p ON u.id = p.usuario_id\nWHERE p.telefono = '{{ $node[\"Variables\"].json.telefono }}'\nLIMIT 1;\n",
"options": {}
},
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.6,
"position": [
-10000,
48000
],
"id": "85c4f67e-96f6-4d52-a6c8-b527df308ddd",
"name": "Obtener Email",
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT t.folio, t.solicitud_descripcion, t.fecha_solicitud\nFROM callcenter_solicitudticket t\nJOIN core_perfilusuario p ON t.usuario_responsable_id = p.usuario_id\nWHERE p.telefono = '{{ $node[\"Variables\"].json.telefono }}'\nAND t.fecha_cierre IS NULL\nORDER BY t.fecha_solicitud ASC;",
"options": {}
},
"id": "4e02d3b9-d45e-49eb-814c-c409088f298b",
"name": "Consultar Pendientes",
"type": "n8n-nodes-base.postgres",
"typeVersion": 2.2,
"position": [
-10208,
45920
],
"credentials": {
"postgres": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"jsCode": "const tickets = $input.all();\n\nif (tickets.length === 0 || !tickets[0].json.folio) {\n return { \n mensaje: \"\ud83d\udcc2 No tienes tickets pendientes de cierre asignados a tu usuario. \u00a1Buen trabajo! \u2705\"\n };\n}\n\nlet msg = \"\ud83d\udcc2 *TUS TICKETS PENDIENTES*\\n\";\nmsg += \"------------------------------------\\n\";\n\ntickets.forEach(t => {\n const fecha = new Date(t.json.fecha_solicitud).toLocaleDateString('es-HN');\n msg += \"\ud83d\udccc *\" + t.json.folio + \"*\\n\";\n msg += \"\ud83d\udcdd \" + (t.json.solicitud_descripcion || 'Sin descripci\u00f3n').substring(0, 60) + \"...\\n\";\n msg += \"\ud83d\udcc5 \" + fecha + \"\\n\\n\";\n});\n\nmsg += \"------------------------------------\\n\";\nmsg += \"_Escribe el *Folio* para cerrarlo o *menu* para volver._\";\n\nreturn { mensaje: msg };"
},
"id": "7c965252-6a89-47d9-9a3e-3a420aea686e",
"name": "Formatear Lista",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
-9984,
45920
]
},
{
"parameters": {
"phoneNumber": "={{ $node[\"Variables\"].json.telefono }}",
"message": "={{ $json.mensaje }}"
},
"id": "825aca8a-dec2-4b0e-92e5-f7920dc6ff3f",
"name": "Enviar Lista GOWA",
"type": "@aldinokemal2104/n8n-nodes-gowa.gowa",
"typeVersion": 1,
"position": [
-9760,
45920
],
"credentials": {
"goWhatsappApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Hay Foto?": {
"main": [
[
{
"node": "Descargar Foto (GOWA)",
"type": "main",
"index": 0
}
],
[
{
"node": "IF -> Escribi\u00f3 Listo?",
"type": "main",
"index": 0
}
]
]
},
"Parsear Bloque Cierre": {
"main": [
[
{
"node": "Procesar Bloque Cierre",
"type": "main",
"index": 0
}
]
]
},
"Descargar Foto (GOWA)": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Set -> BLOQUE": {
"main": [
[
{
"node": "Pedir Bloque Cierre",
"type": "main",
"index": 0
}
]
]
},
"Actualizar Fecha Manual": {
"main": [
[
{
"node": "Set -> FOTO",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Rpta Hora?": {
"main": [
[
{
"node": "Set -> FOTO",
"type": "main",
"index": 0
}
],
[
{
"node": "Set -> BLOQUE",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Rpta Fecha?": {
"main": [
[
{
"node": "Set -> FOTO",
"type": "main",
"index": 0
}
],
[
{
"node": "Actualizar Fecha Manual",
"type": "main",
"index": 0
}
]
]
},
"Set -> FOTO": {
"main": [
[
{
"node": "Msg Foto",
"type": "main",
"index": 0
}
]
]
},
"Set -> CONF_HORA": {
"main": [
[
{
"node": "Msg Conf Hora",
"type": "main",
"index": 0
}
]
]
},
"Set -> CONF_FECHA": {
"main": [
[
{
"node": "Msg Conf Fecha",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Validar Bloque": {
"main": [
[
{
"node": "Set -> FOTO",
"type": "main",
"index": 0
}
],
[
{
"node": "Set -> CONF_HORA",
"type": "main",
"index": 0
}
],
[
{
"node": "Set -> CONF_FECHA",
"type": "main",
"index": 0
}
]
]
},
"Generar PDF (Django)": {
"main": [
[
{
"node": "Enviar Documento PDF",
"type": "main",
"index": 0
},
{
"node": "Consultar Todo el Ticket",
"type": "main",
"index": 0
}
]
]
},
"Msg Cierre Final": {
"main": [
[
{
"node": "Generar PDF (Django)",
"type": "main",
"index": 0
}
]
]
},
"Abortar e IDLE": {
"main": [
[
{
"node": "Msg Abortado",
"type": "main",
"index": 0
}
]
]
},
"Cerrar e IDLE": {
"main": [
[
{
"node": "Msg Cierre Final",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Si / No Cierre": {
"main": [
[
{
"node": "Cerrar e IDLE",
"type": "main",
"index": 0
}
],
[
{
"node": "Abortar e IDLE",
"type": "main",
"index": 0
}
]
]
},
"Set -> Confirmar": {
"main": [
[
{
"node": "Pide Confirmaci\u00f3n",
"type": "main",
"index": 0
}
]
]
},
"Subir Foto (Django)": {
"main": [
[
{
"node": "Mensaje Recibiendo Doc",
"type": "main",
"index": 0
}
]
]
},
"IF -> Escribi\u00f3 Listo?": {
"main": [
[
{
"node": "Set -> Confirmar",
"type": "main",
"index": 0
}
],
[
{
"node": "Msg Foto",
"type": "main",
"index": 0
}
]
]
},
"Procesar Bloque Cierre": {
"main": [
[
{
"node": "Switch -> Validar Bloque",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Cierre 2": {
"main": [
[],
[],
[
{
"node": "Hay Foto?",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch -> Si / No Cierre",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Cierre 1": {
"main": [
[
{
"node": "Parsear Bloque Cierre",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch -> Cierre 2",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch -> Rpta Fecha?",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch -> Rpta Hora?",
"type": "main",
"index": 0
}
]
]
},
"Set -> Esperar Bloque": {
"main": [
[
{
"node": "Pedir Bloque Cierre",
"type": "main",
"index": 0
}
]
]
},
"Error Folio": {
"main": [
[
{
"node": "Reset -> IDLE (Adios)",
"type": "main",
"index": 0
}
]
]
},
"IF -> No Existe Folio?": {
"main": [
[
{
"node": "Error Folio",
"type": "main",
"index": 0
}
],
[
{
"node": "Set -> Esperar Bloque",
"type": "main",
"index": 0
}
]
]
},
"Validar Folio a Cerrar": {
"main": [
[
{
"node": "IF -> No Existe Folio?",
"type": "main",
"index": 0
}
]
]
},
"Enviar Info Ticket": {
"main": [
[
{
"node": "Reset -> IDLE (Adios)",
"type": "main",
"index": 0
}
]
]
},
"Error Consulta": {
"main": [
[
{
"node": "Reset -> IDLE (Adios)",
"type": "main",
"index": 0
}
]
]
},
"IF -> No encontrado? (Consulta)": {
"main": [
[
{
"node": "Error Consulta",
"type": "main",
"index": 0
}
],
[
{
"node": "Enviar Info Ticket",
"type": "main",
"index": 0
}
]
]
},
"Buscar Ticket": {
"main": [
[
{
"node": "IF -> No encontrado? (Consulta)",
"type": "main",
"index": 0
}
]
]
},
"Set -> ESPERAR_CIERRE": {
"main": [
[
{
"node": "Pedir Folio Cierre",
"type": "main",
"index": 0
}
]
]
},
"Set -> ESPERAR_CONSULTA": {
"main": [
[
{
"node": "Pedir Folio Consulta",
"type": "main",
"index": 0
}
]
]
},
"Filtro Anti-Loop1": {
"main": [
[
{
"node": "Verificar Usuario",
"type": "main",
"index": 0
}
]
]
},
"Webhook1": {
"main": [
[
{
"node": "Variables",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Opci\u00f3n Men\u00fa": {
"main": [
[
{
"node": "Opcion Invalida",
"type": "main",
"index": 0
}
],
[
{
"node": "Set -> ESPERAR_CONSULTA",
"type": "main",
"index": 0
}
],
[
{
"node": "Set -> ESPERAR_CIERRE",
"type": "main",
"index": 0
}
],
[
{
"node": "Consultar Pendientes",
"type": "main",
"index": 0
}
]
]
},
"Reset -> IDLE": {
"main": [
[
{
"node": "Enviar Men\u00fa",
"type": "main",
"index": 0
}
]
]
},
"Comando Inicio?": {
"main": [
[
{
"node": "Switch -> Opci\u00f3n Men\u00fa",
"type": "main",
"index": 0
}
],
[
{
"node": "Reset -> IDLE",
"type": "main",
"index": 0
}
]
]
},
"Switch -> Estado": {
"main": [
[
{
"node": "Comando Inicio?",
"type": "main",
"index": 0
}
],
[
{
"node": "Buscar Ticket",
"type": "main",
"index": 0
}
],
[
{
"node": "Validar Folio a Cerrar",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch -> Cierre 1",
"type": "main",
"index": 0
}
]
]
},
"Reset -> IDLE (Adios)": {
"main": [
[
{
"node": "Enviar Despedida",
"type": "main",
"index": 0
}
]
]
},
"IF -> Adios?": {
"main": [
[
{
"node": "Reset -> IDLE (Adios)",
"type": "main",
"index": 0
}
],
[
{
"node": "Switch -> Estado",
"type": "main",
"index": 0
}
]
]
},
"-> Obtener Estado": {
"main": [
[
{
"node": "IF -> Adios?",
"type": "main",
"index": 0
}
]
]
},
"IF -> Usuario Existe?": {
"main": [
[
{
"node": "-> Obtener Estado",
"type": "main",
"index": 0
}
],
[
{
"node": "Mensaje Sin Permisos",
"type": "main",
"index": 0
}
]
]
},
"Verificar Usuario": {
"main": [
[
{
"node": "IF -> Usuario Existe?",
"type": "main",
"index": 0
}
]
]
},
"Variables": {
"main": [
[
{
"node": "Filtro Anti-Loop1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Subir Foto (Django)",
"type": "main",
"index": 0
}
]
]
},
"Consultar Todo el Ticket": {
"main": [
[
{
"node": "Obtener Email",
"type": "main",
"index": 0
}
]
]
},
"Obtener Email": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"Consultar Pendientes": {
"main": [
[
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.
goWhatsappApihttpHeaderAuthpostgres
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Flujowhatsapp. Uses @aldinokemal2104/n8n-nodes-gowa, postgres, httpRequest. Webhook trigger; 65 nodes.
Source: https://github.com/sajaldi/energy/blob/a36dad82dad3e8dadb2e39cefb3c8c43e0bafe17/n8n/flujowhatsapp.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.
This workflow automates end-to-end research analysis by coordinating multiple AI models—including NVIDIA NIM (Llama), OpenAI GPT-4, and Claude to analyze uploaded documents, extract insights, and gene
Settings. Uses httpRequest, postgres, telegram. Webhook trigger; 38 nodes.
QA Platform — Jira Story to Test Workflow. Uses jiraTrigger, postgres, httpRequest, slack. Webhook trigger; 20 nodes.
Kids & Teen Networking - Atendimento e Agendamento WhatsApp. Uses httpRequest, postgres. Webhook trigger; 20 nodes.
Ban Claim Handler. Uses postgres, httpRequest, whatsApp, telegram. Webhook trigger; 20 nodes.