Help Center/ Cognitive Engagement Center/ API Reference/ Voice Notification Interface Reference/ Creating a Voice Notification (V1.0.0) (createVoiceNotification)
Updated on 2023-09-27 GMT+08:00

Creating a Voice Notification (V1.0.0) (createVoiceNotification)

Scenario

When the voice notification function is used, this API is invoked to request the voice call platform to play a voice notification to a specified user.

Method

POST

URI

https://Domain name/apiaccess/rest/voiceNotification/v1/createVoiceNotification (For example, the domain name is service.besclouds.com.)

Request Description

Table 1 Request header parameters

No.

Parameter

Type

Mandatory or Not

Description

1

X-APP-Key

String

Yes

App key field, which is the user ID. Contact the operation personnel to obtain the app key.

2

Authorization

String

Yes

Authentication field. The format is Bearer {Value of AccessToken returned by the tokenByAkSk interface}. (A space is required after Bearer.)

For details about the generation mode, see C1 System Configuration Interface Authentication.

Table 2 Request body parameters

No.

Parameter

Type

Mandatory or Not

Description

1

reqBody

Object

Yes

-

1.1

voiceContent

String

Yes

The value contains a maximum of 1000 characters.

  • Voice IDs can be transferred. The voice IDs are separated by tildes (~), and can be queried using the /rest/voiceNotification/v1/queryVoiceNotificationRecording interface. If you upload a voice file on the AICC, the voice ID is the value of Voice Id on the IVR Voice page.
  • Texts can be transferred. The format is ${Text}$. The texts are separated by tildes (~), for example, $Tom$~$Jack$.
  • Voice IDs and texts can be transferred together. The format is {Voice ID}~${Text}$~{Voice ID}, for example, 1133*********999~$Tom$~2225*********149.

1.2

callerPresent

String

No

Calling number displayed on the user side. If this parameter is not carried, the access code of the tenant space is used by default. If this parameter is carried, the access code must be carried. If a non-access code number needs to be transferred, contact O&M personnel to enable the calling number anonymization feature. After this feature is enabled, the number verification rule is as follows: access code or a number of 11 to 14 digits.

1.3

called

String

Yes

Called number.

1.4

callBackUrl

String

No

URL for a customer to receive status reports.

Use Base64 to encrypt this parameter using the UTF-8 standard character set.

The AICC pushes the call status information during business triggering to the server, and the client server determines the user status based on the call status information.

The URL can be set to https://IP address:Port number or a domain name. The domain name is recommended. HTTP and HTTPS are supported. The domain name can correspond to multiple servers to ensure that notifications can be received when a single point of failure occurs.

HTTP involves security risks and is not recommended.

The URL can contain only letters, digits , and the following special characters: -:./_#?&

The IP address and port number, or domain name of the URL must have been added to the mobile agent callback URL trustlist by the system administrator.

1.5

priority

String

No

Playback priority of a voice notification.

The value is an integer ranging from 1 to 9. The default value is 9.

A smaller value indicates a higher priority.

If TTS is involved, sign in to the AICC as a system administrator, choose Configuration Center > Flow Configuration > Intelligent IVR > System Management > TTS/ASR Management, and specify the TTS vendor. The configuration takes effect one minute later.

Response Description

  • Status code: 200
    Table 3 Response body parameters

    No.

    Parameter

    Type

    Mandatory or Not

    Description

    1

    schema

    Object

    Yes

    -

    1.1

    retCode

    String

    Yes

    Returned code (0 indicates success).

    1: A task is in progress. Try again later.

    2: The value length of callData exceeds 1024 characters.

    3: Creation failed. No call SN is generated.

    4: The format of softphone does not match the rule.

    5: The value of caller or called is not transferred, or the format does not match the rule.

    6: The VDN is not enabled.

    7: callerPresent or agentPresent fails to pass the verification.

    8: The value of voiceContent is empty, exceeds the upper limit, or does not exist.

    9: The value of callBackUrl does not meet the requirements.

    16: The tenant is in trial commercial use state, and the called number is not in the trustlist.

    36: The value of priority is in an incorrect format.

    1.2

    retMsg

    String

    No

    Return result description.

    1.3

    result

    Object

    No

    This parameter is mandatory when retCode is set to 0.

    1.3.1

    callSerialNo

    String

    Yes

    Call SN.

  • Status code: 400

    Incorrect request. Check the request path and parameters.

  • Status code: 401

    Unauthorized operation.

    1. Check whether you have purchased related services.

    2. Contact customer service to check the status of your account.

  • Status code: 403

    Authentication fails.

  • Status code: 404

    The requested content is not found. Check the request path.

  • Status code: 500

    Business failure. Check the values of parameters in the request.

Error Codes

None

Example

Request header:

{
"Content-Type": application/json
"x-app-key": *****
"Authorization": Bearer ****
}

Request parameters:

{
    "voiceContent": "1133*********999~$Tom$~2225*********149",
    "callerPresent": null,
    "called": "88880000"
}

Response parameters:

{
    "result": {
        "callSerialNo": "11827********7090"
    },
    "retCode": "0",
    "retMsg": "Created successfully."
}