{
  "info": {
    "name": "botZone API",
    "description": "Colección completa REST v1 — auth JWT, multi-tenant, bots, flujos, webhooks webchat.\n\n**Setup:** 1) Importar environment. 2) Ejecutar Auth → Login. 3) Variables bot_id/channel_id se autocompletan en listados.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_postman_id": "connectbot-hub-v1"
  },
  "variable": [
    {
      "key": "baseUrl",
      "value": "https://connectbot.lp.apps"
    },
    {
      "key": "apiUrl",
      "value": "{{baseUrl}}/api/v1"
    },
    {
      "key": "demoEmail",
      "value": "admin@demo.local"
    },
    {
      "key": "demoPassword",
      "value": "ChangeMe123!"
    },
    {
      "key": "access_token",
      "value": ""
    },
    {
      "key": "refresh_token",
      "value": ""
    },
    {
      "key": "tenant_id",
      "value": ""
    },
    {
      "key": "bot_id",
      "value": ""
    },
    {
      "key": "channel_id",
      "value": ""
    },
    {
      "key": "flow_id",
      "value": ""
    },
    {
      "key": "conversation_id",
      "value": ""
    },
    {
      "key": "user_id",
      "value": ""
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{access_token}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "00 — Health & Público",
      "item": [
        {
          "name": "GET Health",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{baseUrl}}/health",
            "description": "Estado del servicio y DB.",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "GET Channel types",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/channel-types",
            "description": "",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "GET Starter flow template",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/flows/starter-template",
            "description": "Grafo demo Entry→Text→Choice→Handoff→End con i18n.",
            "auth": {
              "type": "noauth"
            }
          }
        },
        {
          "name": "GET Webchat demo channel",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/webchat/demo-channel?lang=es",
            "description": "Canal webchat activo para pruebas. Guarda channel_id.",
            "auth": {
              "type": "noauth"
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  if (j.data?.channel_id) pm.collectionVariables.set(\"channel_id\", j.data.channel_id);",
                  "  if (j.data?.bot_name) console.log(\"Bot:\", j.data.bot_name);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "GET i18n locales",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/i18n/locales",
            "description": "",
            "auth": {
              "type": "noauth"
            }
          }
        }
      ]
    },
    {
      "name": "01 — Auth",
      "auth": {
        "type": "noauth"
      },
      "item": [
        {
          "name": "Login (tenant admin)",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/auth/login",
            "description": "Guarda access_token, refresh_token y tenant_id.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"{{demoEmail}}\",\n  \"password\": \"{{demoPassword}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  if (j.access_token) pm.collectionVariables.set(\"access_token\", j.access_token);",
                  "  if (j.refresh_token) pm.collectionVariables.set(\"refresh_token\", j.refresh_token);",
                  "  if (j.user?.tenant_id) pm.collectionVariables.set(\"tenant_id\", j.user.tenant_id);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Login (super admin)",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/auth/login",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"super@connectbot.local\",\n  \"password\": \"{{demoPassword}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  if (j.access_token) pm.collectionVariables.set(\"access_token\", j.access_token);",
                  "  if (j.refresh_token) pm.collectionVariables.set(\"refresh_token\", j.refresh_token);",
                  "  if (j.user?.tenant_id) pm.collectionVariables.set(\"tenant_id\", j.user.tenant_id);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Refresh token",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/auth/refresh",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refresh_token\": \"{{refresh_token}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  if (j.access_token) pm.collectionVariables.set(\"access_token\", j.access_token);",
                  "  if (j.refresh_token) pm.collectionVariables.set(\"refresh_token\", j.refresh_token);",
                  "  if (j.user?.tenant_id) pm.collectionVariables.set(\"tenant_id\", j.user.tenant_id);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "GET Me",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/auth/me",
            "description": "",
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{access_token}}",
                  "type": "string"
                }
              ]
            }
          }
        },
        {
          "name": "GET Menus me",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/menus/me",
            "description": "",
            "auth": {
              "type": "bearer",
              "bearer": [
                {
                  "key": "token",
                  "value": "{{access_token}}",
                  "type": "string"
                }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "02 — Tenants (super_admin)",
      "item": [
        {
          "name": "List tenants",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/tenants",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  const list = j.data || (Array.isArray(j) ? j : null);",
                  "  if (list && list[0]?.id) pm.collectionVariables.set(\"tenant_id\", list[0].id);",
                  "  if (j.data) pm.collectionVariables.set(\"tenant_id\", j.data);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Create tenant",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/tenants",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"ACME Corp\",\n  \"slug\": \"acme-corp\",\n  \"is_active\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Get tenant",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/tenants/{{tenant_id}}",
            "description": ""
          }
        },
        {
          "name": "Update tenant",
          "request": {
            "method": "PUT",
            "header": [],
            "url": "{{apiUrl}}/tenants/{{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"ACME Corp Updated\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Delete tenant",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{apiUrl}}/tenants/{{tenant_id}}",
            "description": "Solo si creaste un tenant de prueba."
          }
        }
      ]
    },
    {
      "name": "03 — Users",
      "item": [
        {
          "name": "List users",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/users?tenant_id={{tenant_id}}",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  const list = j.data || (Array.isArray(j) ? j : null);",
                  "  if (list && list[0]?.id) pm.collectionVariables.set(\"user_id\", list[0].id);",
                  "  if (j.data) pm.collectionVariables.set(\"user_id\", j.data);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Create user",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/users?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"email\": \"nuevo@demo.local\",\n  \"password\": \"ChangeMe123!\",\n  \"full_name\": \"Nuevo Usuario\",\n  \"role\": \"viewer\",\n  \"is_active\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Get user",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/users/{{user_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        },
        {
          "name": "Update user",
          "request": {
            "method": "PUT",
            "header": [],
            "url": "{{apiUrl}}/users/{{user_id}}?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"full_name\": \"Usuario Actualizado\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Delete user",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{apiUrl}}/users/{{user_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        }
      ]
    },
    {
      "name": "04 — Dashboard",
      "item": [
        {
          "name": "Dashboard stats",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/dashboard/stats?tenant_id={{tenant_id}}",
            "description": ""
          }
        }
      ]
    },
    {
      "name": "05 — Bots",
      "item": [
        {
          "name": "List bots",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/bots?tenant_id={{tenant_id}}",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  const list = j.data || (Array.isArray(j) ? j : null);",
                  "  if (list && list[0]?.id) pm.collectionVariables.set(\"bot_id\", list[0].id);",
                  "  if (j.data) pm.collectionVariables.set(\"bot_id\", j.data);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Create bot",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/bots?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Mi Bot\",\n  \"description\": \"Bot de prueba\",\n  \"default_language\": \"es\",\n  \"status\": \"active\",\n  \"welcome_message\": \"Hola!\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Get bot",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        },
        {
          "name": "Update bot",
          "request": {
            "method": "PUT",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"active\",\n  \"default_language\": \"es\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Delete bot",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        }
      ]
    },
    {
      "name": "06 — Channels",
      "item": [
        {
          "name": "List all channels",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/channels?tenant_id={{tenant_id}}",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  const list = j.data || (Array.isArray(j) ? j : null);",
                  "  if (list && list[0]?.id) pm.collectionVariables.set(\"channel_id\", list[0].id);",
                  "  if (j.data) pm.collectionVariables.set(\"channel_id\", j.data);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "List channels by bot",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/channels?tenant_id={{tenant_id}}",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  const list = j.data || (Array.isArray(j) ? j : null);",
                  "  if (list && list[0]?.id) pm.collectionVariables.set(\"channel_id\", list[0].id);",
                  "  if (j.data) pm.collectionVariables.set(\"channel_id\", j.data);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Add channel",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/channels?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"channel_type\": \"webchat\",\n  \"display_name\": \"Webchat prueba\",\n  \"status\": \"active\",\n  \"config_json\": {}\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Get channel",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/channels/{{channel_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        },
        {
          "name": "Update channel",
          "request": {
            "method": "PUT",
            "header": [],
            "url": "{{apiUrl}}/channels/{{channel_id}}?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"active\",\n  \"display_name\": \"Webchat activo\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Delete channel",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{apiUrl}}/channels/{{channel_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        }
      ]
    },
    {
      "name": "07 — Flows",
      "item": [
        {
          "name": "List flows",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/flows?tenant_id={{tenant_id}}",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "const j=pm.response.json(); if(j.data?.[0]?.id) pm.collectionVariables.set(\"flow_id\",j.data[0].id);"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Create flow (starter)",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/flows?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Flujo demo\",\n  \"slug\": \"flujo-demo\",\n  \"status\": \"active\",\n  \"is_default\": true,\n  \"flow_graph\": {\n    \"nodes\": {\n      \"node-entry\": {\n        \"type\": \"entry\",\n        \"data\": {}\n      },\n      \"node-welcome\": {\n        \"type\": \"text\",\n        \"data\": {\n          \"text\": \"¡Hola! Bienvenido.\"\n        }\n      },\n      \"node-menu\": {\n        \"type\": \"choice\",\n        \"data\": {\n          \"text\": \"Elegí:\",\n          \"options\": [\n            {\n              \"label\": \"Ventas\",\n              \"value\": \"sales\"\n            },\n            {\n              \"label\": \"Soporte\",\n              \"value\": \"support\"\n            },\n            {\n              \"label\": \"Agente\",\n              \"value\": \"agent\"\n            }\n          ]\n        }\n      },\n      \"node-sales\": {\n        \"type\": \"text\",\n        \"data\": {\n          \"text\": \"Te contactamos pronto.\"\n        }\n      },\n      \"node-support\": {\n        \"type\": \"text\",\n        \"data\": {\n          \"text\": \"Contanos tu problema.\"\n        }\n      },\n      \"node-handoff\": {\n        \"type\": \"handoff\",\n        \"data\": {\n          \"text\": \"Conectando con agente...\"\n        }\n      },\n      \"node-end\": {\n        \"type\": \"end\",\n        \"data\": {\n          \"text\": \"¡Gracias!\"\n        }\n      }\n    },\n    \"edges\": [\n      {\n        \"from\": \"node-entry\",\n        \"to\": \"node-welcome\"\n      },\n      {\n        \"from\": \"node-welcome\",\n        \"to\": \"node-menu\"\n      },\n      {\n        \"from\": \"node-menu\",\n        \"to\": \"node-sales\",\n        \"when\": \"sales\"\n      },\n      {\n        \"from\": \"node-menu\",\n        \"to\": \"node-support\",\n        \"when\": \"support\"\n      },\n      {\n        \"from\": \"node-menu\",\n        \"to\": \"node-handoff\",\n        \"when\": \"agent\"\n      },\n      {\n        \"from\": \"node-sales\",\n        \"to\": \"node-end\"\n      },\n      {\n        \"from\": \"node-support\",\n        \"to\": \"node-handoff\"\n      }\n    ],\n    \"layout\": null\n  }\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Get flow",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/flows/{{flow_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        },
        {
          "name": "Update flow",
          "request": {
            "method": "PUT",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/flows/{{flow_id}}?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"active\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Delete flow",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{apiUrl}}/bots/{{bot_id}}/flows/{{flow_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        }
      ]
    },
    {
      "name": "08 — Conversations",
      "item": [
        {
          "name": "List conversations",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/conversations?tenant_id={{tenant_id}}",
            "description": ""
          },
          "event": [
            {
              "listen": "test",
              "script": {
                "exec": [
                  "if (pm.response.code === 200) {",
                  "  const j = pm.response.json();",
                  "  const list = j.data || (Array.isArray(j) ? j : null);",
                  "  if (list && list[0]?.id) pm.collectionVariables.set(\"conversation_id\", list[0].id);",
                  "  if (j.data) pm.collectionVariables.set(\"conversation_id\", j.data);",
                  "}"
                ],
                "type": "text/javascript"
              }
            }
          ]
        },
        {
          "name": "Get conversation",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/conversations/{{conversation_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        },
        {
          "name": "Update conversation",
          "request": {
            "method": "PUT",
            "header": [],
            "url": "{{apiUrl}}/conversations/{{conversation_id}}?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"status\": \"assigned\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Agent reply",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/conversations/{{conversation_id}}/reply?tenant_id={{tenant_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"text\": \"Hola, soy el agente. ¿En qué puedo ayudarte?\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Close conversation",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": "{{apiUrl}}/conversations/{{conversation_id}}?tenant_id={{tenant_id}}",
            "description": ""
          }
        }
      ]
    },
    {
      "name": "09 — Webhooks (Webchat)",
      "auth": {
        "type": "noauth"
      },
      "item": [
        {
          "name": "Webhook — auto start",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/webhooks/{{channel_id}}",
            "description": "Inicia el flujo sin texto (WEBCHAT_AUTO_START).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"postman_session_{{$timestamp}}\",\n  \"display_name\": \"Postman User\",\n  \"language\": \"es\",\n  \"start\": true,\n  \"message_id\": \"msg_start_{{$timestamp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Webhook — texto libre",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/webhooks/{{channel_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"postman_session_{{$timestamp}}\",\n  \"display_name\": \"Postman User\",\n  \"language\": \"es\",\n  \"text\": \"hola\",\n  \"message_id\": \"msg_text_{{$timestamp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Webhook — choice button",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/webhooks/{{channel_id}}",
            "description": "Simula clic en botón de menú (choice_value).",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"postman_session_{{$timestamp}}\",\n  \"display_name\": \"Postman User\",\n  \"language\": \"es\",\n  \"choice_value\": \"sales\",\n  \"choice_label\": \"Ventas\",\n  \"message_id\": \"msg_choice_{{$timestamp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Webhook — cambiar idioma",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/webhooks/{{channel_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"postman_session_{{$timestamp}}\",\n  \"language\": \"en\",\n  \"text\": \"lang en\",\n  \"message_id\": \"msg_lang_{{$timestamp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Webhook — handoff agent",
          "request": {
            "method": "POST",
            "header": [],
            "url": "{{apiUrl}}/webhooks/{{channel_id}}",
            "description": "",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"session_id\": \"postman_session_{{$timestamp}}\",\n  \"language\": \"es\",\n  \"choice_value\": \"agent\",\n  \"choice_label\": \"Hablar con agente\",\n  \"message_id\": \"msg_agent_{{$timestamp}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    },
    {
      "name": "10 — Audit",
      "item": [
        {
          "name": "List audit logs",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{apiUrl}}/audit-logs?tenant_id={{tenant_id}}&limit=50",
            "description": ""
          }
        }
      ]
    }
  ]
}