• Sam Sam 85
  • NEWBIE
  • 0 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 5
    Questions
  • 0
    Replies
Hello everyone, 

I am currently stuck trying to figure out how to do the following:

Is there a way I could intercept the user sent message on client-side (before it goes to the bot) and then send to the bot my own custom message, all in javascript?

For example:

1.  User sends a message "Hello".
2.  My client-side javascript, intercepts the user sent message.
3.  In javascript, customize the message and then send the custom message to the bot.  In this example, I send to the bot "Hello, world!!!".

Thank you for all your help.

HTML Code:
<div id="divContainer">
	<img id="imgChatBubble" src="..." />
</div>

Javscript Code:
var initESW = function (gslbBaseURL) {
	
	embedded_svc.settings.displayHelpButton = false; 
	embedded_svc.settings.language = ''; 

	embedded_svc.settings.enabledFeatures = ['LiveAgent'];
	embedded_svc.settings.entryFeature = 'LiveAgent';
		
	embedded_svc.settings.widgetHeight = "90%";

	embedded_svc.init(
		'...',
		'...',
		gslbBaseURL,
		'...',
		'...',
		{
			baseLiveAgentContentURL: '...',
			deploymentId: '...',
			buttonId: '...',
			baseLiveAgentURL: '...',
			eswLiveAgentDevName: '...',
			isOfflineSupportEnabled: true
		}
	);
};

if (!window.embedded_svc) {
	var s = document.createElement('script');
	s.setAttribute('src', '...');
	s.onload = function () {
		initESW(null);
	};
	document.body.appendChild(s);
}
else {
	initESW('https://service.force.com');
}


function setupOnChasitorMessageEventHandler() {

	// onChasitorMessage event fired when user sends a message.  
	// This event handler will handle the fired onChasitorMessage event.
	embedded_svc.addEventHandler("onChasitorMessage", function (data) {

		if (true) {

		}
		
	});
}


setupOnChasitorMessageEventHandler();
Hi everyone,

Is there a way for apex code to access the einstein bot out-of-the-box entities and custom entities?  I would like to use the bot entities to apply it to a user utterance / last user input, in my apex code.

For example, the user entered into the bot the sentence “I want to see a cardiologist”.  I want to be able to, through Apex code accessing my Einstein bot entities or some other way in Apex code, pull out the word “cardiologist” from the user input. 

Thank you.
Hi everyone, 

I am currently running into an issue with my "Embedded Service - Embedded Web Chat".  I have a custom chat button on the bottom right corner of my web page.

When a user clicks on the custom chat button, the web chat is displayed.  Next the user clicks on the minimize button that's availabe on the web chat.  The minimize button is an out-of-the-box button that's included as part of the web chat.  The web chat is minimized.  But what is displayed is the default out-of-the-box Salesforce chat button.

How do I go about making the default Salesforce chat button not be displayed?  Is there some out-of-the-box function/method I can use or call?  Or is there a setting/configuration that indicates to not display the default Salesforce chat button when the web chat is minimized?

Only my custom chat button should be displayed when the web chat is minimized.

I am stuck on this issue for a couple of days.  Much appreciate any help on this.

Thank you.

User-added image

Html Code:
<div id="divContainer">
	<img id="imgChatBubble" src="..." />
</div>

Javascript Code:
​​​​​​​
var initESW = function (gslbBaseURL) {
	
	embedded_svc.settings.displayHelpButton = false; 
	embedded_svc.settings.language = ''; 

	embedded_svc.settings.enabledFeatures = ['LiveAgent'];
	embedded_svc.settings.entryFeature = 'LiveAgent';
		
	embedded_svc.settings.widgetHeight = "90%";

	embedded_svc.init(
		'...',
		'...',
		gslbBaseURL,
		'...',
		'...',
		{
			baseLiveAgentContentURL: '...',
			deploymentId: '...',
			buttonId: '...',
			baseLiveAgentURL: '...',
			eswLiveAgentDevName: '...',
			isOfflineSupportEnabled: true
		}
	);
};

