SyncQualityCheck

Updated at:

Perform real-time quality inspection for hotlines.

Operation description

Real-time hotline quality inspection transcribes spoken dialogue into text during a call. It sends the text to the Smart Conversation Analysis system for real-time quality inspection to detect potential issues or risks. You can display the dialogue text and inspection results in real time on the customer service representative's workbench (a third-party system). This differs from offline quality inspection, which uses UploadAudioData for inspection or dataset inspection. For details, see the developer guide. Offline quality inspection occurs after the call ends and the recording file is generated.

Usage Flow

You can implement real-time transcription of audio streams to text during calls, or use Alibaba Cloud Call Center (CC) directly. CC integrates deeply with Smart Conversation Analysis, enabling real-time quality inspection during calls without API integration.

If you implement audio-to-text conversion yourself, invoke the SyncQualityCheck API for real-time quality inspection after a speaker finishes a sentence and generates dialogue text. This returns the inspection result for that sentence synchronously.

You should include skill group information when uploading data. Then, you can use the Call Center Quality Inspection - Configuration Management feature to configure different quality inspection rules for calls from different skill groups.

After the call ends, you can store the recording file on a storage server accessible over the public network. You can invoke the recording information maintenance API: UpdateSyncQualityCheckData. You can submit the recording name, recording file URL, and other details to the Smart Conversation Analysis service. This lets quality inspectors play back the recording during review.

After the call ends, you can view the quality inspection results in Call Center Quality Inspection - Result Display - Real-time Quality Inspection Results. You can also invoke the real-time quality inspection result query API: GetSyncResult to retrieve the results. You can use Score Dashboard - Real-time Dashboard to view data charts for customer service representatives, skill groups, and scoring items.

Full-Text Quality Inspection

Quality inspection rules include dozens of operators. Some operators require dialogue context (multi-turn conversations between customer service representatives and customers) for analysis. However, real-time quality inspection occurs during a call and typically uses text from only one sentence spoken by a single speaker. Some operators are not suitable for real-time quality inspection. Therefore, quality inspection rules are divided into real-time quality inspection rules and full-text quality inspection rules:

Real-time quality inspection rules: Rules used for real-time quality inspection. They support a limited number of operator types. They do not support specifying the detection range for operators.

Full-text quality inspection rules: Rules used for offline quality inspection. They support all operator types. They support custom detection ranges for operators.

For calls that underwent real-time quality inspection, you can apply full-text quality inspection rules to the complete dialogue text after the call ends. To enable full-text quality inspection after real-time inspection, see the full-text quality inspection description in Call Center Quality Inspection - Configuration Management.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

sca:SyncQualityCheck

create

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

JsonStr

string

Yes

Complete JSON string information. See the details below.

{"tid":"20200823-234234","dialogue":"{}"}

BaseMeAgentId

integer

No

Workspace ID.

1244721

jsonStr Properties:

PropertyValue TypeRequiredDescription
sourceTypeIntYesData type. 1: real-time voice, 0: real-time text.
uuidStringNoUnique identifier for the current sentence, used for idempotence. Duplicate requests are deduplicated. The deduplication period is 24 hours.
tidStringYesUnique identifier for the current conversation (ensure uniqueness). This can be the call ID in your business system. The backend merges a complete conversation based on this ID. The length must be at least 8 characters, with the first 8 characters representing the call's date (YYYYMMDD). For example, if the recording date is July 5, 2020, the prefix is 20200705. Append your business system's call ID after the prefix, such as 20200705-234890134. The prefix date must be within one month before or one hour after the API call time.
dialogueDialogueYesThe dialogue content to be inspected by the business. This is typically one sentence, but can be multiple sentences. See the jsonStr.dialogue Properties below for details.
dialogueStatusIntegerNoSession start/end identifier. 1: start, 2: in conversation.
beginTimeLongNoStart time of the recording and dialogue, in milliseconds since January 1, 1970, 00:00:00 UTC (UNIX timestamp in milliseconds, such as 1584535485856). If provided with each call, the first call's value takes precedence. If not specified, the current time is used.
customerServiceIdLongNoCustomer service representative ID. Obtain this from the Console - Basic Settings - Personnel Management page. Enter the correct customer service representative ID so that the representative can view associated recording files when logging on to the console page.
customerServiceNameStringNoCustomer service representative name.
skillGroupIdLongNoSkill Group ID.
skillGroupNameStringNoSkill Group Name.
callTypeIntegerNoCall type. Valid values: 1 (outbound) (default); 3 (inbound); 4 (other).
calleeStringNoCallee number. For outbound calls, this is the customer's number. For inbound calls, this is the customer service representative's number.
callerStringNoCaller number. For outbound calls, this is the customer service representative's number. For inbound calls, this is the customer's number.
callIdStringNoCall ID. This can be the call ID in the call center system or another ID that identifies the call. If a transfer occurs, callId remains the same for agents 1 to n, but tid differs.
businessStringNoLine-of-business name. This is custom data used for categorization and statistics.
remark1StringNoCustom data 1. Store custom fields related to your business. The maximum length is 32 characters.
remark2StringNoCustom data 2. Store custom fields related to your business. The maximum length is 32 characters.
remark3StringNoCustom data 3. Store custom fields related to your business. The maximum length is 32 characters.
requiredFieldsStringNoAdditional fields in the response parameter. Valid values: ruleInfoBase (rule information); ruleInfoBase.ruleCategoryName (rule category name).

