{
  "name": "z-Api",
  "nodes": [
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message_type }}",
                    "rightValue": "audio",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "f1f4f21d-7bac-4148-8fa5-eb91e67e3f5e"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "audio"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message_type }}",
                    "rightValue": "text",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "53ea1f96-c52a-4d1f-a00d-c0cafb1feb82"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "text"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message_type }}",
                    "rightValue": "image",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "b2b2b2b2-2222-3333-4444-555555555555"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "image"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message_type }}",
                    "rightValue": "button_response",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "c3c3c3c3-3333-4444-5555-666666666666"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "button"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -3584,
        536
      ],
      "id": "237866ff-421e-4a1e-a7f7-4a813555b9af",
      "name": "Message Type Router"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "credentials-object",
              "name": "credentials",
              "value": "={{ { \"z_api_token\": $json.headers['z-api-token'], \"instance_id\": $json.body.instanceId } }}",
              "type": "object"
            },
            {
              "id": "system-object",
              "name": "system",
              "value": "={{ { \"execution_mode\": $json.executionMode, \"webhook_url\": $json.webhookUrl, \"user_agent\": $json.headers['user-agent'], \"origin_server\": $json.headers.origin, \"client_ip\": $json.headers['x-real-ip'] } }}",
              "type": "object"
            },
            {
              "id": "user-object",
              "name": "user",
              "value": "={{ { \"sender_phone\": $json.body.phone, \"connected_phone\": $json.body.connectedPhone, \"chat_name\": $json.body.chatName, \"sender_name\": $json.body.senderName, \"chat_lid\": $json.body.chatLid } }}",
              "type": "object"
            },
            {
              "id": "message-type-detector",
              "name": "message_type",
              "value": "={{ $json.body.text ? 'text' : $json.body.audio ? 'audio' : $json.body.image ? 'image' : $json.body.buttonsResponseMessage ? ($json.body.buttonsResponseMessage.buttonId === 'confirmar_pedido' ? 'text' : 'button_response') : $json.body.document ? ($json.body.document.mimeType && $json.body.document.mimeType.startsWith('audio/') ? 'audio_file' : $json.body.document.mimeType && $json.body.document.mimeType.startsWith('video/') ? 'video' : 'document') : 'unknown' }}",
              "type": "string"
            },
            {
              "id": "message-object",
              "name": "message",
              "value": "={{ { \"message_id\": $json.body.messageId, \"timestamp\": $json.body.momment, \"formatted_date\": DateTime.fromMillis($json.body.momment).toFormat('yyyy-MM-dd HH:mm:ss'), \"formatted_date_utc_minus_5\": DateTime.fromMillis($json.body.momment).setZone('UTC-5').toFormat('yyyy-MM-dd HH:mm:ss'), \"message_status\": $json.body.status, \"message_type\": ($json.body.text ? 'text' : $json.body.audio ? 'audio' : $json.body.image ? 'image' : $json.body.buttonsResponseMessage ? ($json.body.buttonsResponseMessage.buttonId === 'confirmar_pedido' ? 'text' : 'button_response') : $json.body.document ? ($json.body.document.mimeType && $json.body.document.mimeType.startsWith('audio/') ? 'audio_file' : $json.body.document.mimeType && $json.body.document.mimeType.startsWith('video/') ? 'video' : 'document') : 'unknown') } }}",
              "type": "object"
            },
            {
              "id": "content-text",
              "name": "text_content",
              "value": "={{ $json.body.text ? { \"message\": $json.body.text.message } : ($json.body.buttonsResponseMessage && $json.body.buttonsResponseMessage.buttonId === 'confirmar_pedido') ? { \"message\": $json.body.buttonsResponseMessage.buttonId } : null }}",
              "type": "object"
            },
            {
              "id": "content-audio",
              "name": "audio_content",
              "value": "={{ $json.body.audio ? { \"audio_url\": $json.body.audio.audioUrl, \"duration_seconds\": $json.body.audio.seconds, \"mime_type\": $json.body.audio.mimeType, \"is_ptt\": $json.body.audio.ptt, \"view_once\": $json.body.audio.viewOnce, \"source\": 'audio_object' } : null }}",
              "type": "object"
            },
            {
              "id": "content-audio-file",
              "name": "audio_file_content",
              "value": "={{ ($json.body.document && $json.body.document.mimeType && $json.body.document.mimeType.startsWith('audio/')) ? { \"audio_url\": $json.body.document.documentUrl, \"file_name\": $json.body.document.fileName, \"mime_type\": $json.body.document.mimeType, \"caption\": $json.body.document.caption, \"title\": $json.body.document.title, \"source\": 'document_object' } : null }}",
              "type": "object"
            },
            {
              "id": "content-image",
              "name": "image_content",
              "value": "={{ $json.body.image ? { \"image_url\": $json.body.image.imageUrl, \"thumbnail_url\": $json.body.image.thumbnailUrl, \"caption\": $json.body.image.caption, \"mime_type\": $json.body.image.mimeType, \"view_once\": $json.body.image.viewOnce, \"width\": $json.body.image.width, \"height\": $json.body.image.height } : null }}",
              "type": "object"
            },
            {
              "id": "content-video",
              "name": "video_content",
              "value": "={{ ($json.body.document && $json.body.document.mimeType && $json.body.document.mimeType.startsWith('video/')) ? { \"video_url\": $json.body.document.documentUrl, \"file_name\": $json.body.document.fileName, \"mime_type\": $json.body.document.mimeType, \"caption\": $json.body.document.caption, \"title\": $json.body.document.title, \"source\": 'document_object' } : null }}",
              "type": "object"
            },
            {
              "id": "content-document",
              "name": "document_content",
              "value": "={{ ($json.body.document && (!$json.body.document.mimeType || (!$json.body.document.mimeType.startsWith('audio/') && !$json.body.document.mimeType.startsWith('video/')))) ? { \"document_url\": $json.body.document.documentUrl, \"file_name\": $json.body.document.fileName, \"title\": $json.body.document.title, \"caption\": $json.body.document.caption, \"mime_type\": $json.body.document.mimeType, \"page_count\": $json.body.document.pageCount } : null }}",
              "type": "object"
            },
            {
              "id": "content-button",
              "name": "button_content",
              "value": "={{ $json.body.buttonsResponseMessage ? { \"button_id\": $json.body.buttonsResponseMessage.buttonId, \"button_text\": $json.body.buttonsResponseMessage.message, \"button_response\": $json.body.buttonsResponseMessage.buttonId, \"display_text\": $json.body.buttonsResponseMessage.message } : null }}",
              "type": "object"
            },
            {
              "id": "flags-object",
              "name": "flags",
              "value": "={{ { \"from_me\": $json.body.fromMe, \"is_group\": $json.body.isGroup, \"is_newsletter\": $json.body.isNewsletter, \"is_forwarded\": $json.body.forwarded, \"is_broadcast\": $json.body.broadcast, \"callback_type\": $json.body.type, \"from_api\": $json.body.fromApi, \"is_status_reply\": $json.body.isStatusReply, \"is_edit\": $json.body.isEdit, \"waiting_message\": $json.body.waitingMessage, \"message_expiration_seconds\": $json.body.messageExpirationSeconds || 0 } }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -3808,
        568
      ],
      "id": "97428728-1387-4471-843e-d40e55342fb7",
      "name": "WhatsApp Message Parser"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "50a91089-2c34-4dd0-8896-2715bd6e9612",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -4032,
        568
      ],
      "id": "85279fb6-44eb-4c87-abb5-136d904bc9a1",
      "name": "Webhook"
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -3360,
        512
      ],
      "id": "71e6cd3a-354a-44b6-bd64-1571ca494420",
      "name": "Pausa"
    },
    {
      "parameters": {
        "url": "={{ $json.audio_content.audio_url }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -3360,
        320
      ],
      "id": "2c33c2f9-6e82-4439-b507-d7e39496a786",
      "name": "Download Audio File"
    },
    {
      "parameters": {
        "url": "={{ $json.image_content.image_url }}",
        "options": {
          "response": {
            "response": {
              "neverError": true,
              "responseFormat": "file"
            }
          }
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -3360,
        704
      ],
      "id": "a5b6fc55-745f-4c9d-9145-28625fb98d8a",
      "name": "Download Image File"
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "analyze",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "text": "# Instrucciones para Descripci\u00f3n de Imagen\nDescribe esta imagen en espa\u00f1ol.",
        "inputType": "base64",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -3136,
        704
      ],
      "id": "8ce13deb-86aa-4456-9bb9-82246ee5272a",
      "name": "Analyze Image",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "button-response-id",
              "name": "button_id",
              "value": "={{ $json.button_content.button_id }}",
              "type": "string"
            },
            {
              "id": "button-response-text",
              "name": "button_text",
              "value": "={{ $json.button_content.button_text || $json.button_content.display_text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -3360,
        1672
      ],
      "id": "73fabaf7-eecd-42bf-ba1e-51b7f974deea",
      "name": "Process Button Response"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "catalogo",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "catalog-button-condition"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Catalogo"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "ofertas",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "offers-button-condition"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Ofertas"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "comprar",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "buy-button-condition"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Comprar"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "pedido",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "order-button-condition"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Pedido"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "ca097790-b652-48d1-8181-c16fcef7a6bd",
                    "leftValue": "={{ ['contra_entrega', 'interrapidisimo'].includes($json.button_id) }}",
                    "rightValue": "contra_entrega",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Contra_Entrega"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "0aab0b48-271c-4b6d-85d1-4ae926a7829a",
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "transferencia",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Transferencia"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "e3943a52-8a51-413b-a5f2-89c394584dc5",
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "modificar_producto",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "modificar_producto"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "bae55070-387b-41d8-9c87-9b671231afb3",
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "modificar_pedido",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "modificar_pedido"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c6c49f16-27fd-4763-bde2-d5b388e27b6f",
                    "leftValue": "={{ $json.button_id }}",
                    "rightValue": "confirmar_pedido",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "confirmar_pedido"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -3136,
        1560
      ],
      "id": "37cd6414-4f3b-44ca-bd52-5b29894e1b11",
      "name": "Button Response Router"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {
          "language": "es",
          "temperature": 0
        }
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -3136,
        320
      ],
      "id": "f85b465d-d4f1-43f1-8e1c-f4dc7f72fe61",
      "name": "Transcribe a recording",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "23b785c3-f38e-4706-80b7-51f333bba3bd",
              "name": "mensaje",
              "type": "string",
              "value": "={{ $json.text || $json.content || $json.button_text || $json.button_id }}"
            }
          ]
        },
        "options": {}
      },
      "id": "d07f2b8c-1c2f-4413-bad5-e73ab873355e",
      "name": "Extract Message Content",
      "type": "n8n-nodes-base.set",
      "position": [
        -2912,
        512
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "d4b9efeb-9a68-43e3-bc4c-cd207510bddf",
              "name": "text",
              "value": "={{ $json.text_content.message }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -3136,
        512
      ],
      "id": "ea82046b-0cd4-49de-a2f7-c63b6fc52033",
      "name": "Obtener Texto"
    },
    {
      "parameters": {
        "operation": "push",
        "list": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}",
        "messageData": "={{ $json.mensaje }}",
        "tail": true
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -2688,
        512
      ],
      "id": "09f9a486-7671-4cdb-aac2-73b57d21e33c",
      "name": "Store Message in Buffer",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -2464,
        512
      ],
      "id": "b7de2491-d077-441b-be17-20e8afe58c45",
      "name": "Wait for Buffer"
    },
    {
      "parameters": {
        "operation": "get",
        "key": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}",
        "options": {}
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -2240,
        512
      ],
      "id": "27847417-324b-4cd7-932f-2bf97c2072d4",
      "name": "Retrieve Messages from Buffer",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "87d5a006-5e35-4dbf-a3dc-e5420b918845",
              "leftValue": "={{ $json.propertyName.last() }}",
              "rightValue": "={{ $('Extract Message Content').item.json.mensaje }}",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -2016,
        512
      ],
      "id": "a5e06155-a2f3-49b4-bf12-2afc4c23993e",
      "name": "Check for Duplicate Message"
    },
    {
      "parameters": {
        "operation": "delete",
        "key": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        -1792,
        328
      ],
      "id": "3eb73ad4-282a-4e09-b607-ce098b798512",
      "name": "Clear Buffer Cache",
      "credentials": {
        "redis": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        -1792,
        520
      ],
      "id": "7161aaac-7c78-4fe1-acd3-214f7033d134",
      "name": "Skip Duplicate Message"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f6459d32-0468-4e3c-8572-7b36e1fc2172",
              "name": "conversation_content",
              "value": "={{ $json.propertyName.join('\\n') }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -1568,
        328
      ],
      "id": "d5d5d181-6670-4d5d-a9b9-95967daaf732",
      "name": "Format Final Output"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT \n    '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}' as session_id,\n    CASE \n        WHEN NOT EXISTS (\n            SELECT 1 \n            FROM n8n_pro_conversation_states \n            WHERE session_id = '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}'\n        ) THEN false  -- No hay registros, no existe\n        WHEN EXISTS (\n            SELECT 1 \n            FROM n8n_pro_conversation_states \n            WHERE session_id = '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}'\n            AND ultima_actividad = (\n                SELECT MAX(ultima_actividad) \n                FROM n8n_pro_conversation_states \n                WHERE session_id = '{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}'\n            )\n            AND estado_actual = 'ventas' \n            AND estado_ventas = 'FIN'\n        ) THEN false  -- El m\u00e1s reciente est\u00e1 finalizado, no existe (crear nuevo)\n        ELSE true     -- En cualquier otro caso, existe\n    END as existe",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -1344,
        328
      ],
      "id": "48c96b6b-2886-4e8a-8d13-93a6db341cb2",
      "name": "Get session_id",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "7500bd18-477a-4fbe-b21d-ea6bbcc0a5d5",
              "leftValue": "={{ $json.existe }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -1120,
        328
      ],
      "id": "521c0fcd-6e0b-4d6a-ac20-31eb8bff8d7f",
      "name": "If"
    },
    {
      "parameters": {
        "jsCode": "// Obtener hora UTC y ajustarla a UTC-5\nconst ahora = new Date();\nconst horaUTC = ahora.getUTCHours();\nconst horaUTC5 = (horaUTC + 24 - 5) % 24;\n\n// Determinar per\u00edodo del d\u00eda\nlet periodo = '';\n\nif (horaUTC5 >= 5 && horaUTC5 < 12) {\n  periodo = 'ma\u00f1ana';\n} else if (horaUTC5 >= 12 && horaUTC5 < 18) {\n  periodo = 'tarde';\n} else {\n  periodo = 'noche';\n}\n\n// Retornar per\u00edodo junto con datos necesarios\nreturn [\n  {\n    json: {\n      periodo: periodo,\n      hora: horaUTC5,\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -2912,
        960
      ],
      "id": "c632ef10-86cc-4da7-9b0f-90b5775432ca",
      "name": "Dynamic Time Greeting"
    },
    {
      "parameters": {
        "jsCode": "const saludos = [\n`\ud83c\udf38 \u00a1Hola! Gracias por escribir a *Ed Perfumer\u00eda*  \nEstamos encantados de ayudarte a encontrar la fragancia ideal.`,\n\n`\ud83d\udcac \u00a1Bienvenido a *Ed Perfumer\u00eda*!  \nGracias por elegirnos para tu pr\u00f3xima compra de perfumes.`,\n\n`\ud83c\udf89 \u00a1Hola! Qu\u00e9 gusto tenerte en *Ed Perfumer\u00eda*  \nEstamos aqu\u00ed para ayudarte a encontrar tu aroma perfecto.`,\n\n`\ud83c\udf1f \u00a1Gracias por comunicarte con *Ed Perfumer\u00eda*!  \nNos alegra poder atenderte \ud83d\ude0a`,\n\n`\ud83d\ude80 \u00a1Hola y bienvenido a *Ed Perfumer\u00eda*!  \nEs un placer atenderte hoy \u2728`,\n\n`\ud83d\ude4c \u00a1Hola! Gracias por escribir a *Ed Perfumer\u00eda*  \nEstamos encantados de atenderte. \ud83d\udc90`,\n\n`\ud83d\udc4b \u00a1Bienvenid@ a *Ed Perfumer\u00eda*!  \nNos alegra recibir tu mensaje. \ud83d\udc96`,\n\n`\u2728 \u00a1Hola! Gracias por contactar a *Ed Perfumer\u00eda*  \nNos alegra mucho tenerte por aqu\u00ed \ud83d\ude0a`,\n\n`\ud83c\udf1f \u00a1Gracias por comunicarte con *Ed Perfumer\u00eda*!  \nEstamos aqu\u00ed para ayudarte a encontrar tu fragancia ideal. \ud83e\uddf4\u2728`,\n\n`\ud83c\udf89 \u00a1Bienvenido a *Ed Perfumer\u00eda*!  \nGracias por escribirnos. Estamos listos para asesorarte.`\n];\n\n// Selecciona uno al azar\nconst saludoAleatorio = saludos[Math.floor(Math.random() * saludos.length)];\nreturn [\n  {\n    json: {\n      output: saludoAleatorio\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -896,
        16
      ],
      "id": "f358cc82-9b58-4644-b652-1490f0e179bc",
      "name": "Dynamic Greeting"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.periodo }}",
                    "rightValue": "ma\u00f1ana",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "eb8f4c83-efd2-4595-b674-25dc1c0ad1b8"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "ma\u00f1ana"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "dcc3cd98-a426-4020-8af1-a851981f2055",
                    "leftValue": "={{ $json.periodo }}",
                    "rightValue": "tarde",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "tarde"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "b515e6bc-c3a2-4471-b9ee-ff723e6ff6cc",
                    "leftValue": "={{ $json.periodo }}",
                    "rightValue": "noche",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "noche"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -2688,
        944
      ],
      "id": "b7635ca3-aed1-46bf-ba90-49b7cf334461",
      "name": "Switch1"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
            },
            {
              "name": "message",
              "value": "={{ $json.output }}"
            },
            {
              "name": "delayTyping",
              "value": "={{ parseInt( $json.output.length() * 25) }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -672,
        16
      ],
      "id": "921c6f10-25cc-483a-8739-3454edb0cb9e",
      "name": "Send Dynamic Greeting"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-button-list",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"phone\": \"{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}\",\n  \"message\": \"{{ (() => { const h = new Date(new Date().getTime() - 18000000).getHours(); return h >= 5 && h < 12 ? '\u00a1Buenos d\u00edas!' : h >= 12 && h < 18 ? '\u00a1Buenas tardes!' : '\u00a1Buenas noches!'; })() }} \ud83c\udf38\\n\\n\u00bfQu\u00e9 te gustar\u00eda hacer?\",\n  \"delayTyping\": 1500,\n  \"buttonList\": {\n    \"buttons\": [\n      {\n        \"id\": \"comprar\",\n        \"label\": \"\ud83d\uded2 Comprar\"\n      },\n      {\n        \"id\": \"catalogo\",\n        \"label\": \"\ud83d\udccb Cat\u00e1logo\"\n      },\n      {\n        \"id\": \"ofertas\",\n        \"label\": \"\ud83d\udd25 Ofertas\"\n      },\n      {\n        \"id\": \"pedido\",\n        \"label\": \"\ud83d\udce6 Consultar Pedido\"\n      }\n    ]\n  }\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -448,
        16
      ],
      "id": "6504ee10-7d85-4f13-be1c-876d473693b2",
      "name": "Send Buttons"
    },
    {
      "parameters": {
        "numberInputs": 3
      },
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.2,
      "position": [
        -2240,
        976
      ],
      "id": "f8d915bd-26be-4e51-b663-3ed6ccb630ba",
      "name": "Merge Audio"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-audio",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
            },
            {
              "name": "audio",
              "value": "=data:{{ $('Merge Audio').item.binary.data.mimeType }};base64,{{ $('Merge Audio').item.binary.data.data }}"
            },
            {
              "name": "delayTyping",
              "value": "6"
            },
            {
              "name": "waveform",
              "value": "true"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -2016,
        992
      ],
      "id": "8f824568-bbdc-40cb-b280-4f77ba774cd0",
      "name": "Send Audio"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-document/pdf",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').first().json.user.sender_phone }}"
            },
            {
              "name": "document",
              "value": "https://drive.google.com/uc?export=download&id=1z1N-NqCHW2PrC1_HJS01MP6geTL6Jf_S"
            },
            {
              "name": "fileName",
              "value": "Cat\u00e1logo Ed Perfumer\u00eda Hombre"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1792,
        992
      ],
      "id": "18a6db3f-da38-4996-9d5c-d951231f9e7b",
      "name": "Send Catalog Man"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-document/pdf",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').first().json.user.sender_phone }}"
            },
            {
              "name": "document",
              "value": "https://drive.google.com/uc?export=download&id=1sf7vcqR6USGi-b496e7kCshxMNwI-4c4"
            },
            {
              "name": "fileName",
              "value": "Cat\u00e1logo Ed Perfumer\u00eda Mujer"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -1568,
        992
      ],
      "id": "e4e15277-293c-4b58-a92b-e61a3198c0bb",
      "name": "Send Catalog Women"
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "1UND_G3K4tu_xmjsTOSyq3ypRVpzg95HH",
          "mode": "list",
          "cachedResultName": "Buenos Dias.ogg",
          "cachedResultUrl": "https://drive.google.com/file/d/1UND_G3K4tu_xmjsTOSyq3ypRVpzg95HH/view?usp=drivesdk"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -2464,
        712
      ],
      "id": "a23ec4e3-8d46-447b-9908-fb3256da08b2",
      "name": "Download Good Morning",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "1oFABnmJkXuevND9TxwJP_zcM2VLsDPtb",
          "mode": "list",
          "cachedResultName": "Buenas Tardes.ogg",
          "cachedResultUrl": "https://drive.google.com/file/d/1oFABnmJkXuevND9TxwJP_zcM2VLsDPtb/view?usp=drivesdk"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -2464,
        904
      ],
      "id": "0e96d7ce-3ef6-4b64-8b44-48a1074254e9",
      "name": "Download Good Afternoon",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "16PkBRIK-Iv-VKInmhW1nq5Qfjc0EKWn2",
          "mode": "list",
          "cachedResultName": "Buenas Noches.ogg",
          "cachedResultUrl": "https://drive.google.com/file/d/16PkBRIK-Iv-VKInmhW1nq5Qfjc0EKWn2/view?usp=drivesdk"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        -2464,
        1096
      ],
      "id": "016bf72d-7e98-4f37-aac3-4c978d9381ee",
      "name": "Download  Good Night",
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const ofertas = [\n`\ud83c\udf80 *Promociones especiales de Ed Perfumer\u00eda*\n\n\ud83d\udc8e **Ofertas disponibles:**\n1 unidad \u2192 $60.000\n2 unidades \u2192 $100.000  \n3 unidades \u2192 $120.000\n6 unidades \u2192 $210.000\n\n\ud83d\udd25 \u00a1Fragancias incre\u00edbles a precios \u00fanicos!`,\n\n`\ud83c\udf81 *Ofertas Ed Perfumer\u00eda*\n\n\u2728 **Precios especiales:**\n1 por $60.000\n2 por $100.000\n3 por $120.000\n6 por $210.000\n\n\ud83d\udcab \u00a1Aprovecha nuestros mejores precios!`,\n\n`\ud83d\udc8e *Promoci\u00f3n de la semana*\n\n\ud83d\udd25 **Ofertas vigentes:**\n1 unidad: $60.000\n2 unidades: $100.000\n3 unidades: $120.000\n6 unidades: $210.000\n\n\ud83c\udf89 \u00a1No dejes pasar estas ofertas!`,\n\n`\ud83c\udf1f *Ofertas especiales*\n\n\ud83d\udca5 **Promociones disponibles:**\n1 x $60.000 | 2 x $100.000 | 3 x $120.000 | 6 x $210.000\n\n\u2728 \u00a1Solo por tiempo limitado!`,\n\n`\ud83c\udf8a *Ed Perfumer\u00eda - Ofertas*\n\n\ud83c\udf81 **Precios incre\u00edbles:**\n1 fragancia \u2192 $60.000\n2 fragancias \u2192 $100.000\n3 fragancias \u2192 $120.000\n6 fragancias \u2192 $210.000\n\n\ud83d\udd25 \u00a1Te van a encantar!`,\n\n`\ud83d\udc96 *Promociones actuales*\n\n\ud83c\udf38 **Ofertas de hoy:**\n1 unidad por $60.000\n2 unidades por $100.000\n3 unidades por $120.000\n6 unidades por $210.000\n\n\ud83d\udc8e \u00a1Aprovecha esta oportunidad!`,\n\n`\ud83d\ude80 *Ofertas Ed Perfumer\u00eda*\n\n\u2b50 **Precios especiales:**\n1 \u2192 $60.000\n2 \u2192 $100.000\n3 \u2192 $120.000\n6 \u2192 $210.000\n\n\ud83c\udf89 \u00a1Promociones por tiempo limitado!`,\n\n`\ud83c\udf08 *Promoci\u00f3n especial*\n\n\ud83d\udcab **Ofertas vigentes:**\n1 unidad: $60.000\n2 unidades: $100.000\n3 unidades: $120.000\n6 unidades: $210.000\n\n\ud83d\udd25 \u00a1No te las pierdas!`,\n\n`\ud83c\udf80 *Ofertas de la semana*\n\n\u2728 **Precios \u00fanicos:**\n1 x $60.000 \u2022 2 x $100.000 \u2022 3 x $120.000 \u2022 6 x $210.000\n\n\ud83c\udf81 \u00a1Fragancias incre\u00edbles a precios especiales!`,\n\n`\ud83d\udc9d *Ed Perfumer\u00eda - Promociones*\n\n\ud83c\udf1f **Ofertas disponibles:**\n1 unidad = $60.000\n2 unidades = $100.000\n3 unidades = $120.000\n6 unidades = $210.000\n\n\ud83d\udc8e \u00a1Aprovecha nuestras mejores ofertas!`\n];\n\n// Selecciona uno al azar\nconst ofertaAleatoria = ofertas[Math.floor(Math.random() * ofertas.length)];\nreturn [\n  {\n    json: {\n      output: ofertaAleatoria\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -2912,
        1288
      ],
      "id": "aa04ceb2-4a01-47e6-910a-93c99c49aef2",
      "name": "Dynamic Offers"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
            },
            {
              "name": "message",
              "value": "={{ $json.output }}"
            },
            {
              "name": "delayTyping",
              "value": "={{ parseInt( $json.output.length() * 25) }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -2688,
        1288
      ],
      "id": "3290edea-f50e-4fc7-97a3-0e99d24a2567",
      "name": "Send Dynamic Offers"
    },
    {
      "parameters": {
        "jsCode": "const comprar = [\n`\ud83d\uded2 *\u00a1Perfecto! Veamos qu\u00e9 te interesa*\n\n\u00bfEn qu\u00e9 fragancia est\u00e1s pensando?\n- \u00bfTienes alguna en mente?\n- \u00bfBuscas algo espec\u00edfico?\n\n\ud83d\udc8e \u00a1Cu\u00e9ntanos para ayudarte mejor!`,\n\n`\ud83d\udecd\ufe0f *\u00a1Excelente!*\n\n\u00bfQu\u00e9 tipo de fragancia te llama la atenci\u00f3n?\n- \u00bfAlgo dulce o fresco?\n- \u00bfPara hombre o mujer?\n\n\u2728 \u00a1Dinos qu\u00e9 buscas!`,\n\n`\ud83c\udf81 *\u00a1Genial! Hablemos de fragancias*\n\n\u00bfQu\u00e9 producto te interesa?\n- \u00bfTienes marca favorita?\n- \u00bfBuscas algo nuevo?\n\n\ud83d\ude80 \u00a1Comp\u00e1rtenos tu preferencia!`,\n\n`\ud83d\udcb3 *\u00a1Listo para ayudarte!*\n\n\u00bfEn qu\u00e9 fragancia est\u00e1s interesado/a?\n- \u00bfAlgo en particular?\n- \u00bfNecesitas recomendaciones?\n\n\ud83c\udf1f \u00a1Cu\u00e9ntanos qu\u00e9 buscas!`,\n\n`\ud83d\uded2 *\u00a1Vamos a encontrar tu fragancia ideal!*\n\n\u00bfQu\u00e9 tipo de aroma prefieres?\n- \u00bfDulce, fresco, amaderado?\n- \u00bfPara ocasi\u00f3n especial?\n\n\ud83d\udc8e \u00a1Dinos qu\u00e9 te gusta!`,\n\n`\ud83c\udf89 *\u00a1Perfecto! Descubramos tu fragancia*\n\n\u00bfQu\u00e9 producto tienes en mente?\n- \u00bfAlguna marca espec\u00edfica?\n- \u00bfBuscas algo trending?\n\n\u2728 \u00a1Comparte tu inter\u00e9s!`,\n\n`\ud83d\udecd\ufe0f *\u00a1Excelente elecci\u00f3n!*\n\n\u00bfEn qu\u00e9 fragancia est\u00e1s pensando?\n- \u00bfAlgo cl\u00e1sico o moderno?\n- \u00bfTienes preferencias?\n\n\ud83d\udd25 \u00a1Cu\u00e9ntanos qu\u00e9 buscas!`,\n\n`\ud83d\udc9d *\u00a1Hablemos de tu fragancia perfecta!*\n\n\u00bfQu\u00e9 tipo de aroma te interesa?\n- \u00bfPara uso diario o especial?\n- \u00bfTienes alguna en mente?\n\n\ud83c\udf08 \u00a1Dinos qu\u00e9 prefieres!`,\n\n`\ud83c\udf8a *\u00a1Genial! Encontremos tu aroma*\n\n\u00bfQu\u00e9 fragancia te llama la atenci\u00f3n?\n- \u00bfBuscas algo espec\u00edfico?\n- \u00bfNecesitas sugerencias?\n\n\ud83d\udcab \u00a1Comparte tu gusto!`,\n\n`\ud83d\ude80 *\u00a1Perfecto! Hablemos de fragancias*\n\n\u00bfEn qu\u00e9 producto est\u00e1s interesado/a?\n- \u00bfTienes marca favorita?\n- \u00bfAlgo dulce o fresco?\n\n\ud83c\udf81 \u00a1Cu\u00e9ntanos tu preferencia!`\n];\n\n// Selecciona uno al azar\nconst comprarAleatorio = comprar[Math.floor(Math.random() * comprar.length)];\nreturn [\n  {\n    json: {\n      output: comprarAleatorio\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -2912,
        1480
      ],
      "id": "27c02b64-1150-4c9f-a757-aa5f7452f21f",
      "name": "Dynamic Buy"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
            },
            {
              "name": "message",
              "value": "={{ $json.output }}"
            },
            {
              "name": "delayTyping",
              "value": "={{ parseInt( $json.output.length() * 25) }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -2688,
        1480
      ],
      "id": "3e1d49a5-f209-4904-a207-1bcd000bc461",
      "name": "Send Dynamic Buy"
    },
    {
      "parameters": {
        "jsCode": "const consultarPedido = [\n`\ud83d\udce6 *\u00a1Perfecto! Consultemos tu pedido*\n\n\u00bfQu\u00e9 necesitas saber sobre tu compra?\n- \u00bfEstado del env\u00edo?\n- \u00bfN\u00famero de gu\u00eda?\n- \u00bfTiempo de entrega?\n\n\ud83d\ude9a \u00a1Estamos aqu\u00ed para ayudarte!`,\n\n`\ud83d\udd0d *\u00a1Excelente! Revisemos tu orden*\n\n\u00bfSobre qu\u00e9 quieres consultar?\n- \u00bfD\u00f3nde est\u00e1 mi pedido?\n- \u00bfCu\u00e1ndo llega?\n- \u00bfDatos de env\u00edo?\n\n\ud83d\udccb \u00a1Dinos qu\u00e9 necesitas saber!`,\n\n`\ud83d\udcf1 *\u00a1Genial! Veamos tu pedido*\n\n\u00bfQu\u00e9 informaci\u00f3n necesitas?\n- \u00bfEstado actual del env\u00edo?\n- \u00bfN\u00famero de seguimiento?\n- \u00bfFecha estimada de entrega?\n\n\u2728 \u00a1Consultemos juntos!`,\n\n`\ud83d\ude9b *\u00a1Listo para ayudarte!*\n\n\u00bfQu\u00e9 quieres saber de tu compra?\n- \u00bfEst\u00e1 en camino?\n- \u00bfTienes la gu\u00eda?\n- \u00bfAlg\u00fan problema?\n\n\ud83c\udf1f \u00a1Revisemos tu pedido!`,\n\n`\ud83d\udce6 *\u00a1Vamos a consultar tu env\u00edo!*\n\n\u00bfSobre qu\u00e9 necesitas informaci\u00f3n?\n- \u00bfEstado del pedido?\n- \u00bfSeguimiento de env\u00edo?\n- \u00bfTiempo de llegada?\n\n\ud83d\udc8e \u00a1Estamos para resolver tus dudas!`,\n\n`\ud83d\udd0e *\u00a1Perfecto! Consultemos tu orden*\n\n\u00bfQu\u00e9 informaci\u00f3n buscas?\n- \u00bfD\u00f3nde est\u00e1 mi compra?\n- \u00bfN\u00famero de gu\u00eda?\n- \u00bfCu\u00e1ndo llega?\n\n\ud83c\udf89 \u00a1Revisemos juntos!`,\n\n`\ud83d\udccb *\u00a1Excelente! Veamos tu pedido*\n\n\u00bfQu\u00e9 necesitas consultar?\n- \u00bfEstado de env\u00edo?\n- \u00bfDatos de seguimiento?\n- \u00bfInformaci\u00f3n de entrega?\n\n\ud83d\udd25 \u00a1Dinos qu\u00e9 quieres saber!`,\n\n`\ud83d\ude9a *\u00a1Consultemos tu compra!*\n\n\u00bfSobre qu\u00e9 tienes dudas?\n- \u00bfMi pedido ya sali\u00f3?\n- \u00bfCu\u00e1l es mi gu\u00eda?\n- \u00bfCu\u00e1ndo llega?\n\n\ud83c\udf08 \u00a1Estamos para ayudarte!`,\n\n`\ud83d\udcf1 *\u00a1Genial! Revisemos tu env\u00edo*\n\n\u00bfQu\u00e9 informaci\u00f3n necesitas?\n- \u00bfEstado actual?\n- \u00bfN\u00famero de seguimiento?\n- \u00bfFecha de entrega?\n\n\ud83d\udcab \u00a1Consultemos tu pedido!`,\n\n`\ud83d\udd0d *\u00a1Perfecto! Veamos tu orden*\n\n\u00bfQu\u00e9 quieres saber?\n- \u00bfD\u00f3nde est\u00e1 mi pedido?\n- \u00bfGu\u00eda de env\u00edo?\n- \u00bfTiempo estimado?\n\n\ud83c\udf81 \u00a1Resolvamos tus dudas!`\n];\n\n// Selecciona uno al azar\nconst consultarPedidoAleatorio = consultarPedido[Math.floor(Math.random() * consultarPedido.length)];\nreturn [\n  {\n    json: {\n      output: consultarPedidoAleatorio\n    }\n  }\n];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -2912,
        1672
      ],
      "id": "fa72af87-8adb-42ee-a5fd-61f29459d5ba",
      "name": "Dynamic Order"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
            },
            {
              "name": "message",
              "value": "={{ $json.output }}"
            },
            {
              "name": "delayTyping",
              "value": "={{ parseInt( $json.output.length() * 25) }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -2688,
        1672
      ],
      "id": "755816dc-47ae-4f6a-98c1-9a76bc346634",
      "name": "Send Dynamic Order"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'SALUDO');",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -224,
        16
      ],
      "id": "7e747686-1afe-45cf-86b5-cdb9e655a198",
      "name": "Execute Status Greeting",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').first().json.user.sender_phone }}', 'CATALOGO');",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -1344,
        992
      ],
      "id": "cbd1e3e4-a81e-4f75-82b1-6a1755ade6a3",
      "name": "Execute Status Catalog",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'OFERTAS');",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -2464,
        1288
      ],
      "id": "85b9ade9-afb7-49b2-9662-6a0bd1542af2",
      "name": "Execute Status Offers",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'VENTAS');",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -2464,
        1480
      ],
      "id": "a1b179a3-1b19-416d-89e2-0ee5773e56cf",
      "name": "Execute Status Buy",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT actualizar_estado_principal_pro('{{ $('WhatsApp Message Parser').item.json.user.sender_phone }}', 'SOPORTE');",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -2464,
        1672
      ],
      "id": "f6c9b4b2-9a40-4fb2-b7cf-7ebd4b43e600",
      "name": "Execute Status Order",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.estado }}",
                    "rightValue": "VENTAS",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "ventas-condition"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "sales"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.estado }}",
                    "rightValue": "SOPORTE",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "soporte-condition"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "order"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -672,
        504
      ],
      "id": "13d14846-7d2e-4d8e-a16c-edee3414ba3f",
      "name": "Status Response IA"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        -448,
        640
      ],
      "id": "a87f7ddf-58f0-4ea8-b26a-e343faba00d8",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {
        "inputText": "={{ $('Format Final Output').item.json.conversation_content }}",
        "categories": {
          "categories": [
            {
              "category": "COMPRA_DIRECTA",
              "description": "Cliente manifiesta voluntad definitiva de adquirir productos espec\u00edficos, solicita procesos de venta, cotizaciones totales, o confirma decisiones de compra. Incluye expresiones de compra inmediata, solicitudes de c\u00e1lculo de totales, procesos de pago, datos de contacto para ventas, y confirmaciones directas."
            },
            {
              "category": "CONSULTA_INVENTARIO",
              "description": "Cliente busca informaci\u00f3n espec\u00edfica sobre productos individuales sin expresar intenci\u00f3n de compra ni solicitar ayuda para elegir. Incluye consultas sobre precios unitarios, disponibilidad de stock, caracter\u00edsticas t\u00e9cnicas, especificaciones del producto, contenido, originalidad, y verificaci\u00f3n de existencias."
            },
            {
              "category": "SOLICITUD_RECOMENDACION",
              "description": "Cliente busca consejo personalizado, sugerencias adaptadas a sus necesidades, ayuda para tomar decisiones de compra, o recomendaciones basadas en ocasiones, gustos, presupuesto o preferencias espec\u00edficas. El cliente delega la decisi\u00f3n al vendedor o busca orientaci\u00f3n experta."
            },
            {
              "category": "COMPARACION_PRODUCTOS",
              "description": "Cliente solicita an\u00e1lisis objetivo de diferencias, similitudes, ventajas y desventajas entre productos espec\u00edficos ya identificados. Busca informaci\u00f3n comparativa t\u00e9cnica sin necesariamente pedir ayuda para decidir, sino datos para evaluar opciones por s\u00ed mismo."
            }
          ]
        },
        "options": {
          "systemPromptTemplate": "<rol>\nAct\u00faa como un experto clasificador de intenciones de compra con 10+ a\u00f1os de experiencia en an\u00e1lisis de comportamiento del consumidor en e-commerce.\n</rol>\n\n<tarea>\nClasifica con m\u00e1xima precisi\u00f3n la intenci\u00f3n de compra del cliente bas\u00e1ndote \u00fanicamente en el texto proporcionado, enfoc\u00e1ndote en el customer journey de ventas.\n</tarea>\n\n<instrucciones>\nPiensa paso a paso:\n\n1. **Identifica el verbo principal** y el tipo de pregunta (\u00bfqu\u00e9 busca realmente?)\n2. **Analiza las palabras clave** que indican nivel de intenci\u00f3n de compra\n3. **Eval\u00faa si ya decidi\u00f3 comprar** vs. necesita informaci\u00f3n vs. busca ayuda vs. compara\n4. **Considera el contexto completo** del mensaje, incluyendo lenguaje informal\n5. **Clasifica en UNA sola categor\u00eda** - la intenci\u00f3n M\u00c1S dominante\n6. **Responde \u00daNICAMENTE con el nombre de la categor\u00eda**\n</instrucciones>\n\n<categorias>\n**COMPRA_DIRECTA**: Cliente manifiesta voluntad definitiva de adquirir productos espec\u00edficos, solicita procesos de venta, cotizaciones totales, o confirma decisiones de compra. \n*Se\u00f1ales clave: \"quiero comprar\", \"me llevo\", \"cu\u00e1nto cuesta todo\", \"proceder al pago\", \"cotizaci\u00f3n completa\", \"ya decid\u00ed\", \"voy a comprar\"*\n\n**CONSULTA_INVENTARIO**: Cliente busca informaci\u00f3n espec\u00edfica sobre productos individuales: disponibilidad, precios, caracter\u00edsticas, especificaciones. NO expresa intenci\u00f3n de compra ni solicita ayuda para elegir.\n*Se\u00f1ales clave: \"tienes\", \"ten\u00e9s\", \"tenes\", \"hay\", \"est\u00e1\", \"queda\", \"manejas\", \"vendes\", \"vend\u00e9s\", \"trabajas\", \"traes\", \"trajiste\", \"te lleg\u00f3\", \"consegu\u00eds\", \"me consigues\", \"me das\", \"me vend\u00e9s\", \"me vendes\", \"ofrec\u00e9s\", \"ofreces\", \"se puede\", \"puedo conseguir\", \"comprarte\", \"precio de\", \"cu\u00e1nto vale\", \"cu\u00e1nto cuesta\", \"cu\u00e1nto est\u00e1\", \"cu\u00e1nto sale\", \"a como\", \"a cu\u00e1nto\", \"est\u00e1 disponible\", \"disponible\", \"en stock\", \"stock\", \"especificaciones\", \"caracter\u00edsticas\"*\n\n**SOLICITUD_RECOMENDACION**: Cliente busca consejo personalizado, sugerencias adaptadas a sus necesidades, ayuda para tomar decisiones de compra, o recomendaciones basadas en ocasiones, gustos, presupuesto o preferencias.\n*Se\u00f1ales clave: \"qu\u00e9 me recomiendas\", \"cu\u00e1l es mejor para\", \"ay\u00fadame a elegir\", \"necesito algo\", \"qu\u00e9 me conviene\", \"busco\", \"quiero algo que\", \"para regalo\"*\n\n**COMPARACION_PRODUCTOS**: Cliente solicita an\u00e1lisis objetivo de diferencias, similitudes, ventajas y desventajas entre productos espec\u00edficos ya identificados.\n*Se\u00f1ales clave: \"vs\", \"comparar\", \"diferencias entre\", \"cu\u00e1l es mejor entre\", \"pros y contras\", \"ventajas de X sobre Y\", \"qu\u00e9 es mejor\"*\n</categorias>\n\n<ejemplos>\nInput: \"Quiero comprar 2 frascos de Love Spell y 1 loci\u00f3n Victoria's Secret, \u00bfcu\u00e1nto me sale todo con env\u00edo?\"\nOutput: COMPRA_DIRECTA\n\nInput: \"\u00bfCu\u00e1nto cuesta el perfume Chanel Coco Mademoiselle de 100ml?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Tienes la one million\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"\u00bfHay disponible el perfume Dior Sauvage?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"\u00bfManejas perfumes de hombre?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Me consigues el Chanel No. 5\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Trabajas con perfumes importados\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"\u00bfTe lleg\u00f3 la loci\u00f3n Victoria Secret?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Queda stock del Dior Sauvage\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"\u00bfCu\u00e1nto est\u00e1 el perfume Carolina Herrera?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"\u00bfSe puede conseguir el One Million Lucky?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Necesito un perfume dulce y juvenil para una chica de 20 a\u00f1os, \u00bfqu\u00e9 me recomiendas?\"\nOutput: SOLICITUD_RECOMENDACION\n\nInput: \"\u00bfCu\u00e1les son las diferencias entre la loci\u00f3n corporal y el perfume de la misma fragancia?\"\nOutput: COMPARACION_PRODUCTOS\n\nInput: \"Me llevo el set de perfume + loci\u00f3n corporal, \u00bfc\u00f3mo procedo al pago?\"\nOutput: COMPRA_DIRECTA\n\nInput: \"\u00bfTienen disponible la loci\u00f3n Victoria's Secret Bombshell en presentaci\u00f3n de 250ml?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Busco una fragancia elegante para regalo de aniversario, presupuesto $200\"\nOutput: SOLICITUD_RECOMENDACION\n\nInput: \"Perfume Dior Sauvage vs loci\u00f3n corporal Sauvage, \u00bfcu\u00e1l dura m\u00e1s?\"\nOutput: COMPARACION_PRODUCTOS\n\nInput: \"\u00bfVendes el perfume Carolina Herrera Good Girl?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Hay alg\u00fan descuento en perfumes importados\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"\u00bfTen\u00e9s la loci\u00f3n corporal Bombshell?\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"Me das precio del Dior Homme\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"A cuanto el One Million Prive\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"A como est\u00e1 el perfume Dior\"\nOutput: CONSULTA_INVENTARIO\n\nInput: \"A como me lo dejas\"\nOutput: CONSULTA_INVENTARIO\n</ejemplos>\n\n<reglas_de_clasificacion>\n**PRIORIDADES en caso de ambig\u00fcedad:**\n1. Si menciona compra directa + otra cosa \u2192 COMPRA_DIRECTA\n2. Si compara productos espec\u00edficos \u2192 COMPARACION_PRODUCTOS  \n3. Si busca consejo/ayuda para elegir \u2192 SOLICITUD_RECOMENDACION\n4. Si solo pregunta info t\u00e9cnica/precio/disponibilidad \u2192 CONSULTA_INVENTARIO\n\n**CASOS ESPECIALES:**\n- \"\u00bfCu\u00e1l cuesta menos entre X y Y?\" \u2192 COMPARACION_PRODUCTOS (no consulta de inventario)\n- \"Quiero algo bueno y barato\" \u2192 SOLICITUD_RECOMENDACION (no compra directa)\n- \"\u00bfTienes el perfume Dior en presentaci\u00f3n de 30ml?\" \u2192 CONSULTA_INVENTARIO (variante espec\u00edfica)\n- \"Me interesa esta loci\u00f3n\" \u2192 CONSULTA_INVENTARIO (inter\u00e9s \u2260 compra directa)\n- \"\u00bfQu\u00e9 tal huele el perfume X?\" \u2192 CONSULTA_INVENTARIO (caracter\u00edsticas del producto)\n- \"\u00bfLa loci\u00f3n corporal huele igual que el perfume?\" \u2192 COMPARACION_PRODUCTOS (comparando formatos)\n- \"Busco algo para seducir\" \u2192 SOLICITUD_RECOMENDACION (necesidad espec\u00edfica)\n- \"Tienes la [nombre del perfume]\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"\u00bfHay [producto]?\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"\u00bfManejas [tipo de producto]?\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"Me consigues [producto]\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"\u00bfTe lleg\u00f3 [producto]?\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"Queda stock de [producto]\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"\u00bfCu\u00e1nto est\u00e1 [producto]?\" \u2192 CONSULTA_INVENTARIO (pregunta de precio)\n- \"A como [producto]\" \u2192 CONSULTA_INVENTARIO (pregunta de precio)\n- \"A cu\u00e1nto [producto]\" \u2192 CONSULTA_INVENTARIO (pregunta de precio)\n- \"Trabajas con [categor\u00eda]\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n- \"\u00bfSe puede conseguir [producto]?\" \u2192 CONSULTA_INVENTARIO (pregunta de disponibilidad)\n\n**VARIACIONES DE LENGUAJE INFORMAL Y MODERNO:**\n- **Disponibilidad**: \"Tienes\" = \"Ten\u00e9s\" = \"Tenes\" = \"Hay\" = \"Est\u00e1\" = \"Queda\" = \"Stock\"\n- **Venta/Manejo**: \"Manejas\" = \"Vendes\" = \"Vend\u00e9s\" = \"Trabajas\" = \"Traes\" = \"Ofrec\u00e9s\" = \"Ofreces\"\n- **Conseguir**: \"Me consigues\" = \"Consegu\u00eds\" = \"Se puede conseguir\" = \"Puedo conseguir\"\n- **Llegada/Stock**: \"Te lleg\u00f3\" = \"Trajiste\" = \"Llegaste a traer\"\n- **Precio informal**: \"Cu\u00e1nto est\u00e1\" = \"Cu\u00e1nto sale\" = \"A cu\u00e1nto\" = \"A como\" = \"Cu\u00e1nto vale\"\n- **Compra indirecta**: \"Me das\" = \"Me vend\u00e9s\" = \"Me vendes\" = \"Comprarte\"\n- **Sin signos de interrogaci\u00f3n**: \"Tienes el perfume\" = \"\u00bfTienes el perfume?\"\n- **Sin art\u00edculos**: \"Tienes one million\" = \"Tienes la one million\"\n\n**TODAS estas variaciones son CONSULTA_INVENTARIO cuando preguntan por productos espec\u00edficos**\n</reglas_de_clasificacion>\n\n<restricciones>\n- NO expliques tu razonamiento\n- RESPONDE \u00fanicamente con el nombre de la categor\u00eda\n- S\u00e9 preciso y consistente en la clasificaci\u00f3n\n- Considera variaciones de lenguaje informal y coloquial\n</restricciones>"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        0,
        1304
      ],
      "id": "8656c9df-2108-4573-809a-ce3bfc07cbb4",
      "name": "Text Classifier"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        96,
        1592
      ],
      "id": "66aae821-1eff-4379-8284-cf1a99486a69",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "4HlRidEr8jDW0Zan",
          "mode": "list",
          "cachedResultName": "My Sub Product Comparator Agent"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "query": "={{ $('Format Final Output').item.json.conversation_content }}",
            "sessionId": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "query",
              "displayName": "Query",
              "required": true,
              "type": "string",
              "description": "The user query to process"
            },
            {
              "id": "sessionId",
              "displayName": "Session ID",
              "required": true,
              "type": "string",
              "description": "Session identifier for chat memory (sender phone number)"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        400,
        1736
      ],
      "id": "7026f914-0422-47e0-b51c-17bde450c272",
      "name": "COMPARACION"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "8xMoAwEO7wUKJTXi",
          "mode": "list",
          "cachedResultName": "My Sub Recommendation Agent"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "query": "={{ $('Format Final Output').item.json.conversation_content }}",
            "sessionId": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "query",
              "displayName": "Query",
              "required": true,
              "type": "string",
              "description": "The user query to process"
            },
            {
              "id": "sessionId",
              "displayName": "Session ID",
              "required": true,
              "type": "string",
              "description": "Session identifier for chat memory (sender phone number)"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        400,
        1544
      ],
      "id": "a38485e3-f4c5-4da2-8561-7c272a597581",
      "name": "RECOMENDACION"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "Tk1Yk7Bhqs7KvV9o",
          "mode": "list",
          "cachedResultName": "My Sub Sales Specialist Agent"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "query": "={{ $('Format Final Output').item.json.conversation_content }}",
            "sessionId": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "query",
              "displayName": "Query",
              "required": true,
              "type": "string",
              "description": "The user query to process"
            },
            {
              "id": "sessionId",
              "displayName": "Session ID",
              "required": true,
              "type": "string",
              "description": "Session identifier for chat memory (sender phone number)"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        400,
        1024
      ],
      "id": "2b384306-e75d-4b26-8479-fcceaa224901",
      "name": "COMPRA"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "l0HpKncxwOEcFy8h",
          "mode": "list",
          "cachedResultName": "My Sub Inventory Agent"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "query": "={{ $('Format Final Output').item.json.conversation_content }}",
            "sessionId": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "query",
              "displayName": "Query",
              "required": true,
              "type": "string",
              "description": "The user query to process"
            },
            {
              "id": "sessionId",
              "displayName": "Session ID",
              "required": true,
              "type": "string",
              "description": "Session identifier for chat memory (sender phone number)"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        400,
        1352
      ],
      "id": "adb0d943-600d-4d7c-beb0-b747a7374c5c",
      "name": "INVENTARIO"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "df7a03b3-03fc-4afa-a80a-c622687316f2",
              "leftValue": "={{ $json.estado_ventas }}",
              "rightValue": "=ESPERANDO",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "27a3251e-1e79-4459-ae35-dcbc2570064d",
              "leftValue": "={{ $json.estado_ventas }}",
              "rightValue": "LISTO",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "407ed461-7e17-4638-a2bf-7da0f1fc9d25",
              "leftValue": "={{ $json.estado_ventas }}",
              "rightValue": "FIN",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -224,
        1024
      ],
      "id": "bd192e7f-1bfb-4c28-a324-64bf0eb57fb7",
      "name": "If1"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "ROJE11JYihvwJXvW",
          "mode": "list",
          "cachedResultName": "My Sub-Contra_Entrega"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "sessionId": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "sessionId",
              "displayName": "Session ID",
              "required": true,
              "type": "string",
              "description": "Session identifier for chat memory (sender phone number)"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        -2912,
        1864
      ],
      "id": "a4f6f59b-d041-47b8-9a7a-d8c41eb73f2a",
      "name": "Contra_Entrega"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "gE4JF3Lu1bpd66K6",
          "mode": "list",
          "cachedResultName": "My Sub-Transferencia"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {},
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        -2912,
        2056
      ],
      "id": "2519ff86-001e-42e0-9f97-d946180b1e39",
      "name": "Transferencia"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.estado_ventas }}",
                    "rightValue": "RECOLECTANDO",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "3e6fe2c2-595d-430e-8c1a-84645d16f022"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "RECOLECTANDO"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "97d8f253-f9a1-44a3-a541-c674b5d11535",
                    "leftValue": "={{ $json.estado_ventas }}",
                    "rightValue": "ESPERANDO",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "ESPERANDO"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "04ef01b1-f32f-49ce-9e76-1fb09e162083",
                    "leftValue": "={{ $json.estado_ventas }}",
                    "rightValue": "LISTO",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "LISTO"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "d96bfc64-af1e-4304-88c2-d148d7ce8798",
                    "leftValue": "={{ $json.estado_ventas }}",
                    "rightValue": "COTIZANDO",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "COTIZANDO"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -448,
        352
      ],
      "id": "3fed6eb3-db1f-4f02-860a-51f0794dc6e1",
      "name": "Switch"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "WVmEpKVLhRNt0mTP",
          "mode": "list",
          "cachedResultName": "My Sub-Validator-Data"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "sessionId": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}",
            "message": "={{ $('Format Final Output').item.json.conversation_content }}"
          },
          "matchingColumns": [],
          "schema": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        -224,
        208
      ],
      "id": "10977f56-e92b-446f-9966-b09841b55b53",
      "name": "VALIDATOR DATA"
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "SELECT * FROM obtener_estado_pro('573011284297');",
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -896,
        520
      ],
      "id": "fe4a1330-9599-4513-88e7-baeccb299d0b",
      "name": "Get Data User",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/3E437048CF3D40E574FE2EE02AE98ECC/token/25512E9D7889005341E093C0/send-text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "F71f72d577fd94b2995487e18acdaa9ceS"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
            },
            {
              "name": "message",
              "value": "={{ $json.mensaje_modificacion }}"
            },
            {
              "name": "delayTyping",
              "value": "={{ parseInt( $json.mensaje_modificacion.length() * 25) }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -4032,
        2472
      ],
      "id": "ff26fcea-ddbb-48e3-ac90-215e451b5022",
      "name": "Send Dynamic Offers2"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "UkTlEqZZpE5BH5xi",
          "mode": "list",
          "cachedResultName": "My Sub-Botton-Edit-orders"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "user_sender_phone": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [
            "user_sender_phone"
          ],
          "schema": [
            {
              "id": "user_sender_phone",
              "displayName": "user_sender_phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        -2912,
        2248
      ],
      "name": "Modificar Pedido",
      "id": "711f53b5-41a4-491c-846b-3d23a4e5fc39"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "UkTlEqZZpE5BH5xi",
          "mode": "list",
          "cachedResultName": "My Sub-Botton-Edit-orders"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "user_sender_phone": "={{ $('WhatsApp Message Parser').item.json.user.sender_phone }}"
          },
          "matchingColumns": [
            "user_sender_phone"
          ],
          "schema": [
            {
              "id": "user_sender_phone",
              "displayName": "user_sender_phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.2,
      "position": [
        -224,
        400
      ],
      "id": "4071eacb-a191-475e-913c-d66c76ffe999",
      "name": "Execute Workflow"
    }
  ],
  "connections": {
    "WhatsApp Message Parser": {
      "main": [
        [
          {
            "node": "Message Type Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "WhatsApp Message Parser",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message Type Router": {
      "main": [
        [
          {
            "node": "Download Audio File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Pausa",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download Image File",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Process Button Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Audio File": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image File": {
      "main": [
        [
          {
            "node": "Analyze Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pausa": {
      "main": [
        [
          {
            "node": "Obtener Texto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Extract Message Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Image": {
      "main": [
        [
          {
            "node": "Extract Message Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Button Response": {
      "main": [
        [
          {
            "node": "Button Response Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Button Response Router": {
      "main": [
        [
          {
            "node": "Dynamic Time Greeting",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Dynamic Offers",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Dynamic Buy",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Dynamic Order",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Contra_Entrega",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Transferencia",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Modificar Pedido",
            "type": "main",
            "index": 0
          }
        ],
        [],
        []
      ]
    },
    "Obtener Texto": {
      "main": [
        [
          {
            "node": "Extract Message Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Message Content": {
      "main": [
        [
          {
            "node": "Store Message in Buffer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Message in Buffer": {
      "main": [
        [
          {
            "node": "Wait for Buffer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Buffer": {
      "main": [
        [
          {
            "node": "Retrieve Messages from Buffer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Messages from Buffer": {
      "main": [
        [
          {
            "node": "Check for Duplicate Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for Duplicate Message": {
      "main": [
        [
          {
            "node": "Clear Buffer Cache",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Skip Duplicate Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clear Buffer Cache": {
      "main": [
        [
          {
            "node": "Format Final Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Final Output": {
      "main": [
        [
          {
            "node": "Get session_id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get session_id": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Dynamic Greeting",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get Data User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dynamic Greeting": {
      "main": [
        [
          {
            "node": "Send Dynamic Greeting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dynamic Time Greeting": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "Download Good Morning",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download Good Afternoon",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download  Good Night",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Dynamic Greeting": {
      "main": [
        [
          {
            "node": "Send Buttons",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Audio": {
      "main": [
        [
          {
            "node": "Send Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Audio": {
      "main": [
        [
          {
            "node": "Send Catalog Man",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Catalog Man": {
      "main": [
        [
          {
            "node": "Send Catalog Women",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Good Morning": {
      "main": [
        [
          {
            "node": "Merge Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Good Afternoon": {
      "main": [
        [
          {
            "node": "Merge Audio",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Download  Good Night": {
      "main": [
        [
          {
            "node": "Merge Audio",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Dynamic Offers": {
      "main": [
        [
          {
            "node": "Send Dynamic Offers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dynamic Buy": {
      "main": [
        [
          {
            "node": "Send Dynamic Buy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Dynamic Order": {
      "main": [
        [
          {
            "node": "Send Dynamic Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Buttons": {
      "main": [
        [
          {
            "node": "Execute Status Greeting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Catalog Women": {
      "main": [
        [
          {
            "node": "Execute Status Catalog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Dynamic Offers": {
      "main": [
        [
          {
            "node": "Execute Status Offers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Dynamic Buy": {
      "main": [
        [
          {
            "node": "Execute Status Buy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Dynamic Order": {
      "main": [
        [
          {
            "node": "Execute Status Order",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Status Response IA": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier": {
      "main": [
        [
          {
            "node": "COMPRA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "INVENTARIO",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "RECOMENDACION",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "COMPARACION",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "COMPRA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "VALIDATOR DATA",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "VALIDATOR DATA",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Data User": {
      "main": [
        [
          {
            "node": "Status Response IA",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Dynamic Offers2": {
      "main": [
        []
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "3b076a5a-4279-485d-a106-81c87422e07b",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "NARCxPg3jEuCsBaJ",
  "tags": []
}