SalesForce-Einstein Custom App
Objective
This guide will help you to quickly connect to SalesForce Einstein and create various methods to pull data. The purpose is to demonstrate how easy it is to integrate SalesForce Einstein to the VoiceWorx platform.
Pre-requisites
An active Salesforce Einstein Account
It is required for the user to have an active Salesforce Einstein account as this integration will require login to the users Salesforce account.
If an active account is not established, please follow the steps below:
Go to https://developer.salesforce.com and click on “Signup” button. It should take you to the screen below. Fill out the relevant details and complete the registration process:
Once the registration is complete, go to www.Salesforce.com, login with the credentials and the screen below will appear:
Now Einstein platform will need to be enabled. To do this, go to search bar and search for analytics then click “Getting Started” as shown in picture below:
On the page, click “Enable Einstein Analytics” as shown below:
After Einstein is enabled, click on “Launch Einstein Analytics” button on the same place as shown below:
This will redirect to Einstein platform tab where you can access Dashboards, DataSets, Lenses, Stories, etc. The user is able to execute lenses and perform SAQL queries on datasets from our Salesforce custom skills which will be demonstrated under the method section of the documentation. The landing page of Einstein platform is shown below:
Steps
To proceed with these steps, you should have all the pre-requisites satisfied. If you are missing something, please go back and make sure you satisfy all of them.
Once done, you are ready to get started using VoiceWorx platform with SalesForce.
The following shows the general steps/activities that will be carried out in setting up this integration. Note: It is advisable to use same email for signup across the 3 channels below. Step 1 -3 below are required.
Ensure you Login With Amazon (LWA) https://developer.amazon.com/alexa/console/ask account is setup by your admin. If you are the account admin, you can follow this instruction to set it up.
Set up connection to Salesforce
Create a custom skill in Voiceworx.
Publish the skill
Test the Alexa skill.
Setup connection to Salesforce
Login to the VoiceWorx portal at https://portal.voiceworx.ai. After login, the VoiceWorx portal home page will be shown as below:
To Configure Salesforce, use the left navigation menu and select “Integration” then select "Connect System”.
The user will be redirected to “Connect to External Systems” interface as shown below. Now click “Connect to External Systems” in the lower left corner.
A popup will appear. Please select or enter the following:
Select Integration Category: Custom
Select System Type: SalesForceCustom
System Instance Name: Sales Force Custom
Click: “CONNECT SYSTEM”
Note: If a SalesForce Account is running on customer domain tick “Use Custom Domain” checkbox and provide the custom domain URL. Also, if Sandbox account is used then tick “Sandbox” checkbox.
After clicking “Connect System”, the user will be redirected to “Allow” access page. Click on “Allow” which will take the user to SalesForce login page as shown below.
Once logged in, the user will be redirected to the VoiceWorx platform with a success screen as shown below.
Now, you have successfully integrated Salesforce with the VoiceWorx platform. Now, click on “Return to Integration Configuration” to return to the connections page. SalesforceCustom should now appear in the list as shown below.
Create a custom skill in Voiceworx
To create a skill, use the left navigation menu and select “Custom Skills” then select “Manage Skills” and then click “Create New Custom Skill“. The screen below will appear.
Add Custom Skill by doing the following:
Name: Salesforce Custom Skill
Custom Skill Type: Search
Category: None
Click: Save.
The screen below will appear:
A Data Source connects the Skill with the integration. Once a skill is created, use the tabs at the top and click “Data Sources” then click “Create New Data Source”.
The following popup screen will appear:
Add DataSource by doing the following:
Name: Salesforce DataSource
Integration Configuration: SalesForceCustom : SalesForceCustom@youraccountname
Click: Save
Create Methods to fetch the data from Salesforce
Methods allows you to fetch data from Salesforce.
VoiceWorx platform currently supports following Salesforce methods:
Get All Objects
Get Object Fields
Get Object ById
Get Object All Records
Get SOQL Query Results
Create Object
Update Object
Delete Object
Depending on the user’s requirement, select an appropriate method. This document will explain one method with an example and rest of methods will be on the appendix section.
Create Methods to Fetch the Data from Salesforce
Methods allows you to fetch data from Salesforce.
Currently, VoiceWorx platform supports following Salesforce Einstein methods,
Einstein.ExecuteSAQLQuery
Einstein.ExecuteLens
Einstein.GetAnalyticsResources
Einstein.GetDashboards
Einstein.GetDataSets
Einstein.GetLenses
Depending on the requirement, the appropriate method will need to used. This document will explain one method with an example and rest of methods will be on the appendix section.
Scenario/ Use Case (Explore Opportunities)
Salesforce Einstein lists out opportunities. For this, you can use “Einstein.ExecuteLens” method as explained below.
Use the top menu tabs. Click on the “Methods”.
Click “Create New Methods”. Then select or enter the following:
Name: OpportunitiesByNameMethod
Request Type: Einstein.Executelens
Lens: Explore Opportunities (AppName)
Result Type: ListOfRecords
Record Limit: 10
Record JsonPath: $.results.records[*]
Empty Result Template: No Opportunities Found
Record Templat: {{Name}} with amount {{sum_Amount}}
Result Template: I have found the following opportunities {{Records}}
Click: Save
Create Intents
In the top menu tabs, select “Intents” and “Create New Intent”. Then select or enter the following:
Name: OpportunitiesByNameIntent
Intent Type: Search
Intent Action: Execute Method
DataSource: Salesforce DS
DataSource Method: OpportunitiesByNameMethod
Click: Save
Create Utterance
In the top menu tabs, select “Utterance” and select “Create New Utterance”. Utterance are words spoken to launch specific intents. Now input or select the following:
Value: list opportunities by name
Custom Skill: Salesforce Custom Skill
Intent: OpportunitiesByNameIntent
Click: Save
Create Input
In the top menu tabs, select “Input” and select “Create New Input”. Then input or select the following:
Name: OpportunitiesByNameInput
Custom Skill: Salesforce Custom Skill
Custom Intent: OpportunitiesByNameIntent
Data Source: Salesforce DS
Data Source Method: OpportunitiesByNameMethod
Publish to Alexa
To publish to Alexa, select “Publish” in the top menu tabs then click “Add Skill Publishing”. Then input or select the following:
External Skill Name: Salesforce Einstein Skill. (This will be the name of the skill in Alexa. Therefore, make it unique and different from the names of your other skills in Alexa.)
Skill Type: Search
Channel: Alexa
Skill Invocation Name: salesforce einstein. (This will be what users say to launch your skill in Alexa. It must be in lower case alphabets cannot contain START, BEGIN, STOP, EXIT, LAUNCH and cannot contain number or special characters.)
Uncheck the following: Require account linking, Auto Publish
Optional: Replace all placeholder values in all “Message”. Uncheck all the settings shown in the second image below.
Click: Save.
In the top menu tabs select “Publish” then click “Publish to Alexa”.
Once in Publish Skill to Amazon Alexa select and do the following:
Selected Skill: Contact Finder
Select Amazon Account: LWA Config
Select the LWA account setup by your admin or the one you set up in step 4 above.
Click: Publish To Alexa
On the resulting screen, ensure that a success message shows for the publishing steps before clicking the “Go To Alexa Skill”. If success message not shown, click “Go To Skill Publishing” to fix any issue shown in publishing result.
On the Alexa skill page, ensure “Full Build Successful” message is shown in bottom right corner before starting to test skill.
Go to “test” tab in the top menu, then below “test” tab change the skill test status from “Off” to “Development”.
Invoke skill by typing the invocation name (Salesforce einstein) inserted in the publishing step in Voiceworx. If the invocation is successful, your configured welcome message will be displayed in the developer console.
Congratulations!
You have successfully completed building a SalesForce -Einstein Custom Skill.
Appendix
Salesforce Methods
Method: Einstein.ExecuteSAQLQuery
This method requires parameters as explained below.
Parameters:
Other than these two parameters, you need to provide following standard inputs:
Method: Einstein.ExecuteLens
This method requires parameters as explained below.
Parameters:
Other than these two parameters, you need to provide following standard inputs
Method: Einstein.GetAnalyticsResources
This method is used to fetch all the available analytics resources like datasets,lenses,dashboards,etc.
Parameters:
This method does not require any parameter.
Sample Response:
Contact object has around 61 fields so this method will return you that much records, one record represents one field.
Method: Einstein.GetDashboards
This method is used to fetch all the available dashboards that you created in Einstein platform.
Parameters:
This method does not require any parameter.
Sample Response:
Method: Einstein.GetDatasets
This method is used to fetch all the available datasets that are availabled in your Einstein platform acccount.
Parameters:
This method does not require any parameter.
Sample Response:
Method: Einstein.GetLens
This method is used to fetch all the available lenses that are available in your Einstein platform account.
Parameters:
This method does not require any parameter.
Sample Response:
Last updated