Skip to main content

Uniphore Customer Portal

Fetch Sentiments

The Fetch Sentiments API retrieves the sentiment of a given contact.

Endpoint

Method: GET

URL: sentiments/{contactId}

Header Parameter

Authorization Bearer <Token>

Path Parameter

Parameter Name

Mandatory/

Optional

Type

Description

contactId

Mandatory

string

Id of the contact whose sentiment needs to be fetched

Example Request
curl -H "Authorization: Bearer 911999706310ffbcb32981863e23ce72d5e60d7b" -XGET http://host:port/sentiments/{contactId}
Example Response
{
  "_id": "5efcc89e2efc67ea7de09b71",
  "sessionId": "57931",
  "startTime": 1593161838000,
  "isChunk": false,
  "turns": [
    {
      "order": 1,
      "speaker": "Agent",
      "sentiment": {
        "value": "NEUTRAL",
        "confidence": 0.52
      }
    },
    {
      "order": 2,
      "speaker": "Customer",
      "sentiment": {
        "value": "NEUTRAL",
        "confidence": 0.85
      }
    },
    {
      "order": 3,
      "speaker": "Agent",
      "sentiment": {
        "value": "NEUTRAL",
        "confidence": 0.92
      }
    },
    {
      "order": 4,
      "speaker": "Customer",
      "sentiment": {
        "value": "POSITIVE",
        "confidence": 0.77
      }
    }
  ],
  "overall": {
    "sentiment": {
      "agentSentiment": "NEUTRAL",
      "customerSentiment": "POSITIVE"
    }
  },
  "metadata": {
    "agentId": "353",
    "organizationId": "2",
    "tenantId": "1",
    "customerId": "205",
    "contactId": "cc1adf1d-4d01-4968-9168-529a5767041e",
    "categoryId": "13",
    "type": "batch",
    "contactType": "voice",
    "convId": "PreethiNTEStereo0001",
    "isDiarized": true,
    "contactDuration": 486987
  },
  "__ts": 1584151104000
}
Response and Error Codes

Code

Response

200

OK – The request was successful

401

{“reason”:”Authentication failed”}

404

Record Not Found

500

{“error”: “Internal server error”}