It also means Salesforce CRM integration with Unity.
(Work in progress)
Unity | Salesforce Service Console |
VIRTUAL WORLD REAL WORLD
Objects: LiveChatTranscript, Case, Lead ...
^
|
Pop up
|
Unity ---------- Chat initiation ------------> Salesforce Service Console
3D Games
Digital Twin
Metaverse
- Virtual housing exhibition
- Virtual retail stores
- Virtual sightseeing
Unity Salesforce Platform
Initializing a chat session
| |
|------- GET System/SessionId -------------->|
|<------ 200 OK -----------------------------|
| |
|------- POST Chasitor/ChasitorInit -------->|
|<------ 200 OK -----------------------------|
| |
Sending a message to the agent
| |
|------- POST Chasitor/ChatMessage --------->|
|<------ 200 OK -----------------------------|
| |
Polling for fetching a message from the agent
| |
|------- GET System/Messages --------------->|
|------- 200 OK -----------------------------|
| |
"Config.cs" is a config file for this application. However, it is not included in this repo for security/privacy reasons. Create "Config.cs" with the following constants in the "Scripts" folder:
using UnityEngine;
public class Config : MonoBehaviour
{
public const string BASE_URL = "<Salesforce Chat REST server host>/chat/rest/";
public const string ORGANIZATION_ID = "<your company's organization ID";
public const string DEPLOYMENT_ID = "<deployment ID>";
public const string BUTTON_ID = "<button ID>";
public const string AGENT_ID = ""; // Empty for normal chat
public const string USER_AGENT = "UnityWebRequest";
public const string LANGUAGE = "ja-JP";
public const string SCREEN_RESOLUTION = "2560x1440";
public const string VISITOR_NAME = "<your name>";
public const string API_VERSION = "55";
}
Refer to this document to get your chat settings from your organization.
This app uses Starter Assets - First Person Character Controller to navigate the user in the 3D virtual world.
Uncheck the checkbox in the yellow circle in the following fig so that a user of this app can enter chat messages in the Input Field:
PlayerCapsule GameObject:
Patch: https://github.com/araobp/unity-chat/commit/25ae2f090f98cbf649396e20b6333433528b4852
It is necessary to send data on your prechat form to the REST API server for auto-creation of Contact and Case records.
In case of REST API client (not prechat form (HTML5/CSS/JS) generated by Salesforce), you need to set "prechatDetails" and "prechatEntities" to ChasitorInit like the following code: SalesforceChat.cs
Snippet
chasitorInit.prechatDetails.Add(firstName);
chasitorInit.prechatDetails.Add(lastName);
chasitorInit.prechatDetails.Add(phone);
chasitorInit.prechatDetails.Add(subject);
chasitorInit.prechatEntities.Add(contact);
chasitorInit.prechatEntities.Add(case_);
You might need to delete LiveChatTranscript records from your data storage sometimes, because LiveChatTranscript consumes a lot of data storage.
In that case, the following Apex code is useful:
public class ClearLiveChatTranscript {
public static void clear() {
LiveChatTranscript[] records = [SELECT Id FROM LiveChatTranscript];
delete records;
}
}
Capture a scene with Unity Camera and transfer the image to the Salesforce Live Agent via chat. Unfortunately, Salesforce Chat REST API does not support file transfer at the moment...
Screen sharing between the client and the agent.