{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/popp/json-schema/popp-conversation-schema.json",
  "title": "Conversation",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/popp-conversations-api-openapi.yml#/components/schemas/Conversation",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the conversation"
    },
    "organizationId": {
      "type": "string",
      "format": "uuid",
      "description": "Organization identifier"
    },
    "campaignId": {
      "type": "string",
      "format": "uuid",
      "description": "Campaign identifier"
    },
    "participantPhoneNumber": {
      "type": "string",
      "pattern": "^\\+[1-9]\\d{1,14}$",
      "description": "Participant's phone number in E.164 format"
    },
    "participantFirstName": {
      "type": "string",
      "description": "Participant's first name"
    },
    "participantLastName": {
      "type": [
        "string",
        "null"
      ],
      "description": "Participant's last name"
    },
    "participantEmailAddress": {
      "type": [
        "string",
        "null"
      ],
      "format": "email",
      "description": "Participant's email address"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the conversation was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when the conversation was last updated"
    },
    "needsReview": {
      "type": "boolean",
      "description": "Indicates if the conversation needs review"
    },
    "isHumanTakeover": {
      "type": "boolean",
      "description": "Indicates if human has taken over the conversation"
    },
    "screeningQuestionsOutcome": {
      "type": [
        "array",
        "null"
      ],
      "description": "Outcome of screening questions",
      "items": {
        "type": "object",
        "properties": {
          "questionOutcome": {
            "type": "string",
            "enum": [
              "FAILED",
              "NOT_COMPLETED",
              "PASSED"
            ],
            "description": "The outcome of the screening question"
          },
          "responseSummary": {
            "type": "string",
            "description": "Summary of the participant's response"
          },
          "screeningQuestion": {
            "type": "string",
            "description": "The screening question asked"
          }
        },
        "required": [
          "questionOutcome",
          "responseSummary",
          "screeningQuestion"
        ],
        "additionalProperties": false
      }
    },
    "sentAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Timestamp when the conversation was sent"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Timestamp when the conversation was completed"
    },
    "timeToFirstResponse": {
      "type": [
        "number",
        "null"
      ],
      "description": "Time taken for first response"
    },
    "timeToComplete": {
      "type": [
        "number",
        "null"
      ],
      "description": "Time taken to complete the conversation"
    },
    "messagesCount": {
      "type": "integer",
      "minimum": 0,
      "description": "Total number of messages in the conversation"
    },
    "repliesCount": {
      "type": "integer",
      "minimum": 0,
      "description": "Total number of replies in the conversation"
    },
    "conversationStatus": {
      "type": "string",
      "enum": [
        "COMPLETED_SCREENING_PASSED",
        "CLOSED",
        "COMPLETED_SCREENING_FAILED",
        "OPTED_OUT",
        "ONGOING",
        "CREATED",
        "QUEUED",
        "DELIVERY_FAILED"
      ],
      "description": "Current status of the conversation"
    },
    "scorecardTotalValue": {
      "type": [
        "number",
        "null"
      ],
      "description": "Total scorecard value derived from preferred-answer scoring across the conversation's open questions. Null when the conversation has not produced a scorecard."
    },
    "externalId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Caller-supplied identifier passed when the conversation was created via POST /v1/conversations or POST /v1/workflows/{workflowId}/runs. Null when the caller did not supply one."
    },
    "workflowRunId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Identifier of the workflow run that owns this conversation. Null when the conversation was not created by a workflow run."
    },
    "workflowNodeId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Identifier of the workflow node that owns this conversation. Null when the conversation was not created by a workflow run."
    },
    "bookingId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Identifier of the calendar booking associated with this conversation. Null when no booking has been made."
    },
    "scoreCardOutcomes": {
      "type": [
        "array",
        "null"
      ],
      "description": "Per-question scorecard outcomes for open questions evaluated during the conversation.",
      "items": {
        "type": "object",
        "properties": {
          "question": {
            "type": "string",
            "description": "The open question that was asked."
          },
          "responseSummary": {
            "type": [
              "string",
              "null"
            ],
            "description": "Summary of the candidate's response to the question."
          },
          "score": {
            "type": [
              "number",
              "null"
            ],
            "description": "Score awarded to the candidate's answer."
          },
          "requirementOutcomes": {
            "type": [
              "array",
              "null"
            ],
            "description": "Per-requirement evaluation results for the question.",
            "items": {
              "type": "object",
              "properties": {
                "content": {
                  "type": "string",
                  "description": "The requirement content evaluated against the candidate's answer."
                },
                "evidence": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Evidence from the candidate's answer that supported or contradicted the requirement."
                },
                "isMet": {
                  "type": "boolean",
                  "description": "Whether the requirement was met by the candidate's answer."
                }
              },
              "required": [
                "content",
                "isMet"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "question"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "id",
    "organizationId",
    "campaignId",
    "participantPhoneNumber",
    "participantFirstName",
    "createdAt",
    "updatedAt",
    "needsReview",
    "isHumanTakeover",
    "messagesCount",
    "repliesCount",
    "conversationStatus"
  ],
  "additionalProperties": false
}