Skip to main content
POST
/
v1
/
mozbots
/
{publicId}
/
startChat
Comenzar chat
curl --request POST \
  --url https://mozbot.mozartfintech.com/api/v1/mozbots/{publicId}/startChat \
  --header 'Content-Type: application/json' \
  --data '
{
  "message": {
    "type": "text",
    "text": "<string>",
    "attachedFileUrls": [
      "<string>"
    ]
  },
  "isStreamEnabled": false,
  "resultId": "<string>",
  "isOnlyRegistering": false,
  "prefilledVariables": {
    "First name": "John",
    "Email": "[email protected]"
  },
  "textBubbleContentFormat": "richText"
}
'
{
  "sessionId": "<string>",
  "resultId": "<string>",
  "mozbot": {
    "id": "<string>",
    "theme": {
      "general": {
        "font": "<string>",
        "background": {
          "type": "Color",
          "content": "<string>"
        },
        "progressBar": {
          "isEnabled": true,
          "color": "<string>",
          "backgroundColor": "<string>",
          "placement": "Top",
          "thickness": 123,
          "position": "fixed"
        }
      },
      "chat": {
        "container": {
          "maxWidth": "<string>",
          "maxHeight": "<string>",
          "backgroundColor": "<string>",
          "color": "<string>",
          "blur": 123,
          "opacity": 0.5,
          "shadow": "none",
          "border": {
            "thickness": 123,
            "color": "<string>",
            "roundeness": "none",
            "customRoundeness": 123,
            "opacity": 0.5
          }
        },
        "hostAvatar": {
          "isEnabled": true,
          "url": "<string>"
        },
        "guestAvatar": {
          "isEnabled": true,
          "url": "<string>"
        },
        "hostBubbles": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "blur": 123,
          "opacity": 0.5,
          "shadow": "none",
          "border": {
            "thickness": 123,
            "color": "<string>",
            "roundeness": "none",
            "customRoundeness": 123,
            "opacity": 0.5
          }
        },
        "guestBubbles": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "blur": 123,
          "opacity": 0.5,
          "shadow": "none",
          "border": {
            "thickness": 123,
            "color": "<string>",
            "roundeness": "none",
            "customRoundeness": 123,
            "opacity": 0.5
          }
        },
        "buttons": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "blur": 123,
          "opacity": 0.5,
          "shadow": "none",
          "border": {
            "thickness": 123,
            "color": "<string>",
            "roundeness": "none",
            "customRoundeness": 123,
            "opacity": 0.5
          }
        },
        "inputs": {
          "backgroundColor": "<string>",
          "color": "<string>",
          "blur": 123,
          "opacity": 0.5,
          "shadow": "none",
          "border": {
            "thickness": 123,
            "color": "<string>",
            "roundeness": "none",
            "customRoundeness": 123,
            "opacity": 0.5
          },
          "placeholderColor": "<string>"
        },
        "roundness": "none"
      },
      "customCss": "<string>"
    },
    "settings": {
      "general": {
        "isBrandingEnabled": true,
        "isTypingEmulationEnabled": true,
        "isInputPrefillEnabled": true,
        "isHideQueryParamsEnabled": true,
        "isNewResultOnRefreshEnabled": true,
        "rememberUser": {
          "isEnabled": true,
          "storage": "session"
        }
      },
      "typingEmulation": {
        "enabled": true,
        "speed": 123,
        "maxDelay": 123,
        "delayBetweenBubbles": 2.5,
        "isDisabledOnFirstMessage": true
      },
      "metadata": {
        "title": "<string>",
        "description": "<string>",
        "imageUrl": "<string>",
        "favIconUrl": "<string>",
        "customHeadCode": "<string>",
        "googleTagManagerId": "<string>"
      },
      "whatsApp": {
        "isEnabled": true,
        "startCondition": {
          "logicalOperator": "OR",
          "comparisons": [
            {
              "id": "<string>",
              "comparisonOperator": "Equal to",
              "value": "<string>"
            }
          ]
        },
        "sessionExpiryTimeout": 24.005
      },
      "publicShare": {
        "isEnabled": true
      },
      "security": {
        "allowedOrigins": [
          "<string>"
        ]
      }
    }
  },
  "lastMessageNewFormat": "<string>",
  "messages": [
    {
      "id": "<string>",
      "type": "text",
      "content": {
        "type": "richText",
        "richText": "<any>"
      }
    }
  ],
  "input": {
    "id": "<string>",
    "outgoingEdgeId": "<string>",
    "type": "text input",
    "options": {
      "labels": {
        "placeholder": "<string>",
        "button": "<string>"
      },
      "variableId": "<string>",
      "isLong": true,
      "attachments": {
        "isEnabled": true,
        "saveVariableId": "<string>",
        "visibility": "Auto"
      }
    },
    "prefilledValue": "<string>",
    "runtimeOptions": {
      "paymentIntentSecret": "<string>",
      "amountLabel": "<string>",
      "publicKey": "<string>"
    }
  },
  "clientSideActions": [
    {
      "type": "scriptToExecute",
      "scriptToExecute": {
        "content": "<string>",
        "isCode": true,
        "args": [
          {
            "id": "<string>",
            "value": "<string>"
          }
        ]
      },
      "lastBubbleBlockId": "<string>",
      "expectsDedicatedReply": true
    }
  ],
  "logs": [
    {
      "status": "<string>",
      "description": "<string>",
      "details": "<any>"
    }
  ],
  "dynamicTheme": {
    "hostAvatarUrl": "<string>",
    "guestAvatarUrl": "<string>"
  },
  "progress": 123
}