jsonStr.dialogue Properties:

PropertyValue TypeRequiredDescription
roleStringYesRole in the dialogue content. Valid values: customer service representative, customer, system.
identityStringNoSpecific identity for the dialogue role, such as customer service representative ID or customer ID.
wordsStringYesThe sentence spoken by this role. Only UTF-8 encoding is supported. For example, Emoji characters are not UTF-8 encoded; do not include Emoji characters in the text content.
beginIntegerYesStart time offset relative to the starting point, in milliseconds.
endIntegerYesEnd time offset relative to the starting point, in milliseconds.
emotionValueIntegerNoEmotional energy value from 1 to 10. Higher values indicate stronger emotions.
speechRateIntegerNoAverage speech rate for this sentence, in characters per minute.
silenceDurationIntegerNoSilence duration between this sentence and the previous one, in seconds.

Request Parameter Example

{
  "sourceType": 0,
  "beginTime": 1724390164363,
  "callId": "job-548734733657395200",
  "customerName": "Zhang San Voice 11",
  "customerId": "zhangsan-vip-audio",
  "customerServiceId": "270071956987960408",
  "customerServiceName": "siqiyj",
  "dialogue": {
    "begin": 23596,
    "emotionValue": 0,
    "end": 24836,
    "role": "customer",
    "speechRate": 62,
    "words": "Ah, yes, yes, yes."
  },
  "skillGroupId": "e5bfc9fc-f860-4a33-a4e6-80321aa1ff64",
  "skillGroupName": "e5bfc9fc-f860-4a33-a4e6-80321aa1ff64",
  "tid": "20240823job-548734733657395200",
  "uuid": "258af5784bbaff9a503e056f39291a5d"
}

Request Code Example

public class sca {

    private static String ak = "YOUR_ACCESS_KEY_ID";
    private static String sk = "YOUR_ACCESS_KEY_SECRET";

    private static void sync() throws Exception {
        String json = "{\n" +
                "  \"sourceType\": 0,\n" +
                "  \"beginTime\": 1724390164363,\n" +
                "  \"callId\": \"job-548734733657395200\",\n" +
                "  \"customerName\": \"Zhang San Voice 11\",\n" +
                "  \"customerId\": \"zhangsan-vip-audio\",\n" +
                "  \"customerServiceId\": \"270071956987960408\",\n" +
                "  \"customerServiceName\": \"siqiyj\",\n" +
                "  \"dialogue\": {\n" +
                "    \"begin\": 23596,\n" +
                "    \"emotionValue\": 0,\n" +
                "    \"end\": 24836,\n" +
                "    \"role\": \"customer\",\n" +
                "    \"speechRate\": 62,\n" +
                "    \"words\": \"Ah, yes, yes, yes.\"\n" +
                "  },\n" +
                "  \"skillGroupId\": \"e5bfc9fc-f860-4a33-a4e6-80321aa1ff64\",\n" +
                "  \"skillGroupName\": \"e5bfc9fc-f860-4a33-a4e6-80321aa1ff64\",\n" +
                "  \"tid\": \"20240823job-548734733657395200\",\n" +
                "  \"uuid\": \"258af5784bbaff9a503e056f39291a5d\"\n" +
                "}";


        Config config = new Config();
        config.setAccessKeyId(ak).setAccessKeySecret(sk)
                .setEndpoint("qualitycheck.cn-hangzhou.aliyuncs.com")
                .setRegionId("cn-hangzhou").setProtocol("HTTPS");

        Client client = new Client(config);
        SyncQualityCheckRequest result = new SyncQualityCheckRequest();

        result.setJsonStr(json);

        SyncQualityCheckResponse response = client.syncQualityCheck(result);
        System.out.println(JSONObject.toJSONString(response));
    }

    public static void main(String[] args) throws Exception {
        sync();
    }
}

Response elements

Element

Type

Description

Example

object

Code

string

