Enable sentiment analysis with the following configuration:

sentimentAnalysis
bool
default:
"false"

Perform sentiment analysis on the upstream content.

Pre-recorded

Usage

curl -X 'POST' \
  'https://http-gateway.vatis.tech/http-gateway/api/v1/upload?streamConfigurationTemplateId=668115d123bca7e3509723d4&sentimentAnalysis=true&persist=true' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic <api_key>' \
  -H 'Content-Type: application/octet-stream' \
  --data-binary '@test.wav'

Mono audio

{
  ...
  "sentimentAnalysis": {
    "segments": [
      {
        "text": " Good afternoon. My name is Aisha. Thank you for calling *** today. How may I be of assistance?",
        "sentiment": "positive",
        "startTime": 820,
        "endTime": 6120,
        "score": 0.9
      },
      {
        "text": " Hi, Aisha. Well, I want to sign up for the Wi-Fi service.",
        "sentiment": "positive",
        "startTime": 7660,
        "endTime": 13460,
        "score": 0.5
      },
      ...
    ],
    "summary": {
      "negativeCount": 2,
      "positiveCount": 21,
      "neutralCount": 31,
      "averageScore": 0.24444444444444446,
      "sentiment": "neutral"
    }
  }
}

Stereo audio

{
  ...
  "sentimentAnalysis": {
    "segments": [
      {
        "text": " Good afternoon. My name is Aisha. Thank you for calling *** today. How may I be of assistance?",
        "sentiment": "positive",
        "channel": 0,
        "startTime": 1010,
        "endTime": 6130,
        "score": 0.9
      },
      {
        "text": " Hi, Aisha. Well, I want to sign up for the Wi-Fi service.",
        "sentiment": "positive",
        "channel": 1,
        "startTime": 7660,
        "endTime": 24180,
        "score": 0.5
      },
      ...
    ],
    "summary": {
      "channels": [
        {
          "channel": 0,
          "negativeCount": 0,
          "positiveCount": 17,
          "neutralCount": 11,
          "averageScore": 0.3642857142857143,
          "sentiment": "positive"
        },
        {
          "channel": 1,
          "negativeCount": 1,
          "positiveCount": 10,
          "neutralCount": 17,
          "averageScore": 0.22142857142857145,
          "sentiment": "neutral"
        }
      ],
      "negativeCount": 1,
      "positiveCount": 27,
      "neutralCount": 28,
      "averageScore": 0.2928571428571428,
      "sentiment": "neutral"
    }
  }
}

Real-time

The sentiment analysis results can be consumed in real-time.

Each sentiment analysis message will contain either an utterance sentiment analysis or a summary sentiment analysis.

Utterance sentiment analysis

The sentiment analysis will be performed for each utterance in the conversation.

{
    "promptId": "sentimentAnalysis",
    "sequenceId": 0,
    "sentimentAnalysis": [
        {
            "text": " Good afternoon. My name is Aisha. Thank you for calling Verizon today. How may I be of assistance?",
            "sentiment": "positive",
            "channel": 0,
            "startTime": 0,
            "endTime": 7679,
            "score": 0.8
        }
    ]
}

Summary sentiment analysis

After all the utterances have been processed, a summary sentiment analysis will be provided.

{
    "promptId": "sentimentAnalysis",
    "sequenceId": 9,
    "sentimentAnalysisSummary": {
        "channels": [
            {
                "channel": 1,
                "negativeCount": 0,
                "positiveCount": 1,
                "neutralCount": 3,
                "averageScore": 0.2,
                "sentiment": "neutral"
            },
            {
                "channel": 0,
                "negativeCount": 0,
                "positiveCount": 4,
                "neutralCount": 1,
                "averageScore": 0.52,
                "sentiment": "positive"
            }
        ],
        "negativeCount": 0,
        "positiveCount": 5,
        "neutralCount": 4,
        "averageScore": 0.3777777777777778,
        "sentiment": "positive"
    }
}