Updated on 2025-11-13 GMT+08:00

Querying Messages

Function

This interface is invoked to query the received messages.

Usage Description

  • Prerequisites

    The web channel configuration has been correctly created.

Interface Prototype

Table 1 Interface prototype description

Method

GET

URL

https://{IP address}:{Port number}/service-cloud/rest/webadapter/v1/webadapterfacade/getMessageForWebChannel

{IP address}:{Port number} indicates the IP address and port number of the NSLB exposed externally.

Table 2 Request header parameters

Parameter

Mandatory or Not

Type

Default Value

Description

Content-Type

Yes

String

None

The value is fixed at application/json; charset=UTF-8.

Cookie

Yes

String

None

During page integration, the CC-Messaging writes the value of ccmessaging-token to browser cookies through the request response. When invoking this interface independently, ensure that the cookie in the request header contains ccmessaging-token=xxx, where xxx indicates the value of ccmessaging-token.

Request Parameters

None

Response Parameters

Parameter

Mandatory or Not

Type

Description

resultCode

Yes

String

Interface response code. The value 0 indicates success.

resultDesc

Yes

String

Interface description.

downlinkMessages

No

Array

Message structure.

Table 3 downlinkMessages parameters

Parameter

Mandatory or Not

Type

Description

channel

Yes

String

Message channel type. Currently, the value is fixed at WEB (web channel access).

content

Yes

String

Content of the MT message sent to a customer. The value contains a maximum of 500 characters.

The value varies according to the media type.

For a multimedia library file, the value is the multimedia library file ID.

For a local file, the value is the OBS key.

from

Yes

String

Message sender ID. Generally, the value is the same as that of Configuration ID of the channel in the AICC.

mediaType

Yes

String

Message media type. The options are TEXT, IMAGE, VIDEO, AUDIO, LOCATE, and DOCUMENT.

senderNickname

No

String

Nickname configured when an agent signs in or the chatbot is enabled. If the message is a system message, the nickname is system.

sourceType

Yes

String

Message sender. The options are AGENT, ROBOT, and SYSTEM.

timestamp

No

String

Message sending timestamp.

to

Yes

String

Message recipient ID. Generally, the value is that of userId sent by the enterprise client.

simQuestions

Yes

String

Similar question content.

isOfflineStatus

No

Boolean

Used by the client to determine whether a message can be sent in the next step.

messageCode

No

String

Unique message code, which is used to identify the message for canceling or deleting an action.

interIdx

No

String

Number of interactions. The value is the same as that of inter_idx returned by the ODFS in the previous time.

contentType

No

String

For a multimedia library file, the value is null.

For a local file, the value is 1.

mediaFileType

No

String

For a multimedia library file, the value is null.

For a local file, the value is the multimedia file type.

controlType

No

String

The options are CHAT, DISCONNECT, and READ.

Example

  • Request
    GET /service-cloud/rest/webadapter/v1/webadapterfacade/getMessageForWebChannel
    
    host: 10.10.10.2:18446
    connection: Keep-Alive
    x-forwarded-for: 10.10.10.3, 10.10.10.4
    x-real-ip: 10.10.10.5
    content-length: 401
    remote-host: 10.10.10.6
    user-agent: java/socket
    content-type: application/json; charset=utf-8
    cookie: JSESSION*****#*#*****3
    ccmessaging-token: ********
    accept: */*
  • Response
    {
    	"resultCode": "0",
    	"resultDesc": "query user messages success.",
    	"downlinkMessages": [{
    		"from": "1011577355744904195",
    		"channel": "WEB",
    		"to": "session_fixed_user_fixed",
    		"controlType": "CHAT",
    		"mediaType": "TEXT",
    		"content": "Welcome",
    		"simQuestions": null,
    		"senderNickname": "test",
    		"senderAvatar": "1",
    		"timestamp": 1619590480756,
    		"sourceType": "ROBOT",
    		"callId": null,
    		"robotGender": "MALE"
    	}, {
    		"from": "1011577355744904195",
    		"channel": "WEB",
    		"to": "session_fixed_user_fixed",
    		"controlType": "CHAT",
    		"mediaType": "TEXT",
    		"content": "Switch to manual service",
    		"simQuestions": null,
    		"senderNickname": "test",
    		"senderAvatar": "1",
    		"timestamp": 1619590482098,
    		"sourceType": "ROBOT",
    		"callId": null,
    		"robotGender": "MALE"
    	}, {
    		"from": "1011577355744904195",
    		"channel": "WEB",
    		"to": "session_fixed_user_fixed",
    		"controlType": "CHAT",
    		"mediaType": "TEXT",
    		"content": "Agent connected",
    		"simQuestions": null,
    		"senderNickname": "System",
    		"senderAvatar": null,
    		"timestamp": 1619590484115,
    		"sourceType": "SYSTEM",
    		"callId": null,
    		"robotGender": null
    	}]
    }
    In the multimedia library file scenario:
    {
        "downlinkMessages": [
            {
                "callId": null, 
                "simQuestions": null, 
                "senderNickname": "agent", 
                "handlerType": null, 
                "isOfflineStatus": null, 
                "channel": "WEB", 
                "senderAvatar": "", 
                "robotGender": null, 
                "mediaType": "IMAGE", 
                "associationContentId": null, 
                "content": "1179725658739559425", 
                "receiveTime": null, 
                "controlType": "CHAT", 
                "sourceType": "AGENT", 
                "queueFlag": null, 
                "messageCode": "1e1f2bf7-fd6e-4471-a45d-2b43d1eb6272", 
                "from": "202201077401331370", 
                "to": "1642643982282972758", 
                "mediaFileType": null, 
                "contentType": null, 
                "interIdx": null, 
                "timestamp": 1648102235191
            }
        ], 
        "resultCode": "0", 
        "resultDesc": "query user messages success."
    }
    
    In the local file scenario:
    {
        "downlinkMessages": [
            {
                "callId": null, 
                "simQuestions": null, 
                "senderNickname": "agent", 
                "handlerType": null, 
                "isOfflineStatus": null, 
                "channel": "WEB", 
                "senderAvatar": "", 
                "robotGender": null, 
                "mediaType": "IMAGE", 
                "associationContentId": null, 
                "content": "878e7d9a-8e2f-4893-8b54-352f8ecbf86c", 
                "receiveTime": null, 
                "controlType": "CHAT", 
                "sourceType": "AGENT", 
                "queueFlag": null, 
                "messageCode": "9374d9c4-b8ee-4035-aab9-ad5ceddbb856", 
                "from": "202201077401331370", 
                "to": "1642643982282972758", 
                "mediaFileType": "png", 
                "contentType": "1", 
                "interIdx": null, 
                "timestamp": 1648102054235
            }
        ], 
        "resultCode": "0", 
        "resultDesc": "query user messages success."
    }