Live Agent Deployment API

Introduction

In this blog, I am going to explain how to use the live agent deployment API  to find and create records and how to customize chat buttons and chat window. Live agent deployment API has the number of options to customize the live agent like Logging and controlling the live agent online and offline behaviors and allow automatically creating records and suggest the knowledge article etc. Below is the code from where you will launch your live agent normally it might be your webpage or visual force page from sites etc.

Understand the code

Live agent logging will be very useful if you wanted to troubleshoot the live agent. You can enable the Logging by simple liveagent.enableLogging(); the method which results in the debugging as shown below on browser console.

The below piece of code shown what to do when the agent is online or offline.The showWhenOnline or showWhenOffline method to specify customers see when a particular button is online or offline based on the agent status. the below code we specify the button id to show the status  liveagent_button_online_5736A000000gBrn , liveagent_button_offline_5736A000000gBrn  .

The below code request a chat from a button in a new window when you click on chat button by calling liveagent.startChat method.

Find and Create Records
Use the Deployment API to search for or create Salesforce records like a case, contact, account, or lead automatically when an agent begins a chat with a customer.addCustomDetail methods as  Adds a new custom detail for the chat visitor.

The Custom Detail is displayed to agents in the footer widget and in the Chat Details page in the Salesforce Console while the chat is active as shown below.

 

Use the findOrCreate method to find existing records or create new ones based on certain criteria. The findOrCreate method begins the API call that finds existing records or creates new records when an agent begins a
chat with a customer. The below code show to find and create records and store it to the live agent transcript and suggesting the knowledge articles.

In the above code, we are trying o find the contact and if not available the create a new contact also searches for records that contain customer data specified by the addCustomDetail Deployment API method.  findOrCreate.saveToTranscript method to save the record you find or create the chat transcript associated
with the chat. Use the findOrCreate.showOnCreate method to automatically open the record you create in a subtab in the Salesforce console.   findOrCreate.linkToEntity method to link the record you found or created to another record type. The below image shows the search results on the console chat

 

liveagent.addCustomDetail(‘Case Subject’,’Refund policy for products’).doKnowledgeSearch() method search for Knowledge articles as shown below when customer is chat with agent.

 

 

 

Live agent Pre-Chat Forms with Validations

Introduction

In this post, I am going to explain how to set Pre-Chat form to collect information from visitors and customers the pre-chat page as well.Pre-chat information can help direct chat requests more efficiently and reduce the time agents spend collecting the information themselves to resolve the cases.

Understand Pre Chat API 

Use the Pre-Chat API to search for or create customer records automatically when a customer completes a pre-chat form. Here is the list of methods that you can use in pre-chat API

findOrCreate.map
      Searches for or creates records that contain the customer data that’s specified in the pre-chat form that the customer completes. You can call the findOrCreate.map method as many times as necessary to find the appropriate records. You can list multiple fields and their corresponding details to map the detail values to the appropriate fields within the record as shown below .Here findOrCreate.map is maps the contact first name and last name with pre-chat form first name and last name.

 

findOrCreate.map.doFind

Use the findOrCreate.map.doFind method to specify which fields to search against existing customer records when a customer completes a pre-chat form.Here is the code that searches the contact based on the pre-chat form email.

findOrCreate.map.isExactMatch

Specifies which fields in your findOrCreate.map method require an exact field value match when you search for existing records.

findOrCreate.map.doCreate

Use the findOrCreate.map.doCreate method to specify which fields in findOrCreate.map method to use to create a new record if an existing record isn’t found. Specifies which fields in your findOrCreate.map method to use to create a new record if an existing record isn’t found. You can specify one or more fields for creating new records.

findOrCreate.saveToTranscript

Use the findOrCreate.saveToTranscript method to find or create a record and save it to the chat transcript associated with the chatSaves the record that you found or created using the findOrCreate.map.doCreate or findOrCreate.map.doFind
Pre-Chat API methods to the chat transcript associated with the chat when the chat ends.

 

findOrCreate.showOnCreate

Use the findOrCreate.showOnCreate method to find or create a record and automatically open it in a subtab in the Salesforce console.Opens the record you created using the findOrCreate.map.doCreate and findOrCreate.map.doFind Pre-Chat API methods automatically in a subtab in the to the Salesforce console.

findOrCreate.linkToEntity

Links the record you’ve found or created using the findOrCreate.map.doFind and findOrCreate.map.doCreate methods to another record of a different record type that you created using a separate findOrCreate.map API call. For example,
you can link a case record you found within your organization to a contact record you create. The findOrCreate.linkToEntity method can’t be used to populate fields on records that you create by using the findOrCreate API call. Instead, use the findOrCreate.map method to update field values on records.

Code 

Here is the complete visualforce page. Go to developer edition and create a new visualforce page with the below code.

Update Chat Buttons and Automated Invitations

