Agent Console
  • 19 Oct 2022
  • 1 Minute to read
  • Dark
    Light

Agent Console

  • Dark
    Light

Article summary

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

      NametypeDescription
      dataobjectThe 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

      NametypeDescription
      statusenum (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

      NametypeDescription
      navBarenum (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

      NametypeDescription
      chatsnumberThe number of unread chat's messages.
      ticketsnumberThe number of unread ticket's messages.
      agentsnumberThe 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

      NametypeDescription
      preferenceenum (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

      NametypeDescription
      dataobjectThe 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

      NametypeDescription
      dataobjectThe 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

      NametypeDescription
      chatsnumberThe number of unread chat's messages.
      ticketsnumberThe number of unread ticket's messages.
      agentsnumberThe 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}`);
         });
      });
      

Was this article helpful?

What's Next