Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

An Integrated LivePerson  —  Alexa, Google Home, and a Chatbot Solution

DZone's Guide to

An Integrated LivePerson  —  Alexa, Google Home, and a Chatbot Solution

Ever wanted to speak to a live person when your chatbot isn't handling your message or intent? Find out how to implement Conversation.one in this tutorial!

· AI Zone ·
Free Resource

Start coding something amazing with the IBM library of open source AI code patterns.  Content provided by IBM.

Being able to serve customers automatically using a chatbot or a voice assistant such as Amazon Alexa or the Google home is great, however, what will you do when our bot can’t handle the customer’s intent or message? To handle the cases where your bot does not understand, or can’t handle the user’s request, Conversation.one enables the ability to handover the user to a human agent, using an integrated LivePerson — Alexa, Google Home, and a chatbot deployment.

Add Bot to LivePerson

We will start by configuring LiveEngage to work with a bot. Please follow the steps below:

  • Add a new user, and set the type to “Bot”
  • Set the bot details: Login Name, Email, Nickname, and Name (you can fill the other details as well)
  • Select “Password” as the login method, and fill in a password
  • Assign the bot an “Agent” profile, set the “Max number of live chats” to “Unlimited,” and set “Max number of messaging conversations” to “999.” Assign the bot a “bot” skill (you might need to create it).

That’s it! The bot user is ready. Let’s move to the next step to integrate the LivePerson bot with Conversation.one

If you do not have the option to select “Bot” as a user type, you will need to contact your LivePerson account manager.

Create a Conversational App

A Conversation.one application represents your conversational interface through Amazon Alexa, Google Home, or a chatbot bot. To create an app:

  1. If you don’t already have a Conversation.one account, sign up. If you have an account, log in.
  2. Click on Create New App in the navigation. If it’s your first application, you will be redirected to the Create New App wizard automatically.
  3. Select your industry and enter your company name. For the purpose of this tutorial, select “Retail” for the industry, and enter “My Store” as your company name. Click Next to continue.
  4. Select the devices you want to support with your app. For this demo, select Amazon Alexa and LivePerson. Click Next to continue.
  5. Your new application is ready. Click Customize to start developing your app.

Try It Out

Now that your app is configured, you can try the pre-made retail template.

In the chat console on the right, type in a request. This can be something like “What is your address?” After you type the request, hit “Send.”

The chatbot will answer with the demo business address, “Our address is 1 Market St, San Francisco, CA 94105.”

Connecting the Conversational Application to LivePerson

Conversation.one is pre-integrated with LivePerson. To connect the new chatbot with LivePerson, follow the steps below:

  • Open your app settings page
  • Select the LivePerson settings by clicking “Staging” and “LivePerson”
  • Fill in your LivePerson account number and the bot login name and password you configured at the first step
  • Click “Save,” and if all is well, the status will change to “Online.”

Try It Out

Now that Conversation.one is connected to LivePerson, you can try talking to the chatbot through the LivePerson widget.

Open the chat widget, and the chatbot will greet you. In the chat console, type in a request. This can be something like “What is your address?” After you type the request, hit “Send.”

The chatbot will answer with the demo business address, “Our address is 1 Market St, San Francisco, CA 94105.”

Hand Over to a Live Agent

While chatbot can cover a large variety of user cases, from simple F.A.Q. to complex data collection, there are still cases where you would need to hand over a client session to a live agent. In this tutorial, we will offer customers who asked for their order status to get connected to an agent. The method of handing over to an agent depends, naturally, on the communication channel. If the user contacted the business using the LivePerson widget, the hand over will be done seamlessly. On other cases such as Amazon Alexa or Google Home, we will demonstrate an over the phone hand over.

Some of the information in this guide is more developer-centric, but don’t be discouraged. If you follow the steps as they’re outlined, you will have a deployed, working hand over functionality.

  • In the editor, open “Order Related” and “OrderStatus.”
  • Click “Add” response and select “Code — Program your own action.”
  • Add the following code and click “Update.”
res.say("<p>Do you have any further questions? Do you want me to connect you to a representative?</p>"); 
sdk.conversationHelper.setYesIntentHandler(context, req, res, 'Representative', true);
  • Go back to the Home folder, and click “Add new intent”
  • Enter “Representative” as “What you will the user ask your bot” and click “Next.”
  • Select “Code — Program your own action” as your response.
  • Add the following code and click “Finish.”
if (req.getChannel() == "liveperson") {
res.say("Sure! I'm connecting you now.");
req.setRedirectToAgent("420922614");
} else {
if (!req.slot("PhoneNumber")) {
sdk.conversationHelper.askForEntity(context, req, res, [
[{
"name": "PhoneNumber",
"target": "PhoneNumber"
}]
], "To continue, please provide your phone number", "For example you can say, my phone number is (646) 869-2931.");
return;

}
var phoneNumber = req.slot("PhoneNumber").replace(/\D+/g, '');;
if (phoneNumber.length === 10) {
phoneNumber = "1" + phoneNumber;
}

res.say("A representetive will call you soon!");
sdk.twilloCall(phoneNumber, "+16468692931");

if (req.getChannel() == "alexa") {
req.shouldEndSession(true);
}
}

Please use your live agents Skill ID when redirecting to an agent using “req.setRedirectToAgent”.

  • Enter “Enter Phone Number” as “What you will the user ask your bot” and click “Next.”
  • Select “Code — Program your own action” as your response.
  • Add the following code and click “Finish.”
return sdk.conversationHelper.FillEntity([{ "name": "PhoneNumber" }], context, req, res);
  • Open “Entities” and add a new entity named “PhoneNumber” with type “Phone Number”
  • Edit the “User Says” sample “Enter Phone Number,” delete the original text, and enter “{PhoneNumber}.”
  • Click “Save,” and wait until the model training is completed.

Try It Out

Now that your chatbot can hand over to a live agent, let’s try to run a full support cycle.

In the chat console on the right, type in the request, “What’s the status of my order?” After you type the request, hit “Send.”

The chatbot will answer with the demo answer, “Example response for What’s the status of my order” and will offer the user to get connected with an agent “Do you have any further questions? Do you want me to connect you to a representative?"

Answer “Yes,” and the chatbot will inform you that you are being transferred to an agent.

In the LivePerson dashboard, the agent will be notified that a new user is waiting.

Once accepted, the agent can see the user’s conversation with the bot...

...and send a reply to the user.

The user will continue the discussion with a human agent.

What’s Next?

You can try the handover on other channels, such as Amazon Alexa and Google Home.

Start coding something amazing with the IBM library of open source AI code patterns.  Content provided by IBM.

Topics:
alexa app development ,google home actions ,chatbot app development ,artifical intelligence ,ai

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}