Update the live agent chat buttons with the visualforce page that you created above as shown below.

Now if you launch the chat from the site you can able to pre-chat form that will pop up before starting the chat.

Here is result agent can see before accepting the chat.

Based on your the above pre-chat form configuration once the agent is accepting the chat salesforce is going to do the bunch of operations like searching the contacts and opening a new record creating the page and suggest the knowledge article and save it to chat transactions and etc.

 

Salesforce Custom Chat Window

This is simple live agent custom chat window using the visualforce. Create a new visualforce page with below code.

Add it the Chat buttons and automated invitation as shown below.

You can see the chat window as shown below

 

 

 

 

 

Live Agent post chat page

Live agent post chat page allows you to share the details with customers at the end of a chat session. For example, you can direct your customers to another
Web page after they complete a chat with an agent, or forward them to a survey about their chat experience. You can create a Visualforce page to host your post-chat page, or you can develop a page on your own and add the URL to your chat
button configuration.

Now go and update the chat button and automated invitations”post chat page ” as shown below with the visual force page your created.

Once chat is ended which will display the result as shown below.insted of showing the simple chat details even you can build your own logic like sending automatic post chat surveys or feedback etc by using post chat pages.

Salesforce Live Agent

Introduction

In this blog, I am going to explain Live agent set up in Salesforce. Live Agent is a comprehensive chat solution that makes it easy for your support organization’s agents and support supervisors to assist customers. With Live Agent, your support organization can leverage the comprehensive customer service tools that are available in the Salesforce console while providing real-time chat support.Before starting the customizing the live agent, let us make your org is ready for the live agent.

Enabled Live Agent
The Live agent is not enabled by default. So you need to enable it.From Setup enter Live Agent Settings in the Quick Find box, then select Live Agent Settings and enable it.

Create Live Agent Users

Before your users can assist customers with chat, you need to assign the users as Live Agent users. Live Agent users are supported agents and supervisors who have the Salesforce permissions to assist customers with chat. Go to salesforce user record and edit then Select Live Agent User and save it as shown below.

Static Resource 

Download any two images and upload them to static resource to use them to show the online and offline status of the chat

Let’s Get Started 

Now you can start configuring the live agent in your Org after completing the above configurations. Here are the details explain about how to configure the live agent.

1.Creating Skills

Skills identify your agents’ areas of expertise like “Repair ” or “Product installation” or “Maintenance” and etc are the few examples. When you assign an agent to a skill, that agent receives chat requests that are related to the agent’s skill areas. You can also empower your supervisors to assign skills to agents.

 

2. Live Agent Configurations

With the live agent configuration settings, you can able to control the functionality that’s available to agents and their supervisors while agents chat with customers. Apply settings when you create or edit a Live Agent configuration. Live Agent configurations define the Live Agent functionality that’s available to your agents and support supervisors when agents chat with customers.You can create multiple configurations that define Live Agent’s functionality for multiple types of users to fit into your business model. From Setup enter Live Agent Configurations in the Quick
Find box, then select Live Agent Configurations and create a new live agent configurations as shown below under Basic Information.

  • Chat Capacity Indicates how many chats an agent who is
    assigned to this configuration can be engaged in at the same time
  • Sneak Peek Enabled Indicates whether agents can see what a chat customer is typing before the customer sends a chat message.
  • Request Sound Enabled, Disconnect Sound Enabled, Notifications Enabled are Indicates whether to play an audio alert when new chat is started or ended
  • Custom Agent Name Sets the agent’s name as it appears to customers in the chat window.
  • Auto Greeting Sets a customized greeting message that the customer receives automatically when an agent accepts the customer’s chat request
  • Auto-Away on Decline Sets the agent’s Live Agent status to “Away” automatically when the agent declines a chat request
  • Auto-Away on Push Time-Out Sets an agent’s Live Agent status to “Away” automatically when a chat request that’s been pushed to the agent times out
  • Critical Wait Alert Time Determines the number of seconds that the agent has to answer a customer’s chat before the chat tab alerts the agent to answer it.
  • Agent File Transfer Enabled Indicates whether an agent can enable customers to transfer files through a chat
  • Visitor Blocking Enabled Indicates whether an agent can block visitors from an active chat within the Salesforce console
  • Assistance Flag Enabled Indicates whether an agent can send a request for help to a supervisor.

 

Assign eligible users to the configuration to give them access to Live Agent functionality.Users can be assigned to only one Live Agent configuration at a time. If you assign the same user to a second Live Agent configuration, the system removes that user from the first Live Agent configuration without warning you. 