Path Parameters

Body

application/json
message
object

Solo proporciónelo si su flujo comienza con un bloque de entrada y le gustaría proporcionar una respuesta directamente.

isStreamEnabled
boolean
default:false

Si está habilitado, se le pedirá que transmita las completaciones de OpenAI en un cliente y envíe la respuesta generada de vuelta a la API.

resultId
string

Proporciónelo si desea sobrescribir un resultado existente.

isOnlyRegistering
boolean
default:false

Si se establece en true, solo registrará la sesión y no iniciará el bot. Esto se usa para plataformas de chat de terceros, ya que puede requerir que se registre una sesión antes de enviar el primer mensaje.

prefilledVariables
object
Example:
{
"First name": "John",
"Email": "[email protected]"
}
textBubbleContentFormat
enum<string>
default:richText
Available options:
richText,
markdown

Response

Successful response

sessionId
string
required

Para guardar y usar en solicitudes /continueChat.

mozbot
object
required
messages
(Texto · object | Imagen · object | Video · object | Audio · object | Incrustar · object | Incrustación personalizada · object)[]
required
resultId
string
lastMessageNewFormat
string

El mensaje enviado es validado y formateado en el backend. Por ejemplo, si para una entrada de fecha respondiste algo como mañana, el backend lo convertirá a una cadena de fecha. Este campo devuelve el mensaje formateado.

input
object
clientSideActions
(Script para ejecutar · object | Redirigir · object | Chatwoot · object | Google Analytics · object | Esperar · object | Establecer variable · object | Stream OpenAI · object | Ejecutar webhook · object | Inject start props · object | Init Pixel · object | Exec stream · object | Ejecutar código · object)[]

Acciones a ejecutar en el lado del cliente

logs
object[]

Registros que se guardaron durante la última ejecución

dynamicTheme
object

Si el mozbot contiene avatares dinámicos, dynamicTheme devuelve las nuevas URL de los avatares cada vez que se actualizan sus variables.

progress
number

Si la barra de progreso está habilitada, este campo devolverá un número entre 0 y 100 que indica el progreso actual basado en el camino más largo restante del flujo.