Result status code. 200 indicates success. Other values indicate failure. The caller can determine the reason for failure using this field.

200

Message

string

Error details if an error occurs. "successful" if successful.

successful

RequestId

string

Unique request identifier.

66E1ACB8-17B2-4BE8-8581-954A8*****

Success

boolean

Indicates whether the request was successful. The caller can use this field to determine if the request succeeded: true for success; false/null for failure.

true

Data

object

Returned result, including hit information.

Score

integer

Final score, with a maximum of 100.

100

TaskId

string

Task ID.

66E1ACB866E1ACB8

Tid

string

Unique identifier for the current conversation.

20200876-66E1ACB8

BeginTime

integer

Time of recording and dialogue occurrence, in milliseconds since January 1, 1970, 00:00:00 UTC (UNIX timestamp in milliseconds, such as 1584535485856).

1584535485856

Rules

array<object>

List of hit rules. Each item is a rule. Only hit rule information and hit rule location information are returned.

array<object>

RuleName

string

Name of the hit rule.

禁用语

Rid

string

ID of the hit rule.

232232

RuleInfoBase

object

Rule basic information

Level

integer

Rule importance level

2

Comments

string

Rule remarks

邀约客户,客户不同意参加试听

ScoreNum

integer

Score value

1

ScoreType

integer

1 for bonus points, 3 for penalty points. Default is 1.

1

ScoreNumType

integer

Scoring type. 0: bonus/penalty points, 1: one-time score.

1

Type

integer

Rule type ID

Important The requiredFields parameter must include "ruleInfoBase".

1

RuleCategoryName

string

Rule category name

Important The requiredFields parameter must include "ruleInfoBase.ruleCategoryName".

服务规范

Hit

array<object>

List of hit sentences. For this API, if a hit occurs, it is a single data entry.

array<object>

HitKeyWords

array<object>

Keywords that met the condition.

object

To

integer

End position of the keyword.

4

From

integer

Start position of the keyword.

1

Val

string

Keyword.

你好

Cid

integer

Condition ID of the rule.

2312

Pid

integer

Index value of the hit sentence in the entire conversation.

4

Phrase

object

Dialogue content that met the condition.

Words

string

Dialogue content.

你好请问有什么可以帮您的

Identity

string

Deprecated field. Ignore it.

xxx

Begin

integer

Start time of this sentence relative to the entire conversation, in milliseconds.

1230

EmotionValue

integer

Emotional value of this sentence, 0-10. Higher values indicate stronger emotions.

6

End

integer

End time of this sentence relative to the entire conversation, in milliseconds.

3440

SpeechRate

integer

Speech rate of this sentence, in characters per minute.

233

Role

string

Role of this sentence. Valid values: customer service representative, customer.

客服

SilenceDuration

integer

Deprecated field. Ignore it.

123

Dialogue Context Sentence Description: In complex scenarios, a single sentence from a speaker might not be enough to detect violations. Previous sentences are often needed as context for quality inspection analysis. The current maximum number of context sentences is 30 by default. For example, in a call where the 40th sentence has been spoken, after uploading the 40th sentence, we retrieve the preceding 29 sentences. This creates a total of 30 sentences, including the latest 40th sentence, for quality inspection analysis. Therefore, in extreme cases, some sentences undergo quality inspection analysis 30 times. When returning quality inspection results, we automatically deduplicate them. This means if a sentence hits the same condition within the same rule multiple times, only the first hit result for that sentence is returned.

Examples

Success response

JSON format

{
  "Code": "200",
  "Message": "successful",
  "RequestId": "66E1ACB8-17B2-4BE8-8581-954A8*****",
  "Success": true,
  "Data": {
    "Score": 100,
    "TaskId": "66E1ACB866E1ACB8",
    "Tid": "20200876-66E1ACB8",
    "BeginTime": 1584535485856,
    "Rules": [
      {
        "RuleName": "禁用语",
        "Rid": "232232",
        "RuleInfoBase": {
          "Level": 2,
          "Comments": "邀约客户,客户不同意参加试听",
          "ScoreNum": 1,
          "ScoreType": 1,
          "ScoreNumType": 1,
          "Type": 1,
          "RuleCategoryName": "服务规范"
        },
        "Hit": [
          {
            "HitKeyWords": [
              {
                "To": 4,
                "From": 1,
                "Val": "你好",
                "Cid": 2312,
                "Pid": 4
              }
            ],
            "Phrase": {
              "Words": "你好请问有什么可以帮您的",
              "Identity": "xxx",
              "Begin": 1230,
              "EmotionValue": 6,
              "End": 3440,
              "SpeechRate": 233,
              "Role": "客服",
              "SilenceDuration": 123
            }
          }
        ]
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.