Agent Console

Prev Next

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

  1. 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}`);
         })
      });
      
  2. 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');
      });
      
  3. 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");
      });
      
  4. 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}`);
         })
      });
      
  5. 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

  1. 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;
         });
      });
      
  2. 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;
         });
      });
      
  3. 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}`);
         });
      });
      
Copyright © 2022 Comm100 Network Corporation. All Rights Reserved.