{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sendseven-com/json-schema/sendseven-com-conversation-response-schema.json",
  "title": "ConversationResponse",
  "description": "Full conversation response with all fields.\n\nIncludes contact info, assigned user, last message preview, and tags.",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sendseven-com-openapi.json#/components/schemas/ConversationResponse",
  "properties": {
    "created_at": {
      "type": "string",
      "title": "Created At",
      "description": "When the resource was created (UTC)"
    },
    "updated_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updated At",
      "description": "When the resource was last updated (UTC)"
    },
    "id": {
      "type": "string",
      "title": "Id",
      "description": "Unique identifier (UUID)"
    },
    "tenant_id": {
      "type": "string",
      "title": "Tenant Id",
      "description": "Tenant this resource belongs to"
    },
    "contact_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Contact Id",
      "description": "Contact UUID (can be None for some types)"
    },
    "channel_id": {
      "type": "string",
      "title": "Channel Id",
      "description": "Channel UUID"
    },
    "channel_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Channel Type",
      "description": "Channel type: email, telegram, whatsapp, live_chat, etc."
    },
    "contact_method_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Contact Method Id",
      "description": "Contact method used when conversation was created"
    },
    "active_contact_method_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Active Contact Method Id",
      "description": "Current active contact method for replies"
    },
    "contact_method": {
      "anyOf": [
        {
          "$ref": "#/$defs/ContactMethodInfo"
        },
        {
          "type": "null"
        }
      ],
      "description": "Contact method used when conversation was created"
    },
    "active_contact_method": {
      "anyOf": [
        {
          "$ref": "#/$defs/ContactMethodInfo"
        },
        {
          "type": "null"
        }
      ],
      "description": "Current active contact method for replies"
    },
    "assigned_user_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Assigned User Id"
    },
    "assigned_user": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Assigned User",
      "description": "Assigned user details (id, name, email, chat_nickname)"
    },
    "status": {
      "$ref": "#/$defs/ConversationStatus"
    },
    "subject": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Subject"
    },
    "last_message_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Message At"
    },
    "last_message": {
      "anyOf": [
        {
          "$ref": "#/$defs/LastMessagePreview"
        },
        {
          "type": "null"
        }
      ]
    },
    "contact": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Contact",
      "description": "Contact details"
    },
    "is_live_chat": {
      "type": "boolean",
      "title": "Is Live Chat",
      "description": "Is this from a live chat session",
      "default": false
    },
    "is_email": {
      "type": "boolean",
      "title": "Is Email",
      "description": "Is this an email conversation",
      "default": false
    },
    "needs_reply": {
      "type": "boolean",
      "title": "Needs Reply",
      "description": "True when last message is from customer",
      "default": true
    },
    "last_customer_message_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Customer Message At"
    },
    "last_agent_reply_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Last Agent Reply At"
    },
    "reply_window": {
      "$ref": "#/$defs/ReplyWindowInfo",
      "description": "Instagram / Messenger reply window: {type, standard_expires_at, human_agent_expires_at}. Always present; all null for other channels and for accounts without the Human Agent replies beta."
    },
    "tags": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/TagInfo"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tags"
    },
    "live_chat_session_status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Live Chat Session Status",
      "description": "Live chat session status: waiting, active, closed"
    },
    "live_chat_last_activity_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Live Chat Last Activity At",
      "description": "Last activity timestamp from the live chat session"
    },
    "visitor_online": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Visitor Online",
      "description": "Whether the live chat visitor is currently connected via WebSocket"
    },
    "visitor_widget_state": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Visitor Widget State",
      "description": "Widget panel state: 'open' or 'minimized'"
    },
    "visitor_tab_state": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Visitor Tab State",
      "description": "Browser tab visibility: 'visible' or 'hidden'"
    },
    "visitor_focused": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Visitor Focused",
      "description": "Whether the chat input is currently focused (real-time only, may be null)"
    },
    "visitor_last_visible_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Visitor Last Visible At",
      "description": "Last time visitor's tab was visible"
    },
    "visitor_last_focus_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Visitor Last Focus At",
      "description": "Last time visitor focused the chat input"
    },
    "live_chat": {
      "anyOf": [
        {
          "$ref": "#/$defs/LiveChatConversationSettings"
        },
        {
          "type": "null"
        }
      ],
      "description": "Live Chat only (null for every other channel; only set by GET /conversations/{id}): effective widget settings such as `allow_reactions`."
    },
    "bot_session_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Bot Session Id",
      "description": "Active bot session ID if bot is handling this conversation"
    },
    "active_flow_run": {
      "anyOf": [
        {
          "additionalProperties": true,
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Active Flow Run",
      "description": "Currently active flow run on this conversation. Shape: ``{run_id, flow_id, flow_name, trigger_kind, trigger_class, started_at, current_node_id, current_node_display_name}``. ``trigger_kind`` is the raw flow trigger type (e.g. ``incoming_message``/``manual``/``schedule``) and ``trigger_class`` is the derived ``\"inbound\" | \"background\"`` bucket (background = manual/api_event/schedule); both are null when the trigger can't be resolved (frontend then fails open). None when no flow run is active for the contact+conversation."
    },
    "snoozed_until": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Snoozed Until",
      "description": "When the snooze expires (timezone-aware ISO, 'Z' suffix). NULL when not snoozed. Conversation is currently snoozed when status=='open' AND this is in the future."
    },
    "snooze_reopen_on_message": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Snooze Reopen On Message",
      "description": "Per-snooze choice: auto-reopen the conversation to the Open tab when an inbound customer message arrives while snoozed. Only meaningful while snoozed_until is set."
    },
    "closed_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Closed At",
      "description": "When conversation was closed"
    },
    "closed_by_user_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Closed By User Id",
      "description": "User who closed the conversation"
    },
    "ai_summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ai Summary",
      "description": "AI-generated conversation summary"
    },
    "user_intent": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "User Intent",
      "description": "Why did the user contact us?"
    },
    "resolution_summary": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Resolution Summary",
      "description": "How was it resolved?"
    },
    "sentiment_analysis": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Sentiment Analysis",
      "description": "Customer sentiment progression"
    },
    "ai_tags": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ai Tags",
      "description": "AI-generated tags/categories"
    },
    "summarized_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Summarized At",
      "description": "When AI summary was generated"
    },
    "my_draft": {
      "anyOf": [
        {
          "$ref": "#/$defs/ConversationDraftMarker"
        },
        {
          "type": "null"
        }
      ],
      "description": "The requesting user's unsent draft: {snippet, mode, has_attachments, updated_at}; null when none."
    },
    "ai_drafting": {
      "anyOf": [
        {
          "$ref": "#/$defs/AiDraftingMarker"
        },
        {
          "type": "null"
        }
      ],
      "description": "Set while an AI agent is drafting a reply here: {bot_id, bot_name, started_at}; null otherwise."
    },
    "draft": {
      "anyOf": [
        {
          "$ref": "#/$defs/SharedDraftMarker"
        },
        {
          "type": "null"
        }
      ],
      "description": "The conversation's shared draft marker: {snippet, mode, has_attachments, updated_at, author_type, editor_user_id, editor_name, bot_name}; null when none."
    },
    "customer_language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Customer Language",
      "description": "Language replies are sent in: the conversation's reply-language override, else the contact's detected/preferred language; null when unknown."
    },
    "reply_language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reply Language",
      "description": "Per-conversation \"Send in\" language override; null when not set."
    }
  },
  "type": "object",
  "required": [
    "created_at",
    "id",
    "tenant_id",
    "channel_id",
    "status"
  ],
  "$defs": {
    "AiDraftingMarker": {
      "properties": {
        "bot_id": {
          "type": "string",
          "title": "Bot Id"
        },
        "bot_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bot Name"
        },
        "started_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Started At"
        }
      },
      "type": "object",
      "required": [
        "bot_id"
      ],
      "title": "AiDraftingMarker",
      "description": "``ai_drafting`` on ConversationResponse (AI Day §9): an AI agent holds\nthe conversation's draft lock right now and is writing a reply."
    },
    "ContactMethodInfo": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "method_type": {
          "type": "string",
          "title": "Method Type"
        },
        "value": {
          "type": "string",
          "title": "Value"
        },
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Display Name"
        },
        "is_primary": {
          "type": "boolean",
          "title": "Is Primary",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "id",
        "method_type",
        "value"
      ],
      "title": "ContactMethodInfo",
      "description": "Lightweight contact method for embedding in responses"
    },
    "ConversationDraftMarker": {
      "properties": {
        "snippet": {
          "type": "string",
          "title": "Snippet",
          "description": "Plain text, first ~140 chars, whitespace collapsed, HTML stripped",
          "default": ""
        },
        "mode": {
          "type": "string",
          "title": "Mode",
          "description": "'reply' or 'note'",
          "default": "reply"
        },
        "has_attachments": {
          "type": "boolean",
          "title": "Has Attachments",
          "default": false
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        }
      },
      "type": "object",
      "title": "ConversationDraftMarker",
      "description": "Compact ``my_draft`` marker on ConversationResponse (list + detail)."
    },
    "ConversationStatus": {
      "type": "string",
      "enum": [
        "open",
        "assigned",
        "resolved",
        "closed"
      ],
      "title": "ConversationStatus",
      "description": "Conversation status"
    },
    "LastMessagePreview": {
      "properties": {
        "text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text"
        },
        "message_type": {
          "type": "string",
          "title": "Message Type",
          "description": "Message type: text, image, video, audio, document",
          "default": "text"
        },
        "direction": {
          "type": "string",
          "title": "Direction",
          "description": "Message direction: inbound or outbound",
          "default": "inbound"
        },
        "created_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Created At"
        },
        "meta": {
          "anyOf": [
            {
              "additionalProperties": true,
              "type": "object"
            },
            {
              "type": "null"
            }
          ],
          "title": "Meta",
          "description": "Small whitelisted subset of the message meta, present only when it applies. Currently `unsupported` (true) and `unsupported_type` for inbound WhatsApp messages of a type the platform cannot display."
        }
      },
      "type": "object",
      "title": "LastMessagePreview",
      "description": "Preview of the last message in a conversation"
    },
    "LiveChatConversationSettings": {
      "properties": {
        "allow_reactions": {
          "type": "boolean",
          "title": "Allow Reactions",
          "description": "Whether emoji reactions are allowed in this conversation (the widget's \"Allow reactions\" setting). When false, adding or removing a reaction returns 403 `reactions_disabled`.",
          "default": true
        }
      },
      "type": "object",
      "title": "LiveChatConversationSettings",
      "description": "Effective widget settings for a Live Chat conversation."
    },
    "ReplyWindowInfo": {
      "properties": {
        "type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Type",
          "description": "`standard` (within 24 hours of the customer's last message: any reply), `human_agent` (24 hours to 7 days: only a reply written by a human agent, sent with Meta's HUMAN_AGENT tag), `closed` (after 7 days or no customer message: no reply possible until the customer writes again), or null when no such window applies."
        },
        "standard_expires_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Standard Expires At",
          "description": "When the 24-hour standard window closes."
        },
        "human_agent_expires_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Human Agent Expires At",
          "description": "When the 7-day human agent window closes."
        }
      },
      "type": "object",
      "title": "ReplyWindowInfo",
      "description": "Instagram / Messenger reply window (Meta 24h standard + 7-day HUMAN_AGENT).\n\nAll fields null for every other channel and for accounts without the\nHuman Agent replies beta."
    },
    "SharedDraftMarker": {
      "properties": {
        "snippet": {
          "type": "string",
          "title": "Snippet",
          "default": ""
        },
        "mode": {
          "type": "string",
          "title": "Mode",
          "default": "reply"
        },
        "has_attachments": {
          "type": "boolean",
          "title": "Has Attachments",
          "default": false
        },
        "updated_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updated At"
        },
        "author_type": {
          "type": "string",
          "title": "Author Type",
          "default": "user"
        },
        "editor_user_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Editor User Id"
        },
        "editor_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Editor Name"
        },
        "bot_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bot Name"
        }
      },
      "type": "object",
      "title": "SharedDraftMarker",
      "description": "``draft`` marker on ConversationResponse (shared drafts). Never carries\nthe body beyond the snippet. For a bot draft ``editor_name`` is null and\n``bot_name`` set (UI: \"AI draft ready\")."
    },
    "TagInfo": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id"
        },
        "name": {
          "type": "string",
          "title": "Name"
        },
        "color": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Color"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "title": "TagInfo",
      "description": "Simplified tag info for embedding in responses"
    }
  }
}