0

I have created an Einstein chat bot and hosted it on Salesforce communities along with the 'snippet script'. By using it, I'm mapping the pre chat fields with the Contact & Case objects and performing other operations as well.

The issues comes in, when I provided the 'Embedded Service Deployment' code of the Einstein to external website where we can't call the Snippet Script like we call it in community builder. Used below link to share the Bot code:

https://help.salesforce.com/s/articleView?id=sf.snapins_chat_get_code.htm&type=5

As there is no Snippet file involved in Embedded Service code, Pre chat fields data is not getting stored in salesforce. So my question is, is there any way to embed the Snippet Script file like we do in salesforce community builder via the 'Embedded Service Deployment' code? So, I can get the Pre-chat data to salesforce.

Thanks for your anticipation.

1 Answer 1

1

In the embedded service code snippet you can add the details - similar to using the code setting file on experience cloud, you can pass in anything you want from the page.

Here’s a sample of an embedded service code snippet passing in pre-populated (and hidden) pre-chat fields on a non-experience cloud site:

enter image description here

 embedded_svc.settings.extraPrechatFormDetails = [{
  "label": "ChatEndUserId__c",
  "value": {! '"' & $User.id & '"'},
  "displayToAgent": true,
  "transcriptFields": ["ChatEndUserId__c"]
},
{
  "label": "currentRecord",
  "value": {! '"' & $CurrentPage.parameters.recordId & '"'},
  "displayToAgent": true,
  "transcriptFields": ["internalRecordId__c"]
}];

More in Pass Nonstandard Pre-Chat Details doc

This particular example is embedding a chatbot inside a SF service console as attached using an overlayed visualforce page. This is why variables like $User.id are available and used and that's why the formatting/usage of that variable may look strange. Users can use whatever info is available to them on their site (for example a customer ID or some such)

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .