{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sitegpt-ai/json-schema/sitegpt-ai-thin-thread-schema.json",
  "title": "Thin-Thread",
  "description": "Thin Thread",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sitegpt-ai-chatbot-threads-api-openapi.yml#/components/schemas/ThinThread",
  "type": "object",
  "properties": {
    "threadId": {
      "type": "string",
      "description": "Id of the chatbot thread"
    },
    "mode": {
      "enum": [
        "AI",
        "AGENT"
      ],
      "description": "Mode of the thread"
    },
    "startedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp indicating when the thread has been started"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp indicating when the thread has been last updated"
    },
    "endedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp indicating when the thread has been ended"
    },
    "escalated": {
      "type": "boolean",
      "description": "Indicates whether the thread is escalated or not"
    },
    "important": {
      "type": "boolean",
      "description": "Indicates whether the thread is marked as important or not"
    },
    "resolved": {
      "type": "boolean",
      "description": "Indicates whether the thread is resolved or not"
    },
    "totalMessages": {
      "type": "integer",
      "description": "Count of total messages",
      "minimum": 0
    },
    "totalPositiveMessages": {
      "type": "integer",
      "description": "Count of total positive messages",
      "minimum": 0
    },
    "totalNegativeMessages": {
      "type": "integer",
      "description": "Count of total negative messages",
      "minimum": 0
    },
    "totalGpt4MessagesCount": {
      "type": "integer",
      "description": "Count of total GPT-4.1 messages",
      "minimum": 0
    },
    "totalMessagesRead": {
      "type": "integer",
      "description": "Number of messages that have are already read"
    },
    "chatUser": {
      "$ref": "#/$defs/ChatUser"
    },
    "lastMessage": {
      "$ref": "#/$defs/ThreadLastMessage"
    }
  },
  "$defs": {
    "ChatQuestionAnswer": {
      "title": "Chat-Question-Answer",
      "type": [
        "object",
        "null"
      ],
      "description": "Model for question/answer in the chat",
      "properties": {
        "text": {
          "type": "string",
          "description": "Text containing either question or the answer"
        },
        "timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp of the question asked or answer replied"
        }
      }
    },
    "ChatUser": {
      "title": "Chat-User",
      "type": [
        "object",
        "null"
      ],
      "description": "Chat User",
      "properties": {
        "id": {
          "type": "string",
          "description": "Id of the user"
        },
        "name": {
          "type": "string",
          "description": "Name of the user"
        },
        "email": {
          "type": "string",
          "format": "email",
          "description": "Email Id of the user"
        },
        "phone": {
          "type": "string",
          "description": "Phone Number of the user"
        },
        "verified": {
          "type": "boolean",
          "description": "Indicates whether the user is verified or not"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp indicating when the user is created"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Timestamp indicating when the user is last updated"
        }
      }
    },
    "MessageReaction": {
      "title": "Message-Reaction",
      "description": "User's reaction to the message",
      "enum": [
        "POSITIVE",
        "NEGATIVE",
        "NEUTRAL"
      ]
    },
    "MessageType": {
      "title": "Message-Type",
      "description": "Type of the message in the thread",
      "enum": [
        "NORMAL_MESSAGE",
        "USER_MESSAGE",
        "AGENT_MESSAGE",
        "SYSTEM_MESSAGE"
      ]
    },
    "QuickPrompt": {
      "type": "object",
      "description": "Chatbot Conversation Starter",
      "properties": {
        "id": {
          "type": "string",
          "description": "Id of the conversation-starter"
        },
        "title": {
          "type": "string",
          "description": "Title of the conversation-starter. This is the text that is shown as button in the chatbot."
        },
        "link": {
          "type": [
            "string",
            "null"
          ],
          "description": "Link of the conversation starter. If this link is not null, then when you click on the conversation starter in the chatbot, this link will be opened instead of sending a message to the chatbot."
        },
        "description": {
          "type": "string",
          "description": "Description of the conversation-starter. This is the message that will be sent to the chatbot when you click on the conversation-starter inside the chatbot."
        }
      }
    },
    "SystemMessageType": {
      "title": "System-Message-Type",
      "description": "Type of the message if type of the message is SYSTEM_MESSAGE",
      "enum": [
        "CONVERSATION_ESCALATED",
        "EXCEEDED_USAGE_LIMITS",
        "EMAIL_VERIFIED",
        "ENTERED_WRONG_OTP",
        "PROVIDED_EMAIL",
        "PERSONA_SELECTED",
        "PROBLEMS_WITH_UPSTREAM_PROVIDER",
        "COLLECT_LEAD",
        "CONVERSATION_SWITCHED_TO_AI",
        "MODERATION_FLAGGED",
        "HUMAN_SUPPORT_CONFIRMATION",
        "HUMAN_TOOK_OVER",
        "AWAY_MESSAGE"
      ]
    },
    "ThreadLastMessage": {
      "title": "Thread-Last-Message",
      "description": "Last message of a thread",
      "type": "object",
      "properties": {
        "messageId": {
          "type": "string",
          "description": "Id of the message"
        },
        "messageType": {
          "$ref": "#/$defs/MessageType"
        },
        "systemMessageType": {
          "$ref": "#/$defs/SystemMessageType"
        },
        "threadId": {
          "type": "string",
          "description": "Id of the thread this message belongs to"
        },
        "chatbotId": {
          "type": "string",
          "description": "Id of the chatbot this message belongs to"
        },
        "question": {
          "$ref": "#/$defs/ChatQuestionAnswer"
        },
        "answer": {
          "$ref": "#/$defs/ChatQuestionAnswer"
        },
        "reaction": {
          "$ref": "#/$defs/MessageReaction"
        },
        "sources": {
          "type": "array",
          "description": "Sources used to answer the question",
          "items": {
            "type": "string"
          }
        },
        "escalated": {
          "type": "boolean",
          "description": "Indicates whether this message is escalated or not"
        },
        "iconUrl": {
          "type": [
            "string",
            "null"
          ],
          "description": "Url of the icon used in this message"
        },
        "prompts": {
          "type": [
            "array",
            "null"
          ],
          "description": "Quick prompts that have been configured by chatbot owner",
          "items": {
            "$ref": "#/$defs/QuickPrompt"
          }
        },
        "gptModel": {
          "type": "string",
          "description": "GPT Model used to answer the question"
        }
      }
    }
  }
}