2
0
Files
bot/apps/docs/openapi/chat/_spec_.json
Baptiste Arnaud ec7481d002 ⬆️ Upgrade dependencies
Closes #198, closes #171
2023-01-02 10:33:35 +01:00

1793 lines
100 KiB
JSON

{
"openapi": "3.0.3",
"info": {
"title": "Chat API",
"version": "1.0.0"
},
"servers": [
{
"url": "https://typebot.io/api/v1"
}
],
"paths": {
"/sendMessage": {
"post": {
"operationId": "query.chat.sendMessage",
"summary": "Send a message",
"description": "To initiate a chat, do not provide a `sessionId` nor a `message`.\n\nContinue the conversation by providing the `sessionId` and the `message` that should answer the previous question.\n\nSet the `isPreview` option to `true` to chat with the non-published version of the typebot.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"description": "The answer to the previous chat input. Do not provide it if you are starting a new chat."
},
"sessionId": {
"type": "string",
"description": "Session ID that you get from the initial chat request to a bot. If not provided, it will create a new session."
},
"startParams": {
"type": "object",
"properties": {
"typebotId": {
"type": "string",
"description": "[How can I find my typebot ID?](https://docs.typebot.io/api#how-to-find-my-typebotid)"
},
"isPreview": {
"type": "boolean",
"description": "If set to `true`, it will start a Preview session with the unpublished bot and it won't be saved in the Results tab."
},
"resultId": {
"type": "string",
"description": "Provide it if you'd like to overwrite an existing result."
},
"prefilledVariables": {
"type": "object",
"additionalProperties": {}
}
},
"required": [
"typebotId"
],
"additionalProperties": false
}
},
"additionalProperties": false
}
}
}
},
"parameters": [],
"responses": {
"200": {
"description": "Successful response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"text"
]
},
"content": {
"type": "object",
"properties": {
"html": {
"type": "string"
},
"plainText": {
"type": "string"
}
},
"required": [
"html",
"plainText"
],
"additionalProperties": false
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"image"
]
},
"content": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"additionalProperties": false
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"video"
]
},
"content": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"id": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"url",
"youtube",
"vimeo"
]
}
},
"additionalProperties": false
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"audio"
]
},
"content": {
"type": "object",
"properties": {
"url": {
"type": "string"
}
},
"additionalProperties": false
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"embed"
]
},
"content": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"height": {
"type": "number"
}
},
"required": [
"height"
],
"additionalProperties": false
}
},
"required": [
"type",
"content"
],
"additionalProperties": false
}
]
}
},
"input": {
"allOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"anyOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"text input"
]
},
"options": {
"allOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"labels": {
"type": "object",
"properties": {
"placeholder": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"placeholder",
"button"
],
"additionalProperties": false
}
},
"required": [
"labels"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"isLong": {
"type": "boolean"
}
},
"required": [
"isLong"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"number input"
]
},
"options": {
"allOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"labels": {
"type": "object",
"properties": {
"placeholder": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"placeholder",
"button"
],
"additionalProperties": false
}
},
"required": [
"labels"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
},
"step": {
"type": "number"
}
},
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"email input"
]
},
"options": {
"allOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"labels": {
"type": "object",
"properties": {
"placeholder": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"placeholder",
"button"
],
"additionalProperties": false
}
},
"required": [
"labels"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"retryMessageContent": {
"type": "string"
}
},
"required": [
"retryMessageContent"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"url input"
]
},
"options": {
"allOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"labels": {
"type": "object",
"properties": {
"placeholder": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"placeholder",
"button"
],
"additionalProperties": false
}
},
"required": [
"labels"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"retryMessageContent": {
"type": "string"
}
},
"required": [
"retryMessageContent"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"date input"
]
},
"options": {
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"labels": {
"type": "object",
"properties": {
"button": {
"type": "string"
},
"from": {
"type": "string"
},
"to": {
"type": "string"
}
},
"required": [
"button",
"from",
"to"
],
"additionalProperties": false
},
"hasTime": {
"type": "boolean"
},
"isRange": {
"type": "boolean"
}
},
"required": [
"labels",
"hasTime",
"isRange"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"phone number input"
]
},
"options": {
"allOf": [
{
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"labels": {
"type": "object",
"properties": {
"placeholder": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"placeholder",
"button"
],
"additionalProperties": false
}
},
"required": [
"labels"
],
"additionalProperties": false
}
]
},
{
"type": "object",
"properties": {
"retryMessageContent": {
"type": "string"
},
"defaultCountryCode": {
"type": "string"
}
},
"required": [
"retryMessageContent"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"choice input"
]
},
"items": {
"type": "array",
"items": {
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"blockId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"blockId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "number",
"enum": [
0
]
},
"content": {
"type": "string"
}
},
"required": [
"type"
],
"additionalProperties": false
}
]
}
},
"options": {
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"isMultipleChoice": {
"type": "boolean"
},
"buttonLabel": {
"type": "string"
}
},
"required": [
"isMultipleChoice",
"buttonLabel"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"items",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"payment input"
]
},
"options": {
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"provider": {
"type": "string",
"enum": [
"Stripe"
]
},
"labels": {
"type": "object",
"properties": {
"button": {
"type": "string"
},
"success": {
"type": "string"
}
},
"required": [
"button"
],
"additionalProperties": false
},
"additionalInformation": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"phoneNumber": {
"type": "string"
}
},
"additionalProperties": false
},
"credentialsId": {
"type": "string"
},
"currency": {
"type": "string"
},
"amount": {
"type": "string"
}
},
"required": [
"provider",
"labels",
"currency"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"rating input"
]
},
"options": {
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"buttonType": {
"anyOf": [
{
"type": "string",
"enum": [
"Icons"
]
},
{
"type": "string",
"enum": [
"Numbers"
]
}
]
},
"length": {
"type": "number"
},
"labels": {
"type": "object",
"properties": {
"left": {
"type": "string"
},
"right": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"button"
],
"additionalProperties": false
},
"customIcon": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"svg": {
"type": "string"
}
},
"required": [
"isEnabled"
],
"additionalProperties": false
},
"isOneClickSubmitEnabled": {
"type": "boolean"
}
},
"required": [
"buttonType",
"length",
"labels",
"customIcon"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"allOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string"
},
"groupId": {
"type": "string"
},
"outgoingEdgeId": {
"type": "string"
}
},
"required": [
"id",
"groupId"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"file input"
]
},
"options": {
"allOf": [
{
"type": "object",
"properties": {
"variableId": {
"type": "string"
}
},
"additionalProperties": false
},
{
"type": "object",
"properties": {
"isRequired": {
"type": "boolean"
},
"isMultipleAllowed": {
"type": "boolean"
},
"labels": {
"type": "object",
"properties": {
"placeholder": {
"type": "string"
},
"button": {
"type": "string"
}
},
"required": [
"placeholder",
"button"
],
"additionalProperties": false
},
"sizeLimit": {
"type": "number"
}
},
"required": [
"isMultipleAllowed",
"labels"
],
"additionalProperties": false
}
]
}
},
"required": [
"type",
"options"
],
"additionalProperties": false
}
]
}
]
},
{
"type": "object",
"properties": {
"prefilledValue": {
"type": "string"
},
"runtimeOptions": {
"type": "object",
"properties": {
"paymentIntentSecret": {
"type": "string"
},
"amountLabel": {
"type": "string"
},
"publicKey": {
"type": "string"
}
},
"required": [
"paymentIntentSecret",
"amountLabel",
"publicKey"
],
"additionalProperties": false
}
},
"additionalProperties": false
}
]
},
"logic": {
"type": "object",
"properties": {
"redirect": {
"type": "object",
"properties": {
"url": {
"type": "string"
},
"isNewTab": {
"type": "boolean"
}
},
"required": [
"isNewTab"
],
"additionalProperties": false
},
"codeToExecute": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"args": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"value": {
"anyOf": [
{
"not": {}
},
{
"anyOf": [
{
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
{
"type": "boolean"
}
]
}
],
"nullable": true
}
},
"required": [
"id"
],
"additionalProperties": false
}
}
},
"required": [
"content",
"args"
],
"additionalProperties": false
}
},
"additionalProperties": false
},
"integrations": {
"type": "object",
"properties": {
"chatwoot": {
"type": "object",
"properties": {
"codeToExecute": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"args": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"value": {
"anyOf": [
{
"not": {}
},
{
"anyOf": [
{
"anyOf": [
{
"type": "string"
},
{
"type": "number"
}
]
},
{
"type": "boolean"
}
]
}
],
"nullable": true
}
},
"required": [
"id"
],
"additionalProperties": false
}
}
},
"required": [
"content",
"args"
],
"additionalProperties": false
}
},
"required": [
"codeToExecute"
],
"additionalProperties": false
},
"googleAnalytics": {
"type": "object",
"properties": {
"trackingId": {
"type": "string"
},
"category": {
"type": "string"
},
"action": {
"type": "string"
},
"label": {
"type": "string"
},
"value": {
"type": "number"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"sessionId": {
"type": "string"
},
"typebot": {
"type": "object",
"properties": {
"theme": {
"type": "object",
"properties": {
"general": {
"type": "object",
"properties": {
"font": {
"type": "string"
},
"background": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"Color",
"Image",
"None"
]
},
"content": {
"type": "string"
}
},
"required": [
"type"
],
"additionalProperties": false
}
},
"required": [
"font",
"background"
],
"additionalProperties": false
},
"chat": {
"type": "object",
"properties": {
"hostAvatar": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"url": {
"type": "string"
}
},
"required": [
"isEnabled"
],
"additionalProperties": false
},
"guestAvatar": {
"type": "object",
"properties": {
"isEnabled": {
"type": "boolean"
},
"url": {
"type": "string"
}
},
"required": [
"isEnabled"
],
"additionalProperties": false
},
"hostBubbles": {
"type": "object",
"properties": {
"backgroundColor": {
"type": "string"
},
"color": {
"type": "string"
}
},
"required": [
"backgroundColor",
"color"
],
"additionalProperties": false
},
"guestBubbles": {
"type": "object",
"properties": {
"backgroundColor": {
"type": "string"
},
"color": {
"type": "string"
}
},
"required": [
"backgroundColor",
"color"
],
"additionalProperties": false
},
"buttons": {
"type": "object",
"properties": {
"backgroundColor": {
"type": "string"
},
"color": {
"type": "string"
}
},
"required": [
"backgroundColor",
"color"
],
"additionalProperties": false
},
"inputs": {
"allOf": [
{
"type": "object",
"properties": {
"backgroundColor": {
"type": "string"
},
"color": {
"type": "string"
}
},
"required": [
"backgroundColor",
"color"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"placeholderColor": {
"type": "string"
}
},
"required": [
"placeholderColor"
],
"additionalProperties": false
}
]
}
},
"required": [
"hostBubbles",
"guestBubbles",
"buttons",
"inputs"
],
"additionalProperties": false
},
"customCss": {
"type": "string"
}
},
"required": [
"general",
"chat"
],
"additionalProperties": false
},
"settings": {
"type": "object",
"properties": {
"general": {
"type": "object",
"properties": {
"isBrandingEnabled": {
"type": "boolean"
},
"isTypingEmulationEnabled": {
"type": "boolean"
},
"isInputPrefillEnabled": {
"type": "boolean"
},
"isHideQueryParamsEnabled": {
"type": "boolean"
},
"isNewResultOnRefreshEnabled": {
"type": "boolean"
},
"isResultSavingEnabled": {
"type": "boolean"
}
},
"required": [
"isBrandingEnabled"
],
"additionalProperties": false
},
"typingEmulation": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"speed": {
"type": "number"
},
"maxDelay": {
"type": "number"
}
},
"required": [
"enabled",
"speed",
"maxDelay"
],
"additionalProperties": false
},
"metadata": {
"type": "object",
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"imageUrl": {
"type": "string"
},
"favIconUrl": {
"type": "string"
},
"customHeadCode": {
"type": "string"
},
"googleTagManagerId": {
"type": "string"
}
},
"additionalProperties": false
}
},
"required": [
"general",
"typingEmulation",
"metadata"
],
"additionalProperties": false
}
},
"required": [
"theme",
"settings"
],
"additionalProperties": false
},
"resultId": {
"type": "string"
}
},
"required": [
"messages"
],
"additionalProperties": false
}
}
}
},
"default": {
"$ref": "#/components/responses/error"
}
}
}
}
},
"components": {
"securitySchemes": {
"Authorization": {
"type": "http",
"scheme": "bearer"
}
},
"responses": {
"error": {
"description": "Error response",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"code": {
"type": "string"
},
"issues": {
"type": "array",
"items": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
},
"required": [
"message"
],
"additionalProperties": false
}
}
},
"required": [
"message",
"code"
],
"additionalProperties": false
}
}
}
}
}
},
"externalDocs": {
"url": "https://docs.typebot.io/api"
}
}