Getting information about a dialog in REST API
Getting started
To get information about a dialog via the Yandex Cloud REST API:
To search data via the Yandex Cloud REST API:
-
In the management console, create a service account.
- Add the service account to the namespace with the
Data viewer
role. This will allow your service account to work with data in SpeechSense. -
To authenticate to the Yandex Cloud API, create an API key or IAM token for the service account.
- Upload voice call recordings or chat transcripts to SpeechSense.
- Get the dialog ID using full-text search or filtering by parameters.
Getting information about a dialog
-
In the folder, create a file named
get.json
with the following parameters to get the dialog you need:{ "organizationId": "<organization_ID>", "spaceId": "<space_ID>", "connectionId": "<connection_ID>", "projectId": "<project_ID>", "talk_ids": [ "<dialog_ID>" ], "results_mask": { "paths": [ "<requested_field_keys>" ] } }
Where:
organizationId
: ID of the organization the request takes place in. To get the ID, go to Cloud Center and click under the name of the organization in the section.spaceId
: ID of the space the request takes place in. To get the ID, go to SpeechSense , open the page of the space you need and click ID.connectionId
: ID of the connection the request takes place in. To get the ID, go to SpeechSense , open the page of the space you need. On the Connection tab, open the page of the connection and click ID.projectId
: ID of the project the request takes place in. To get an ID, go to SpeechSense , open the page of the space you need. On the Projects tab, open the page of the project and click ID.
-
talk_ids
: IDs of the dialogs you want to get information about. To find out the dialog IDs, use a search query. -
results_mask
: Result mask. If this parameter is not provided, you will get the full information about the dialog, whereas if the parameter is provided with an emptypaths
list, you will get only the basic information about the dialog, such as the IDs of the project, connection, and space, information about when and by whom the dialog was created or modified, and the metadata added when uploading the dialog. To unload individual fields with data, provide the keys of the required fields in thepaths
list to the mask:transcription
: Audio text transcript or chat text messages.speech_statistics
: Speech statistics.silence_statistics
: Statistics of pauses in the dialog.interrupts_statistics
: Statistics of conversation partner interruptions.conversation_statistics
: Dialog statistics.points
: Dialog summary.text_classifiers
: Statistics for classifiers (tags).
For more information about GET request parameters, see the API reference.
-
Make a GET request to the SpeechSense API using cURL:
curl -X POST https://rest-api.speechsense.yandexcloud.net/speechsense/v1/talks/get \ -H "Content-Type: application/json" \ -H "authorization: Api-Key ${API_KEY}" \ -d @get.json
Where
Api-Key
is the API key for authentication. If using an IAM token, specifyBearer ${IAM_TOKEN}
instead ofApi-Key ${API_KEY}
.The results will be output to the terminal in JSON format.
Request body example for getting information about a dialog
For example, you need to get a summary of a dialog with technical support, where the agent proposed filing a ticket for a technician's visit. To get the ID of such a dialog, use this request example for full-text search.
Your JSON file with the request parameters will look as follows:
{
"organizationId": "yc.organization****************",
"spaceId": "f3fuclf1kufs********",
"connectionId": "eag0u346n4hn********",
"projectId": "eag9t3rm3o43********",
"talk_ids": ["aud95sn63lra********"],
"results_mask": {
"paths": ["points"]
}
}
Query execution results
{
"talk": [
{
"id": "aud95sn63lra********",
"organization_id": "yc.organization****************",
"space_id": "f3fuclf1kufs********",
"connection_id": "eag0u346n4hn********",
"project_ids": [
"eag9t3rm3o43********"
],
"created_by": "ajeugoqa16o5********",
"created_at": "2024-09-24T08:53:09.932Z",
"modified_by": "CLASSIFIER",
"modified_at": "2024-09-24T18:06:08.299Z",
"talk_fields": [
{
"name": "operator_name",
"value": "Agent",
"type": "FIELD_TYPE_STRING"
},
{
"name": "operator_id",
"value": "operator_id",
"type": "FIELD_TYPE_STRING"
},
{
"name": "client_name",
"value": "Customer",
"type": "FIELD_TYPE_STRING"
},
{
"name": "client_id",
"value": "customer_id",
"type": "FIELD_TYPE_STRING"
},
{
"name": "bot_name",
"value": "Bot",
"type": "FIELD_TYPE_STRING"
},
{
"name": "bot_id",
"value": "bot_id",
"type": "FIELD_TYPE_STRING"
},
{
"name": "date",
"value": "2024-09-24T11:11:11.111Z",
"type": "FIELD_TYPE_DATE"
},
{
"name": "direction_outgoing",
"value": "true",
"type": "FIELD_TYPE_BOOLEAN"
},
{
"name": "language",
"value": "Russian",
"type": "FIELD_TYPE_STRING"
}
],
"transcription": null,
"speech_statistics": null,
"silence_statistics": null,
"interrupts_statistics": null,
"conversation_statistics": null,
"points": {
"quiz": [
{
"request": "1. Was the agent polite?",
"response": "1. Yes",
"id": "1"
},
{
"request": "2. Was the agent annoyed?",
"response": "2. No",
"id": "2"
},
{
"request": "3. Was the agent engaged in the dialog?",
"response": "3. No",
"id": "3"
},
{
"request": "4. Was the agent empathic?",
"response": "4. Yes",
"id": "4"
},
{
"request": "5. Was the agent rude?",
"response": "5. No",
"id": "5"
},
{
"request": "6. Did the agent solve the customer's problem?",
"response": "6. No",
"id": "6"
},
{
"request": "7. Was the agent confident?",
"response": "7. Yes",
"id": "7"
},
{
"request": "8. Did the customer leave annoyed?",
"response": "8. No",
"id": "8"
},
{
"request": "9. Was the customer satisfied?",
"response": "9. Yes",
"id": "9"
},
{
"request": "10. Was the customer rude?",
"response": "10. No",
"id": "10"
}
]
},
"text_classifiers": null
}
]
}