Updated on 2023-09-20 GMT+08:00

Message Push Interface Specifications

Scenario

AICC will invoke this API to push messages which replied by agents or system messages.

Method

POST

URI

{baseUrl}/webhooks/v1/messages

Request Description

Table 1 Request header parameters

No.

Name

Type

Mandatory or Not

Description

1

Authorization

string

True

Used for authentication.

Value is auth-v2/{accessKey}/{timestamp}/{SignedHeaders

Table 2 Request body parameters

No.

Name

Type

Mandatory or Not

Description

1

messages

list[DownLinkMsg]

True

Messages and events.

2

timestamp

long

True

Send time, and it will be used to generate authentication signature.

Table 3 Parameter structure of DownLinkMsg

No.

Name

Type

Mandatory or Not

Description

1

channel

string

True

Message Channel Type,Such as WEB.

2

isOfflineStatus

Boolean

False

It is used in client to judge whether can send message in next step.

When user wait timeout, AICC will push a message,

if async switch is on, the value will be true.

If async switch is off, the value will be false.

3

content

string

True

Content of the MT message sent to the customer.

If controlType is CHAT, and

If mediaType is TEXT,

the value is text content.

If mediaType is IMAGE/VIDEO/AUDIO, the value is id of resource, client should use downloadFileStream API to get resource.

If mediaType is LOCATE, the value is location information, format is latitude/longtitude/description.

If controlType is READ, the value is messageId array which already be read.

4

from

string

True

ID of the message sender. Channel ID.

5

mediaType

string

True

Message media type, for example, text type (TEXT), image (IMAGE), video (VIDEO), voice (AUDIO), and location (LOCATE).

6

senderNickname

string

False

Nickname of the message sender.

7

sourceType

string

True

Message sender, for example, agent (AGENT), robot (ROBOT), and system (SYSTEM).

8

controlType

string

True

Message control type, such as connect(CONNECT) chat (CHAT) and disconnect (DISCONNECT),Transfer to manual service(TRANS2AGENT),Read report(READ)

9

timestamp

long

True

Message sending timestamp.

10

to

string

True

userId

11

simQuestions

string

False

Similarity Question Content.

12

messageCode

string

False

A Unique value which is used to identify the message agent sent. Max length is 64.

Response Description

Status code: 200

Table 4 Response body parameters

No.

Name

Type

Mandatory or Not

Description

1

resultCode

String

True

0 is success, If returns not HTTP 200 or resultCode is not 0, it means push message failed.

2

resultDesc

String

False

Customization

Example

  • Request header:
    Content-Type: application/json 
    Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXX
  • Request parameters:
    {
        "timestamp": 1625898453913,
        "messages": [//1connected{
            "from": "202105284494222653",
            "channel": "WEB",
            "to": "44444444",
            "controlType": "CHAT",
            "mediaType": "TEXT",
            "content": "The call is connected to an agent.",
            "simQuestions": null,
            "senderNickname": "SYSTEM",
            "timestamp": 1625898453913,
            "sourceType": "SYSTEM",
            "callId": null,
            "messageCode": null,
        },
        //queuing{
            "from": "202105284494222653",
            "channel": "WEB",
            "to": "44444444",
            "controlType": "CHAT",
            "mediaType": "TEXT",
            "content": "Queuing...",
            "simQuestions": null,
            "senderNickname": "SYSTEM",
            "timestamp": 1625898453913,
            "sourceType": "SYSTEM", 
            "messageCode": null,
        },
        //disconnect because of agent
    {
            "from": "202105284494222653",
            "channel": "WEB",
            "to": "44444444",
            "controlType": "DISCONNECT",
            "mediaType": null,
            "content": null,
            "simQuestions": null,
            "senderNickname": null,
            "timestamp": 1625898871961,
            "sourceType": "AGENT",
            "messageCode": null,    
        },
        //disconnect because of timeout, and async switch is off
    {
            "from": "202105284494222653",
            "channel": "WEB",
            "to": "44444444",
            "controlType": "DISCONNECT",
            "mediaType": null,
            "content": null,
            "simQuestions": null,
            "senderNickname": null,
            "timestamp": 1625898871961,
            "sourceType": "SYSTEM",
            "messageCode": null,    
        },
    //disconnect because of timeout, and async switch[D1]  is on
    {
            "from": "202105284494222653",
            "channel": "WEB",
            "to": "44444444",
            "controlType": "DISCONNECT",
              "isOfflineStatus":true,
            "mediaType": "TEXT",
            "content": "{TIPS}",
            "simQuestions": null,
            "senderNickname": null,
            "timestamp": 1625898871961,
            "sourceType": "SYSTEM",
            "messageCode": null,    
        },
    //read{
            "from": "202105284494222653",
            "channel": "WEB",
            "to": "44444444",
            "controlType": "READ",
            "mediaType": null,
            "content": "messageId1,messageId2[D2] ",
            "simQuestions": null,
            "senderNickname": null,
            "timestamp": 1625898871961,
            "sourceType": "AGENT",
            "messageCode": null,    
        }
    ]
    }
  • Response parameters:
    {
        "resultCode": "0",
        "resultDesc": "success."
    }