- 19 Oct 2022
- 1 Minute to read
- Print
- DarkLight
Agent Console
- Updated on 19 Oct 2022
- 1 Minute to read
- Print
- DarkLight
How to use API
First of all, you need to read this guide to known how to embed the agent console into your web system, and then you can call the following APIs according to your requirements.
APIs
Actions
currentAgent
: get current agent data.Params
No Parameters
Response
Name type Description data object The data of the current agent. Example
agentconsole.init().then((ac) => { ac.get("currentAgent").then((result) => { const data = result.data; console.log(`Current agent chats: ${data.chats}`); }) });
currentAgent.status
: set current agent status.Params
Name type Description status enum ( Away
,Online
)The name of the agent status. Response
No Response
Example
agentconsole.init().then((ac) => { ac.set('currentAgent.status', 'Away'); ac.set('currentAgent.status', 'Online'); });
agentconsole.navBar.select
: set which nav bar to select.Params
Name type Description navBar enum ( tickets
,visitor
,agent
,chat
)The name of the nav bar. Response
No Response
Example
agentconsole.init().then((ac) => { ac.set("agentconsole.navBar.select", "tickets"); ac.set("agentconsole.navBar.select", "visitor"); ac.set("agentconsole.navBar.select", "agent"); ac.set("agentconsole.navBar.select", "chat"); });
agentconsole.navBar.badges
: get the number of unread messages.Params
No Parameters
Response
Name type Description chats number The number of unread chat's messages. tickets number The number of unread ticket's messages. agents number The number of unread agent's messages. Example
agentconsole.init().then((ac) => { ac.get("agentconsole.navBar.badges").then((result) => { const badges = result.data; console.log(`Number of unread chat's messages: ${badges.chats}`); }) });
agentconsole.preference.show
: set which preference to show.Params
Name type Description preference enum ( chat
,tickets
,general
)The name of the preference. Response
No Response
Example
agentconsole.init().then((ac) => { ac.do("agentconsole.preference.show", "chat"); ac.do("agentconsole.preference.show", "tickets"); ac.do("agentconsole.preference.show", "general"); });
Events
agentconsole.chats.chatStarted
: it is triggered when chats start.Params
No Parameters
Response
Name type Description data object The data of the chat. Example
agentconsole.init().then((ac) => { ac.on('agentconsole.chats.chatStarted', (args) => { const chat = args.data; }); });
agentconsole.chats.chatEnded
: it is triggered when chats end.Params
No Parameters
Response
Name type Description data object The data of the chat. Example
agentconsole.init().then((ac) => { ac.on('agentconsole.chats.chatEnded', (args) => { const chat = args.data; }); });
agentconsole.navBar.badges
: it is triggered when received a new message.Params
No Parameters
Response
Name type Description chats number The number of unread chat's messages. tickets number The number of unread ticket's messages. agents number The number of unread agent's messages. Example
agentconsole.init().then((ac) => { ac.on('agentconsole.navBar.badges', (args) => { const badges = args.data; console.log(`Number of unread chat's messages: ${badges.chats}`); }); });