You need to sign in to do that
Don't have an account?
Hari Kumar Enaganti
Eisntein Chat Bot- Embedded service deploym,ent implemenattion not working in Einstein chat bot
Hi I have some customization in Einstein chat bot as per my requirement.
I have created embedded service deployments for my my chat ,and pasted the **Get Code** snippet in my html. But the chat window shows Live Agent chat window rather than with Embedded service deployment.
I am posting my code here can some one assist me here in this.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
</head>
<body >
<h1>Cookbook Bot</h1>
<!-- PUT BUTTON CODE SNIPPET HERE -->
<a id="liveagent_button_online_5737F000000geoj" href="javascript://Chat" onclick="liveagent.startChat('5737F000000geoj')">Online Chat Content</a>
<div id="liveagent_button_offline_5737F000000geoj" style="display: none;"><!-- Offline Chat Content --></div>
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('5737F000000geoj', document.getElementById('liveagent_button_online_5737F000000geoj'));
console.log('18---------r-----');
liveagent.showWhenOffline('5737F000000geoj', document.getElementById('liveagent_button_offline_5737F000000geoj'));
});
</script>
<!-- PUT DEPLOYMENT CODE HERE -->
<script type='text/javascript' src='https://c.la1-c1-hnd.salesforceliveagent.com/content/g/js/55.0/deployment.js'></script>
<script type='text/javascript'>
console.log('26--------k------');
liveagent.init('https://d.la1-c1-hnd.salesforceliveagent.com/chat', '5727F000000gmmz', '00D7F000002dQK0');
</script>
<style type='text/css'>
.embeddedServiceHelpButton .helpButton .uiButton {
background-color: #005290;
font-family: "Arial", sans-serif;
}
.embeddedServiceHelpButton .helpButton .uiButton:focus {
outline: 1px solid #005290;
}
</style>
<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
<script type='text/javascript'>
console.log('42--------------');
var initESW = function(gslbBaseURL) {
console.log('44--------------'+gslbBaseURL);
embedded_svc.settings.displayHelpButton = true; //Or false
embedded_svc.settings.language = ''; //For example, enter 'en' or 'en-US'
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert)
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)
//embedded_svc.settings.loadingText = ''; //(Defaults to Loading)
//embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)
// Settings for Chat
embedded_svc.settings.directToButtonRouting = function(prechatFormData) {
// Dynamically changes the button ID based on what the visitor enters in the pre-chat form.
// Returns a valid button ID.
};
//embedded_svc.settings.prepopulatedPrechatFields = {}; //Sets the auto-population of pre-chat form fields
//embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId
//embedded_svc.settings.offlineSupportMinimizedText = '...'; //(Defaults to Contact Us)
embedded_svc.settings.enabledFeatures = ['LiveAgent'];
embedded_svc.settings.entryFeature = 'LiveAgent';
console.log('---');
embedded_svc.init(
'https://dev-ed.my.salesforce.com',
'https://developer-edition.ap5.force.com',
gslbBaseURL,
'00D7F000002dQK0',
'CSupport',
{
baseLiveAgentContentURL: 'https://c.la1-c1-hnd.salesforceliveagent.com/content',
deploymentId: '5727F000000gmmz',
buttonId: '5737F000000geoj',
baseLiveAgentURL: 'https://d.la1-c1-hnd.salesforceliveagent.com/chat',
eswLiveAgentDevName: 'CSupport',
isOfflineSupportEnabled: false
}
);
console.log('--|-');
};
if (!window.embedded_svc) {
console.log('83-----------a---');
var s = document.createElement('script');
s.setAttribute('src', 'https://dev-ed.my.salesforce.com/embeddedservice/5.0/esw.min.js');
s.onload = function() {
initESW(null);
};
document.body.appendChild(s);
} else {
console.log('91-----d---------');
initESW('https://service.force.com');
}
</script>
</body>
</html>
I have created embedded service deployments for my my chat ,and pasted the **Get Code** snippet in my html. But the chat window shows Live Agent chat window rather than with Embedded service deployment.
I am posting my code here can some one assist me here in this.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
</head>
<body >
<h1>Cookbook Bot</h1>
<!-- PUT BUTTON CODE SNIPPET HERE -->
<a id="liveagent_button_online_5737F000000geoj" href="javascript://Chat" onclick="liveagent.startChat('5737F000000geoj')">Online Chat Content</a>
<div id="liveagent_button_offline_5737F000000geoj" style="display: none;"><!-- Offline Chat Content --></div>
<script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('5737F000000geoj', document.getElementById('liveagent_button_online_5737F000000geoj'));
console.log('18---------r-----');
liveagent.showWhenOffline('5737F000000geoj', document.getElementById('liveagent_button_offline_5737F000000geoj'));
});
</script>
<!-- PUT DEPLOYMENT CODE HERE -->
<script type='text/javascript' src='https://c.la1-c1-hnd.salesforceliveagent.com/content/g/js/55.0/deployment.js'></script>
<script type='text/javascript'>
console.log('26--------k------');
liveagent.init('https://d.la1-c1-hnd.salesforceliveagent.com/chat', '5727F000000gmmz', '00D7F000002dQK0');
</script>
<style type='text/css'>
.embeddedServiceHelpButton .helpButton .uiButton {
background-color: #005290;
font-family: "Arial", sans-serif;
}
.embeddedServiceHelpButton .helpButton .uiButton:focus {
outline: 1px solid #005290;
}
</style>
<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
<script type='text/javascript'>
console.log('42--------------');
var initESW = function(gslbBaseURL) {
console.log('44--------------'+gslbBaseURL);
embedded_svc.settings.displayHelpButton = true; //Or false
embedded_svc.settings.language = ''; //For example, enter 'en' or 'en-US'
//embedded_svc.settings.defaultMinimizedText = '...'; //(Defaults to Chat with an Expert)
//embedded_svc.settings.disabledMinimizedText = '...'; //(Defaults to Agent Offline)
//embedded_svc.settings.loadingText = ''; //(Defaults to Loading)
//embedded_svc.settings.storageDomain = 'yourdomain.com'; //(Sets the domain for your deployment so that visitors can navigate subdomains during a chat session)
// Settings for Chat
embedded_svc.settings.directToButtonRouting = function(prechatFormData) {
// Dynamically changes the button ID based on what the visitor enters in the pre-chat form.
// Returns a valid button ID.
};
//embedded_svc.settings.prepopulatedPrechatFields = {}; //Sets the auto-population of pre-chat form fields
//embedded_svc.settings.fallbackRouting = []; //An array of button IDs, user IDs, or userId_buttonId
//embedded_svc.settings.offlineSupportMinimizedText = '...'; //(Defaults to Contact Us)
embedded_svc.settings.enabledFeatures = ['LiveAgent'];
embedded_svc.settings.entryFeature = 'LiveAgent';
console.log('---');
embedded_svc.init(
'https://dev-ed.my.salesforce.com',
'https://developer-edition.ap5.force.com',
gslbBaseURL,
'00D7F000002dQK0',
'CSupport',
{
baseLiveAgentContentURL: 'https://c.la1-c1-hnd.salesforceliveagent.com/content',
deploymentId: '5727F000000gmmz',
buttonId: '5737F000000geoj',
baseLiveAgentURL: 'https://d.la1-c1-hnd.salesforceliveagent.com/chat',
eswLiveAgentDevName: 'CSupport',
isOfflineSupportEnabled: false
}
);
console.log('--|-');
};
if (!window.embedded_svc) {
console.log('83-----------a---');
var s = document.createElement('script');
s.setAttribute('src', 'https://dev-ed.my.salesforce.com/embeddedservice/5.0/esw.min.js');
s.onload = function() {
initESW(null);
};
document.body.appendChild(s);
} else {
console.log('91-----d---------');
initESW('https://service.force.com');
}
</script>
</body>
</html>
Does it give you the expected result when you preview the bot from within the Bot Builder, by adding the Embedded Chat deployment?
Related:
How to enable chat and its implementation:
https://help.salesforce.com/articleView?id=live_agent_set_up_basic_implementation.htm&type=5
How to enable Embedded Service:
https://help.salesforce.com/articleView?id=snapins_create_deployment.htm&type=5
How to enable Einstein Chat bot and add it to a page.
https://developer.salesforce.com/docs/atlas.en-us.bot_cookbook.meta/bot_cookbook/bot_cookbook_first_bot.htm
Thanks