if (!window.embedded_svc) {
	var s = document.createElement('script');
	s.setAttribute('src', '...');
	s.onload = function () {
		initESW(null);
	};
	document.body.appendChild(s);
}
else {
	initESW('https://service.force.com');
}

function setupChatBubble() {

	var $imgChatBubble = $("#imgChatBubble");

	$imgChatBubble.on("click", function (e) {

		// Display the web chat.
		embedded_svc.liveAgentAPI.startChat();
		
		// Hide chat bubble.
		$imgChatBubble.fadeOut({

			duration: 400
		});
	});
}

function displayChatBubble() {

	var $imgChatBubble = $("#imgChatBubble");

	// Show chat bubble.
	$imgChatBubble.fadeIn({

		duration: 400
	});
}

function setupAfterMinimizeEventHandler() {

	embedded_svc.addEventHandler("afterMinimize", function (data) {

		displayChatBubble();
	});
}

function setupAfterDestroyEventHandler() {

	embedded_svc.addEventHandler("afterDestroy", function (data) {

		displayChatBubble();
	});
}

setupChatBubble();

setupAfterMinimizeEventHandler();

setupAfterDestroyEventHandler();

​​​​​​​
Hi everyone,

I am currently experiencing an issue with the "Action" dialog's "Object Search" on the "Knowledge" object in the Einstein Bot.

I have an action dialog set up where the:

1.  Action Type:          Object Search
2.  Object:             Knowledge
3.  Search Criteria:    [System] Last Customer Input
4.    Selected Fields:    Title, Answer

When I click on the "Save" button, it throws the following error:
Custom Field Definition ID: bad value for restricted picklist field: Knowledge__kav.Answer__c

The data type of the "Answer" field of the "Knowledge" object is "Rich Text Area(32768).

I tried searching around and looking to see why this error is occurring and where I could fix it.  Unfortunately, I wasn't able to find a solution to this issue.  I'm currently stuck on this problem.  Out of the box, this should work.  The "Answer" field and its data type was created automatically by the Salesforce system when I went through the Knowledge Setup flow.

Any help is greatly appreciated.

Thank you very much

User-added image
Good morning everyone,

I am currently running into an issue with my "Embedded Service - Embedded Web Chat".  I have a custom chat button on the bottom right corner of my web page.

When a user clicks on the custom chat button, the web chat is displayed. Next the user clicks on the minimize button that's availabe on the web chat.  The minimize button is an out-of-the-box button that's included as part of the web chat.  The web chat is minimized.  When the user clicks on the custom chat button again, the web chat does not display.  

I am not sure what I did wrong or how to go about making this work.

I am using an "Einstein Bot" and the "Embedded Service Deployment".  I used the "Embedded Service Code Snippet" provided by the "Embedded Service Deployment".

Html Code:
<div id="divContainer">
	<img id="imgChatBubble" src="..." />
</div>
Javascript Code:
var initESW = function (gslbBaseURL) {
	
	embedded_svc.settings.displayHelpButton = true;
	embedded_svc.settings.language = '';

	embedded_svc.settings.enabledFeatures = ['LiveAgent'];
	embedded_svc.settings.entryFeature = 'LiveAgent';
		
	embedded_svc.settings.widgetHeight = "90%";

	embedded_svc.init(
		'...',
		'...',
		gslbBaseURL,
		'...',
		'...',
		{
			baseLiveAgentContentURL: '...',
			deploymentId: '...',
			buttonId: '...',
			baseLiveAgentURL: '...',
			eswLiveAgentDevName: '...',
			isOfflineSupportEnabled: true
		}
	);
};

if (!window.embedded_svc) {
	var s = document.createElement('script');
	s.setAttribute('src', '...');
	s.onload = function () {
		initESW(null);
	};
	document.body.appendChild(s);
}
else {
	initESW('https://service.force.com');
}

function setupChatBubble() {

	var $imgChatBubble = $("#imgChatBubble");

	$imgChatBubble.on("click", function (e) {

		// Display the web chat.
		embedded_svc.bootstrapEmbeddedService();
	});
}

setupChatBubble();
I am currently stuck on this issue for a couple of days.  Any help is very much appreciated.

Thank you so very much.