Supervisor settings determine the Live Agent functionality that’s available to support supervisors. In addition, these settings determine the default filters that apply to the Agent Status list in the supervisory panel.

  • Chat Monitoring Enabled Indicates whether supervisors can monitor their agents’ chats in real-time while their agents interact with customers
  • Whisper Messages Enabled Indicates whether supervisors can send private messages to agents while agents chat with customers
  • Agent Sneak Peek Enabled Indicates whether supervisors can preview an agent’s chat messages before the agent sends them to the customer
  • Default Agent Status Filter Determines the default agent status, such as Online, Offline, or Away, by which to filter agents in the supervisor panel
  • Default Skill Filter Determines the default skill by which to filter agents in the supervisor panel.
  • Default Button Filter Determines the default button by which to filter agents in the supervisor panel.
  • Assigned Skills Determines the skills that are visible to supervisors in the supervisor panel.

Chat Conference Settings Determine whether agents can invite other agents to join them in a customer chat. Chat conferencing lets your agents include multiple
agents in a single chat.

  • Chat Transfer to Agents Enabled Indicates whether agents can transfer chats to another agent directly
  • Chat Transfer to Skills Enabled Indicates whether agents can transfer chats to agents assigned to a particular skill
  • Chat Transfer to Skills Determines the skill groups to which agents can transfer chats.
  • Chat Transfer to Live Chat Buttons Enabled Indicates whether agents can transfer chats to a button or queue
  • Chat Transfer to Live Chat Buttons Determines the buttons to which agents can transfer chats.
3. Live Agent Deployments

With the deployment, you will get of JavaScript to add it to your site. A deployment is a place on your company’s website that’s enabled for Live Agent. Create deployments to implement Live Agent and control its functionality on your website.To customize the chat window that your customers see, you first need to create a Force.com site to host your custom images. Your organization
can have a single Live Agent deployment or multiple deployments. For example, if you have a single service center that supports multiple websites, creating a separate deployment for each site enables you to present multiple chat windows to your visitors. From Setup in Salesforce Classic, enter Deployments in the Quick Find box, then select Deployments and Click New and  Save it .

After you saving Salesforce generates the deployment code as shown in the below image. Copy the deployment code, and then paste it on each Web page where you want to deploy ( visualforce Page in this example ).

4.Chat Buttons

Create chat buttons to enable customers to request a chat with an agent directly from your website.You need to create the buttons that visitors click to start chats. Like a deployment, a button consists of several lines of JavaScript that you copy and paste into Web pages.  From Setup enter Chat Buttons in the Quick Find box, then select Chat Buttons & Invitations to create a New then Select Chat Button from the Type field.

  • Enable Customer Time-Out Indicates whether chats are ended if the customer doesn’t respond within a specified period.
  • Customer Time-Out (seconds) Sets the amount of time that a customer has to respond to an agent message before the session ends
  • Customer Time-Out Warning Sets the amount of time that a customer has to respond to an agent message before a warning appears and a timer begins a countdown

  • Routing Type Sets how chats are routed to an agent.
  • Push Time-Out (seconds) Sets the amount of time an agent has to answer a chat request before the request is rerouted to another agent.
  • Enable Queue Indicates that queueing is enabled. Queueing allows incoming chat requests to wait in a queue until an agent with the appropriate skills is available to accept the chat.
  • Queue Size Per Agent Determines the queue’s capacity to hold chat requests per available agent. For Live Agent routing or when chats have a size of 1, this is the number of chats allowed to queue for each agent.
  • Overall Queue Size Lets a chat request that’s been declined by all available agents be rerouted and sent to all available agents again. Available only for requests with Least Active and Most Available routing types
  • Automatically Accept Chats Lets chat requests originating from this button be automatically accepted by the first available agent
  • Site for Resources Determines the Force.com site that’s associated with the chat button
  • Online Image Sets the custom button graphic that appears when the chat button is unavailable
  • Offline Image Sets the custom button graphic that appears when the chat button is available for customers to request new chats.
  • Custom Chat Page Replaces the standard Live Agent chat window with a custom chat window page that you’ve developed.
  • Pre-Chat Form Page Directs Live Agent to the Force.com page that hosts your customized pre-chat form that customers see before they begin
    a chat with an agent.
  • Pre-Chat Form URL Directs Live Agent to the URL of the Web page that hosts your pre-chat form.
  • Post-Chat Page Directs Live Agent to your customized post-chat page that customers see after they complete a chat
  • Post-Chat Page URL Directs Live Agent to the URL of the Web page that hosts your post-chat page.

Now Copy the button code, and then paste it on each Web page where you’ve deployed Live Agent ( Visualforce page in this example )

Now create a visualforce page with the script which you got from the Chat buttons and deployments as shown below

Now go to the console app and enabled the live agent in the console app to use the live agent.

After you enabled the live agent you can able to see the live agent as shown below

Go to the visualforce page and click on Preview then you will see the output as shown below. then click on the button to start the chat. Make sure use is login into the console and update the live agent status to online.

Now go to the console and accept the chat request from the live agent chat request

You can see the chat from the salesforce console app as shown below .