asyncapi: 3.0.0
channels:
  events:
    address: /elicitra/webhooks
    messages:
      ComElicitraAnalysisCompletedV1Message:
        $ref: "#/components/messages/ComElicitraAnalysisCompletedV1Message"
      ComElicitraAnalysisFailedV1Message:
        $ref: "#/components/messages/ComElicitraAnalysisFailedV1Message"
      ComElicitraAutomationTriggeredV1Message:
        $ref: "#/components/messages/ComElicitraAutomationTriggeredV1Message"
      ComElicitraInteractionEndedV1Message:
        $ref: "#/components/messages/ComElicitraInteractionEndedV1Message"
components:
  messages:
    ComElicitraAnalysisCompletedV1Message:
      contentType: application/cloudevents+json
      examples:
        - name: example
          payload:
            data:
              analysis:
                analysisAnswers:
                  - answer: A new website
                    questionKey: main_need
                classifications:
                  - axisKey: urgency
                    value: medium
                configuredAnswers:
                  - fieldKey: goal
                    status: answered
                    value: New website
                insights:
                  - The requested scope is concrete.
                missingFields: []
                openQuestions:
                  - Who approves the project?
                operatorHandoff: Confirm the preferred timing.
                recommendedActions:
                  - Confirm timing and stakeholders.
                riskNotes: []
                salesHandoff: Follow up through the authorized channel.
                scores:
                  completeness: 5
                  intent: 4
                summary: Ada requested a follow-up about the website project.
              campaign:
                id: campaign_01
                name: Website qualification
              consents:
                - granted: true
                  scopeKey: structured_extraction_and_lead_handoff
              interaction:
                channel: phone
                endedAt: 2026-07-31T12:00:00.000Z
                id: call_01
                outcome: completed
                reasonCode: respondent_ended
              lifecycleSequence: 2
              organization:
                id: org_01
              respondent:
                email: ada@example.com
                name: Ada
                phone: "+390212345678"
              scenario:
                id: scenario_01
                name: Website qualification
                revision: 4
                slug: website_qualification
              truncation:
                omittedFields: []
                truncated: false
            datacontenttype: application/json
            dataschema: https://elicitra.eigen.rest/developers/v5/schemas/webhooks/com.elicitra.analysis.completed.v1.schema.json
            id: 018f769b-7a6a-7c32-9f3c-8399b27c33f2
            source: https://elicitra.eigen.rest
            specversion: "1.0"
            subject: interactions/call_01
            time: 2026-07-31T12:00:00.000Z
            type: com.elicitra.analysis.completed.v1
      name: com.elicitra.analysis.completed.v1
      payload:
        additionalProperties: false
        properties:
          data:
            $ref: "#/components/schemas/ComElicitraAnalysisCompletedV1"
          datacontenttype:
            const: application/json
            type: string
          dataschema:
            const: https://elicitra.eigen.rest/developers/v5/schemas/webhooks/com.elicitra.analysis.completed.v1.schema.json
          id:
            maxLength: 256
            minLength: 1
            type: string
          source:
            const: https://elicitra.eigen.rest
            type: string
          specversion:
            const: "1.0"
            type: string
          subject:
            pattern: ^interactions\/[A-Za-z0-9_-]{1,256}$
            type: string
          time:
            format: date-time
            pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            type: string
          type:
            const: com.elicitra.analysis.completed.v1
        required:
          - specversion
          - id
          - source
          - type
          - subject
          - time
          - datacontenttype
          - dataschema
          - data
        type: object
      summary: Emitted after a valid structured analysis and ANALYSIS_READY commit.
      title: com.elicitra.analysis.completed.v1
      x-elicitra-delivery-mode: lifecycle_subscription
      x-elicitra-privacy-classification: customer_personal_data
    ComElicitraAnalysisFailedV1Message:
      contentType: application/cloudevents+json
      examples:
        - name: example
          payload:
            data:
              campaign:
                id: campaign_01
                name: Website qualification
              consents:
                - granted: true
                  scopeKey: structured_extraction_and_lead_handoff
              failure:
                category: provider
                code: analysis_provider_unavailable
              interaction:
                channel: phone
                endedAt: 2026-07-31T12:00:00.000Z
                id: call_01
                outcome: failed
                reasonCode: technical_error
              lifecycleSequence: 2
              organization:
                id: org_01
              respondent:
                email: ada@example.com
                name: Ada
                phone: "+390212345678"
              scenario:
                id: scenario_01
                name: Website qualification
                revision: 4
                slug: website_qualification
              truncation:
                omittedFields: []
                truncated: false
            datacontenttype: application/json
            dataschema: https://elicitra.eigen.rest/developers/v5/schemas/webhooks/com.elicitra.analysis.failed.v1.schema.json
            id: 018f769b-7a6a-7c32-9f3c-8399b27c33f3
            source: https://elicitra.eigen.rest
            specversion: "1.0"
            subject: interactions/call_01
            time: 2026-07-31T12:00:00.000Z
            type: com.elicitra.analysis.failed.v1
      name: com.elicitra.analysis.failed.v1
      payload:
        additionalProperties: false
        properties:
          data:
            $ref: "#/components/schemas/ComElicitraAnalysisFailedV1"
          datacontenttype:
            const: application/json
            type: string
          dataschema:
            const: https://elicitra.eigen.rest/developers/v5/schemas/webhooks/com.elicitra.analysis.failed.v1.schema.json
          id:
            maxLength: 256
            minLength: 1
            type: string
          source:
            const: https://elicitra.eigen.rest
            type: string
          specversion:
            const: "1.0"
            type: string
          subject:
            pattern: ^interactions\/[A-Za-z0-9_-]{1,256}$
            type: string
          time:
            format: date-time
            pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            type: string
          type:
            const: com.elicitra.analysis.failed.v1
        required:
          - specversion
          - id
          - source
          - type
          - subject
          - time
          - datacontenttype
          - dataschema
          - data
        type: object
      summary: Emitted only after analysis reaches a terminal failed state.
      title: com.elicitra.analysis.failed.v1
      x-elicitra-delivery-mode: lifecycle_subscription
      x-elicitra-privacy-classification: customer_personal_data
    ComElicitraAutomationTriggeredV1Message:
      contentType: application/cloudevents+json
      examples:
        - name: example
          payload:
            data:
              activation:
                executionId: activation_01
                matchedConditions:
                  - actual: 4
                    expected: 4
                    field: intent
                    operator: gte
                    source: score
                ruleId: qualified_lead
                ruleLabel: Qualified lead
              analysis:
                analysisAnswers:
                  - answer: A new website
                    questionKey: main_need
                classifications:
                  - axisKey: urgency
                    value: medium
                configuredAnswers:
                  - fieldKey: goal
                    status: answered
                    value: New website
                insights:
                  - The requested scope is concrete.
                missingFields: []
                openQuestions:
                  - Who approves the project?
                operatorHandoff: Confirm the preferred timing.
                recommendedActions:
                  - Confirm timing and stakeholders.
                riskNotes: []
                salesHandoff: Follow up through the authorized channel.
                scores:
                  completeness: 5
                  intent: 4
                summary: Ada requested a follow-up about the website project.
              campaign:
                id: campaign_01
                name: Website qualification
              consents:
                - granted: true
                  scopeKey: structured_extraction_and_lead_handoff
              interaction:
                channel: phone
                endedAt: 2026-07-31T12:00:00.000Z
                id: call_01
                outcome: completed
                reasonCode: respondent_ended
              organization:
                id: org_01
              respondent:
                email: ada@example.com
                name: Ada
                phone: "+390212345678"
              scenario:
                id: scenario_01
                name: Website qualification
                revision: 4
                slug: website_qualification
              truncation:
                omittedFields: []
                truncated: false
            datacontenttype: application/json
            dataschema: https://elicitra.eigen.rest/developers/v6/schemas/webhooks/com.elicitra.automation.triggered.v1.schema.json
            id: 018f769b-7a6a-7c32-9f3c-8399b27c33f4
            source: https://elicitra.eigen.rest
            specversion: "1.0"
            subject: interactions/call_01
            time: 2026-07-31T12:00:00.000Z
            type: com.elicitra.automation.triggered.v1
      name: com.elicitra.automation.triggered.v1
      payload:
        additionalProperties: false
        properties:
          data:
            $ref: "#/components/schemas/ComElicitraAutomationTriggeredV1"
          datacontenttype:
            const: application/json
            type: string
          dataschema:
            const: https://elicitra.eigen.rest/developers/v6/schemas/webhooks/com.elicitra.automation.triggered.v1.schema.json
          id:
            maxLength: 256
            minLength: 1
            type: string
          source:
            const: https://elicitra.eigen.rest
            type: string
          specversion:
            const: "1.0"
            type: string
          subject:
            pattern: ^interactions\/[A-Za-z0-9_-]{1,256}$
            type: string
          time:
            format: date-time
            pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            type: string
          type:
            const: com.elicitra.automation.triggered.v1
        required:
          - specversion
          - id
          - source
          - type
          - subject
          - time
          - datacontenttype
          - dataschema
          - data
        type: object
      summary: Emitted only when a deterministic conditional automation rule is selected.
      title: com.elicitra.automation.triggered.v1
      x-elicitra-delivery-mode: conditional_destination
      x-elicitra-privacy-classification: customer_personal_data
    ComElicitraInteractionEndedV1Message:
      contentType: application/cloudevents+json
      examples:
        - name: example
          payload:
            data:
              campaign:
                id: campaign_01
                name: Website qualification
              consents:
                - granted: true
                  scopeKey: structured_extraction_and_lead_handoff
              interaction:
                channel: phone
                endedAt: 2026-07-31T12:00:00.000Z
                id: call_01
                outcome: completed
                reasonCode: respondent_ended
              lifecycleSequence: 1
              organization:
                id: org_01
              respondent:
                email: ada@example.com
                name: Ada
                phone: "+390212345678"
              scenario:
                id: scenario_01
                name: Website qualification
                revision: 4
                slug: website_qualification
              truncation:
                omittedFields: []
                truncated: false
            datacontenttype: application/json
            dataschema: https://elicitra.eigen.rest/developers/v5/schemas/webhooks/com.elicitra.interaction.ended.v1.schema.json
            id: 018f769b-7a6a-7c32-9f3c-8399b27c33f1
            source: https://elicitra.eigen.rest
            specversion: "1.0"
            subject: interactions/call_01
            time: 2026-07-31T12:00:00.000Z
            type: com.elicitra.interaction.ended.v1
      name: com.elicitra.interaction.ended.v1
      payload:
        additionalProperties: false
        properties:
          data:
            $ref: "#/components/schemas/ComElicitraInteractionEndedV1"
          datacontenttype:
            const: application/json
            type: string
          dataschema:
            const: https://elicitra.eigen.rest/developers/v5/schemas/webhooks/com.elicitra.interaction.ended.v1.schema.json
          id:
            maxLength: 256
            minLength: 1
            type: string
          source:
            const: https://elicitra.eigen.rest
            type: string
          specversion:
            const: "1.0"
            type: string
          subject:
            pattern: ^interactions\/[A-Za-z0-9_-]{1,256}$
            type: string
          time:
            format: date-time
            pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
            type: string
          type:
            const: com.elicitra.interaction.ended.v1
        required:
          - specversion
          - id
          - source
          - type
          - subject
          - time
          - datacontenttype
          - dataschema
          - data
        type: object
      summary: Emitted once when an interaction first reaches its canonical terminal state.
      title: com.elicitra.interaction.ended.v1
      x-elicitra-delivery-mode: lifecycle_subscription
      x-elicitra-privacy-classification: customer_personal_data
  schemas:
    ComElicitraAnalysisCompletedV1:
      additionalProperties: false
      properties:
        analysis:
          additionalProperties: false
          properties:
            analysisAnswers:
              items:
                additionalProperties: false
                properties:
                  answer:
                    maxLength: 8192
                    minLength: 1
                    type: string
                  questionKey:
                    maxLength: 256
                    minLength: 1
                    type: string
                required:
                  - questionKey
                  - answer
                type: object
              maxItems: 100
              type: array
            classifications:
              items:
                additionalProperties: false
                properties:
                  axisKey:
                    maxLength: 256
                    minLength: 1
                    type: string
                  value:
                    maxLength: 8192
                    minLength: 1
                    type: string
                required:
                  - axisKey
                  - value
                type: object
              maxItems: 100
              type: array
            configuredAnswers:
              items:
                additionalProperties: false
                properties:
                  fieldKey:
                    maxLength: 256
                    minLength: 1
                    type: string
                  status:
                    enum:
                      - answered
                      - partial
                      - missing
                      - not_applicable
                    type: string
                  value:
                    anyOf:
                      - maxLength: 8192
                        minLength: 1
                        type: string
                      - type: number
                      - type: boolean
                      - type: "null"
                      - items:
                          anyOf:
                            - maxLength: 8192
                              minLength: 1
                              type: string
                            - type: number
                            - type: boolean
                            - type: "null"
                        maxItems: 100
                        type: array
                required:
                  - fieldKey
                  - value
                  - status
                type: object
              maxItems: 100
              type: array
            insights:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            missingFields:
              items:
                maxLength: 256
                minLength: 1
                type: string
              maxItems: 100
              type: array
            openQuestions:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            operatorHandoff:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            recommendedActions:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            riskNotes:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            salesHandoff:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            scores:
              additionalProperties: false
              properties:
                completeness:
                  anyOf:
                    - type: number
                    - type: "null"
                intent:
                  anyOf:
                    - type: number
                    - type: "null"
              required:
                - intent
                - completeness
              type: object
            summary:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
          required:
            - summary
            - operatorHandoff
            - salesHandoff
            - configuredAnswers
            - missingFields
            - scores
            - classifications
            - analysisAnswers
            - insights
            - recommendedActions
            - openQuestions
            - riskNotes
          type: object
        campaign:
          anyOf:
            - additionalProperties: false
              properties:
                id:
                  maxLength: 256
                  minLength: 1
                  type: string
                name:
                  maxLength: 8192
                  minLength: 1
                  type: string
              required:
                - id
                - name
              type: object
            - type: "null"
        consents:
          items:
            additionalProperties: false
            properties:
              granted:
                type: boolean
              scopeKey:
                maxLength: 256
                minLength: 1
                type: string
            required:
              - scopeKey
              - granted
            type: object
          maxItems: 100
          type: array
        interaction:
          additionalProperties: false
          properties:
            channel:
              enum:
                - phone
                - web_voice
                - text
                - controlled_transcript
              type: string
            endedAt:
              format: date-time
              pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
              type: string
            id:
              maxLength: 256
              minLength: 1
              type: string
            outcome:
              enum:
                - completed
                - cancelled
                - failed
                - not_connected
                - abandoned
              type: string
            reasonCode:
              enum:
                - respondent_ended
                - platform_ended
                - operator_cancelled
                - no_answer
                - busy
                - rejected
                - timeout
                - technical_error
                - unknown
              type: string
          required:
            - id
            - channel
            - outcome
            - reasonCode
            - endedAt
          type: object
        lifecycleSequence:
          const: 2
          type: number
        organization:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
          type: object
        respondent:
          additionalProperties: false
          properties:
            email:
              anyOf:
                - maxLength: 320
                  type: string
                - type: "null"
            name:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            phone:
              anyOf:
                - maxLength: 32
                  type: string
                - type: "null"
          required:
            - name
            - email
            - phone
          type: object
        scenario:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
            name:
              maxLength: 8192
              minLength: 1
              type: string
            revision:
              anyOf:
                - exclusiveMinimum: 0
                  maximum: 9007199254740991
                  type: integer
                - type: "null"
            slug:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
            - slug
            - name
            - revision
          type: object
        truncation:
          additionalProperties: false
          properties:
            omittedFields:
              items:
                maxLength: 512
                type: string
              maxItems: 100
              type: array
            truncated:
              type: boolean
          required:
            - truncated
            - omittedFields
          type: object
      required:
        - organization
        - interaction
        - campaign
        - scenario
        - respondent
        - consents
        - truncation
        - lifecycleSequence
        - analysis
      title: com.elicitra.analysis.completed.v1 data
      type: object
    ComElicitraAnalysisFailedV1:
      additionalProperties: false
      properties:
        campaign:
          anyOf:
            - additionalProperties: false
              properties:
                id:
                  maxLength: 256
                  minLength: 1
                  type: string
                name:
                  maxLength: 8192
                  minLength: 1
                  type: string
              required:
                - id
                - name
              type: object
            - type: "null"
        consents:
          items:
            additionalProperties: false
            properties:
              granted:
                type: boolean
              scopeKey:
                maxLength: 256
                minLength: 1
                type: string
            required:
              - scopeKey
              - granted
            type: object
          maxItems: 100
          type: array
        failure:
          additionalProperties: false
          properties:
            category:
              enum:
                - provider
                - validation
                - timeout
                - platform
                - unknown
              type: string
            code:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - code
            - category
          type: object
        interaction:
          additionalProperties: false
          properties:
            channel:
              enum:
                - phone
                - web_voice
                - text
                - controlled_transcript
              type: string
            endedAt:
              format: date-time
              pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
              type: string
            id:
              maxLength: 256
              minLength: 1
              type: string
            outcome:
              enum:
                - completed
                - cancelled
                - failed
                - not_connected
                - abandoned
              type: string
            reasonCode:
              enum:
                - respondent_ended
                - platform_ended
                - operator_cancelled
                - no_answer
                - busy
                - rejected
                - timeout
                - technical_error
                - unknown
              type: string
          required:
            - id
            - channel
            - outcome
            - reasonCode
            - endedAt
          type: object
        lifecycleSequence:
          const: 2
          type: number
        organization:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
          type: object
        respondent:
          additionalProperties: false
          properties:
            email:
              anyOf:
                - maxLength: 320
                  type: string
                - type: "null"
            name:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            phone:
              anyOf:
                - maxLength: 32
                  type: string
                - type: "null"
          required:
            - name
            - email
            - phone
          type: object
        scenario:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
            name:
              maxLength: 8192
              minLength: 1
              type: string
            revision:
              anyOf:
                - exclusiveMinimum: 0
                  maximum: 9007199254740991
                  type: integer
                - type: "null"
            slug:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
            - slug
            - name
            - revision
          type: object
        truncation:
          additionalProperties: false
          properties:
            omittedFields:
              items:
                maxLength: 512
                type: string
              maxItems: 100
              type: array
            truncated:
              type: boolean
          required:
            - truncated
            - omittedFields
          type: object
      required:
        - organization
        - interaction
        - campaign
        - scenario
        - respondent
        - consents
        - truncation
        - lifecycleSequence
        - failure
      title: com.elicitra.analysis.failed.v1 data
      type: object
    ComElicitraAutomationTriggeredV1:
      additionalProperties: false
      properties:
        activation:
          additionalProperties: false
          properties:
            executionId:
              maxLength: 256
              minLength: 1
              type: string
            matchedConditions:
              items:
                additionalProperties: false
                properties:
                  actual:
                    anyOf:
                      - maxLength: 8192
                        minLength: 1
                        type: string
                      - type: number
                      - type: "null"
                  expected:
                    anyOf:
                      - maxLength: 8192
                        minLength: 1
                        type: string
                      - type: number
                  field:
                    maxLength: 256
                    minLength: 1
                    type: string
                  operator:
                    enum:
                      - gte
                      - lte
                      - equals
                      - not_equals
                    type: string
                  source:
                    enum:
                      - score
                      - classification
                    type: string
                required:
                  - source
                  - field
                  - operator
                  - expected
                  - actual
                type: object
              maxItems: 8
              type: array
            ruleId:
              maxLength: 256
              minLength: 1
              type: string
            ruleLabel:
              maxLength: 8192
              minLength: 1
              type: string
          required:
            - executionId
            - ruleId
            - ruleLabel
            - matchedConditions
          type: object
        analysis:
          additionalProperties: false
          properties:
            analysisAnswers:
              items:
                additionalProperties: false
                properties:
                  answer:
                    maxLength: 8192
                    minLength: 1
                    type: string
                  questionKey:
                    maxLength: 256
                    minLength: 1
                    type: string
                required:
                  - questionKey
                  - answer
                type: object
              maxItems: 100
              type: array
            classifications:
              items:
                additionalProperties: false
                properties:
                  axisKey:
                    maxLength: 256
                    minLength: 1
                    type: string
                  value:
                    maxLength: 8192
                    minLength: 1
                    type: string
                required:
                  - axisKey
                  - value
                type: object
              maxItems: 100
              type: array
            configuredAnswers:
              items:
                additionalProperties: false
                properties:
                  fieldKey:
                    maxLength: 256
                    minLength: 1
                    type: string
                  status:
                    enum:
                      - answered
                      - partial
                      - missing
                      - not_applicable
                    type: string
                  value:
                    anyOf:
                      - maxLength: 8192
                        minLength: 1
                        type: string
                      - type: number
                      - type: boolean
                      - type: "null"
                      - items:
                          anyOf:
                            - maxLength: 8192
                              minLength: 1
                              type: string
                            - type: number
                            - type: boolean
                            - type: "null"
                        maxItems: 100
                        type: array
                required:
                  - fieldKey
                  - value
                  - status
                type: object
              maxItems: 100
              type: array
            insights:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            missingFields:
              items:
                maxLength: 256
                minLength: 1
                type: string
              maxItems: 100
              type: array
            openQuestions:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            operatorHandoff:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            recommendedActions:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            riskNotes:
              items:
                maxLength: 8192
                minLength: 1
                type: string
              maxItems: 100
              type: array
            salesHandoff:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            scores:
              additionalProperties: false
              properties:
                completeness:
                  anyOf:
                    - type: number
                    - type: "null"
                intent:
                  anyOf:
                    - type: number
                    - type: "null"
              required:
                - intent
                - completeness
              type: object
            summary:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
          required:
            - summary
            - operatorHandoff
            - salesHandoff
            - configuredAnswers
            - missingFields
            - scores
            - classifications
            - analysisAnswers
            - insights
            - recommendedActions
            - openQuestions
            - riskNotes
          type: object
        campaign:
          anyOf:
            - additionalProperties: false
              properties:
                id:
                  maxLength: 256
                  minLength: 1
                  type: string
                name:
                  maxLength: 8192
                  minLength: 1
                  type: string
              required:
                - id
                - name
              type: object
            - type: "null"
        consents:
          items:
            additionalProperties: false
            properties:
              granted:
                type: boolean
              scopeKey:
                maxLength: 256
                minLength: 1
                type: string
            required:
              - scopeKey
              - granted
            type: object
          maxItems: 100
          type: array
        interaction:
          additionalProperties: false
          properties:
            channel:
              enum:
                - phone
                - web_voice
                - text
                - controlled_transcript
              type: string
            endedAt:
              format: date-time
              pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
              type: string
            id:
              maxLength: 256
              minLength: 1
              type: string
            outcome:
              enum:
                - completed
                - cancelled
                - failed
                - not_connected
                - abandoned
              type: string
            reasonCode:
              enum:
                - respondent_ended
                - platform_ended
                - operator_cancelled
                - no_answer
                - busy
                - rejected
                - timeout
                - technical_error
                - unknown
              type: string
          required:
            - id
            - channel
            - outcome
            - reasonCode
            - endedAt
          type: object
        organization:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
          type: object
        respondent:
          additionalProperties: false
          properties:
            email:
              anyOf:
                - maxLength: 320
                  type: string
                - type: "null"
            name:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            phone:
              anyOf:
                - maxLength: 32
                  type: string
                - type: "null"
          required:
            - name
            - email
            - phone
          type: object
        scenario:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
            name:
              maxLength: 8192
              minLength: 1
              type: string
            revision:
              anyOf:
                - exclusiveMinimum: 0
                  maximum: 9007199254740991
                  type: integer
                - type: "null"
            slug:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
            - slug
            - name
            - revision
          type: object
        truncation:
          additionalProperties: false
          properties:
            omittedFields:
              items:
                maxLength: 512
                type: string
              maxItems: 100
              type: array
            truncated:
              type: boolean
          required:
            - truncated
            - omittedFields
          type: object
      required:
        - organization
        - interaction
        - campaign
        - scenario
        - respondent
        - consents
        - truncation
        - analysis
        - activation
      title: com.elicitra.automation.triggered.v1 data
      type: object
    ComElicitraInteractionEndedV1:
      additionalProperties: false
      properties:
        campaign:
          anyOf:
            - additionalProperties: false
              properties:
                id:
                  maxLength: 256
                  minLength: 1
                  type: string
                name:
                  maxLength: 8192
                  minLength: 1
                  type: string
              required:
                - id
                - name
              type: object
            - type: "null"
        consents:
          items:
            additionalProperties: false
            properties:
              granted:
                type: boolean
              scopeKey:
                maxLength: 256
                minLength: 1
                type: string
            required:
              - scopeKey
              - granted
            type: object
          maxItems: 100
          type: array
        interaction:
          additionalProperties: false
          properties:
            channel:
              enum:
                - phone
                - web_voice
                - text
                - controlled_transcript
              type: string
            endedAt:
              format: date-time
              pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$
              type: string
            id:
              maxLength: 256
              minLength: 1
              type: string
            outcome:
              enum:
                - completed
                - cancelled
                - failed
                - not_connected
                - abandoned
              type: string
            reasonCode:
              enum:
                - respondent_ended
                - platform_ended
                - operator_cancelled
                - no_answer
                - busy
                - rejected
                - timeout
                - technical_error
                - unknown
              type: string
          required:
            - id
            - channel
            - outcome
            - reasonCode
            - endedAt
          type: object
        lifecycleSequence:
          const: 1
          type: number
        organization:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
          type: object
        respondent:
          additionalProperties: false
          properties:
            email:
              anyOf:
                - maxLength: 320
                  type: string
                - type: "null"
            name:
              anyOf:
                - maxLength: 8192
                  minLength: 1
                  type: string
                - type: "null"
            phone:
              anyOf:
                - maxLength: 32
                  type: string
                - type: "null"
          required:
            - name
            - email
            - phone
          type: object
        scenario:
          additionalProperties: false
          properties:
            id:
              maxLength: 256
              minLength: 1
              type: string
            name:
              maxLength: 8192
              minLength: 1
              type: string
            revision:
              anyOf:
                - exclusiveMinimum: 0
                  maximum: 9007199254740991
                  type: integer
                - type: "null"
            slug:
              maxLength: 256
              minLength: 1
              type: string
          required:
            - id
            - slug
            - name
            - revision
          type: object
        truncation:
          additionalProperties: false
          properties:
            omittedFields:
              items:
                maxLength: 512
                type: string
              maxItems: 100
              type: array
            truncated:
              type: boolean
          required:
            - truncated
            - omittedFields
          type: object
      required:
        - organization
        - interaction
        - campaign
        - scenario
        - respondent
        - consents
        - truncation
        - lifecycleSequence
      title: com.elicitra.interaction.ended.v1 data
      type: object
  securitySchemes:
    elicitraSignature:
      description: HMAC-SHA256 signatures in `t=<unix>,v1=<hex>` form over `<timestamp>.<rawBody>`. During rotation the header can contain two `v1` values; accept any current signature within five minutes.
      in: header
      name: Elicitra-Signature
      type: httpApiKey
defaultContentType: application/cloudevents+json
info:
  description: Signed, data-minimized lifecycle subscriptions and conditional automation events delivered by Betterstood.
  title: Betterstood webhook events
  version: 1.1.0
operations:
  receiveWebhookEvent:
    action: receive
    channel:
      $ref: "#/channels/events"
    messages:
      - $ref: "#/channels/events/messages/ComElicitraInteractionEndedV1Message"
      - $ref: "#/channels/events/messages/ComElicitraAnalysisCompletedV1Message"
      - $ref: "#/channels/events/messages/ComElicitraAnalysisFailedV1Message"
      - $ref: "#/channels/events/messages/ComElicitraAutomationTriggeredV1Message"
servers:
  receiver:
    description: The verified HTTPS/443 endpoint configured by the platform customer.
    host: customer.example
    pathname: /elicitra/webhooks
    protocol: https
    security:
      - $ref: "#/components/securitySchemes/elicitraSignature"
