API reference for communication engine conversation-record push after transfer to a manual agent

Updated at:

API overview

After an intelligent voice AI call successfully initiates a transfer-to-manual-agent request, the system immediately pushes the complete conversation history between the AI and the user to the callback URL that the customer configured in advance by using HTTP POST. This lets the agent understand the conversation context before taking over the call. The agent might not yet be ringing or have answered the call.

Item

Description

Request method

POST

Content-Type

application/json

Accept

application/json

URL

The dialogPushUrl that you specify in the transfer configuration.

Timeout

Fixed at 3000 ms (3 seconds).

Trigger conditions

The push is triggered only when both of the following conditions are met:

  1. The transfer request is successfully initiated, rather than the agent having answered the call.

  2. The callback address in the transfer configuration is not empty.

Request description

Request headers

Header

Type

Required

Description

Content-Type

String

Yes

Fixed value: application/json

Accept

String

Yes

Fixed value: application/json

timestamp

String

Yes

The current timestamp in milliseconds, used for signature verification.

auth

String

Yes

The authentication signature.

Request body

Field name

Type

Required

Description

callId

String

Yes

The unique call identifier.

outId

String

No

The external business ID on the customer side. This field is not sent when it is empty. Its value is the original value that the customer passed when calling the API.

caller

String

Yes

The calling number.

callee

String

Yes

The called number.

conversationHistory

JSONArray

Yes

The conversation record list. It can be an empty array [].

conversationHistory array elements

Field name

Type

Required

Description

role

String

Yes

The role identifier. "user" indicates a user utterance, and "assistant" indicates an AI or bot utterance.

content

String

Yes

The conversation text.

Request body example

{
  "callId": "1693456789012^1693454989012",
  "outId": "biz-order-20260831001",
  "caller": "18612345678",
  "callee": "4006007006",
  "conversationHistory": [
    {
      "role": "assistant",
      "content": "Hello, how can I help you?"
    },
    {
      "role": "user",
      "content": "I want to check the status of my order."
    },
    {
      "role": "assistant",
      "content": "Sure. Please provide your order number."
    },
    {
      "role": "user",
      "content": "I want to speak to a manual agent."
    },
    {
      "role": "assistant",
      "content": "Sure. I am transferring you to a manual agent. Please wait."
    }
  ]
}
          

Request body example without outId

{
  "callId": "1693456789012^1693454989012",
  "caller": "18612345678",
  "callee": "4006007006",
  "conversationHistory": []
}
          

Response description

Item

Description

Expected HTTP status code

200. Only 200 indicates that the push succeeds.

Response body

No requirements. The system checks only the HTTP status code and does not parse the response body. You can return any content.

Response example (recommended format)

{
  "code": 0,
  "msg": "success"
}
          

Authentication signature

The system passes timestamp and auth in HTTP headers. Use the following algorithm to verify that the request source is valid.

Signature algorithm

auth = MD5Hex( aliyunUid + callId + timestamp )
          

Parameter

Source

Description

aliyunUid

Customer

The Alibaba Cloud account UID, converted from Long to String.

callId

Request body

The unique call identifier.

timestamp

Request header

A timestamp in milliseconds.

Concatenate the three parameters directly without separators, then calculate the MD5 hash and output a 32-character lowercase hexadecimal string.

Java verification example

import org.apache.commons.codec.digest.DigestUtils;

public boolean verifyAuth(String auth, Long aliyunUid, String callId, String timestamp) {
    String expected = DigestUtils.md5Hex(String.valueOf(aliyunUid) + callId + timestamp);
    return expected.equals(auth);
}
          

curl examples

Complete request that includes the conversation history

curl -X POST 'https://your-server.com/dialog-push' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'timestamp: 1725091200000' \
  -H 'auth: a3f5b8c2d1e4f6a7b9c0d2e3f5a6b8c9' \
  -d '{
    "callId": "1693456789012^1693454989012",
    "outId": "biz-order-20260831001",
    "caller": "18612345678",
    "callee": "4006007006",
    "conversationHistory": [
      {
        "role": "assistant",
        "content": "Hello, how can I help you?"
      },
      {
        "role": "user",
        "content": "I want to check my order status."
      },
      {
        "role": "assistant",
        "content": "Sure. Please provide your order number."
      },
      {
        "role": "user",
        "content": "I want to speak to a manual agent."
      },
      {
        "role": "assistant",
        "content": "Sure. I am transferring you to a manual agent. Please wait."
      }
    ]
  }'
          

Request without a conversation history

curl -X POST 'https://your-server.com/dialog-push' \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'timestamp: 1725091200000' \
  -H 'auth: e7d2a1b3c5f8e0d4a6b9c2f1e3d5a7b0' \
  -d '{
    "callId": "1693456789012^1693454989012",
    "caller": "18612345678",
    "callee": "4006007006",
    "conversationHistory": []
  }'
          

Expected response (HTTP 200)

{
  "code": 0,
  "msg": "success"
}
          

Retries and exception handling

Retry policy

Configuration item

Value

Description

Maximum retry count

1

At most two executions in total: the first attempt and one retry.

Failure scenarios

Scenario

Handling

HTTP status code is not 200

Retry once. If it still fails, record a log and return a failure.

Request timeout, exceeding 3 seconds

Retry once.

Network exception

Retry once. If it still fails, return a failure.

Notes

  1. Push timing: The push occurs after the transfer request is successfully initiated. The agent might not yet be ringing or have answered the call. If the agent ultimately does not answer because of a timeout or rejection, the conversation record is still pushed.

  2. Response time: We recommend that you return HTTP 200 within 500 ms. A timeout triggers a retry.

  3. Status code only: The system checks only whether the HTTP status code is 200 and does not parse the response body. You can return any content.

  4. Reduced conversation record: The pushed conversation record contains only the role and content fields.

  5. outId value: The pushed outId is the original value that the customer passed when calling the API.

  6. Asynchronous push: The push is performed asynchronously and does not block the transfer process.

  7. Callback URL: The URL must be a publicly accessible HTTPS address.

  8. Signature algorithm: This interface uses the same MD5(aliyunUid + callId + timestamp) signature algorithm as the transfer variable callback interface.