Agent SDK API

Caution
TCCC is a global variable that can be accessed directly after loading the SDK.

General structure

AgentStatus

Seat Status.
Field
Description
free
Available
busy
Busy
arrange
Organizing information
notReady
Not ready yet
rest
Short break

CommonSDKResponse

Parameter
Type
Required
Remarks
options
status
'success' |'error'
Yes
SDK API call result:
Successful: returns 'success'
Failure: returns 'error'
errorMsg
string
No
Error information, returns when the status is error

Chat (Apis related to customer service)

Access the Conversation

tccc.Chat.accept(options): Promise<CommonSDKResponse>

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID

End the session

tccc.Chat.end(options): Promise<CommonSDKResponse>

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID

Transfer session

tccc.Chat.transfer(): Promise<CommonSDKResponse>

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID
skillGroupId
String
No
Transferred skill group
userId
String
No
Transferred agent

Agent (Apis related to agent status)

Launch

tccc.Agent.online(): void

Decommission

tccc.Agent.offline(): void

Set agent status

tccc.Agent.setStatus(optoins): Promise<CommonSDKResponse>

Parameter
Type
Required
Remarks
options
status
String
Yes
Agent status, valid values:
free
rest
Arrange
NotReady
StopNotReady
restReason
String
No
Short break reason

Obtaining Agent Status

tccc.Agent.getStatus():AgentStatus

Devices (Device-related API Functions)

Detect Whether the Current Browser is Supported

tccc.Devices.isBrowserSupported(): boolean

Note
TCCC Web SDK supports browsers Chrome 56 or above, or Edge 80 or above.

Get the microphone device list

tccc.Devices.getMicrophones(): Promise<MediaDeviceInfo []>

Get the speaker device list

tccc.Devices.getSpeakers(): Promise<MediaDeviceInfo []>

UI (Apis related to UI)

Hide all UI of SDK

tccc.UI.hide(): void

Display all UI of SDK

tccc.UI.show(): void

Display Floating Button

tccc.UI.showfloatButton(): void

Hide Floating Button

tccc.UI.hidefloatButton(): void

Show Workbench

tccc.UI.showWorkbench(): void

Hide Workbench

tccc.UI.hideWorkbench(): void

Events

Listening for events

tccc.on(event, callback)

Canceling Event Listening

tccc.off(event, callback)

SDK Initialization Completed

tccc.events.ready

Triggered When SDK Initialization is Complete, APIs Can Now Be Safely Invoked.

Incoming Session

tccc.events.callIn

Types of call-in conversations include:
phone: Telephonic conversation
im: Online conversation
voip: Audio conversation
video: Video conversation
Internal: Internal Conversation

Online Conversation Incoming

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID
type
'phone'
Yes
Conversation Type
timeout
Number
Yes
Session access timeout duration, 0 represents no timeout
nickname
String
Yes
User's nickname
avatar
String
No
User profile photo
remark
String
No
Remarks
peerSource
String
No
Channel Source
channelName
String
No
Custom Parameters
clientData
String
No
User-Defined Parameters

Agent Accesses Session

tccc.events.userAccessed

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID

Session Timeout Transfer Event

tccc.events.autoTransfer

Parameter
Type
required
Remarks
options
sessionId
String
Yes
Conversation ID

Conversation End Event

tccc.events.sessionEnded

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID
closeBy
String
Yes
Indication of end party:
client: User end
seat: Agent end
admin: System end
timer: Timer end
mainReason
String
No
This field only exists in phone calls and when the hang-up party is 'admin' indicating the reason for the hang-up.
subReason
String
No
This field only exists in phone calls and when the hang-up party is 'admin' indicating the detailed reason for the hang-up.

Session Transfer Event

tccc.events.transfer

Parameter
Type
Required
Remarks
options
sessionId
String
Yes
Conversation ID

Agent Status Change Event

tccc.events.statusChanged

Parameter
Type
Required
Remarks
options
status
No
For detailed explanation, please refer to agent status