SalesForce-Einstein Custom App
Last updated
Last updated
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.
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:
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.
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.
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
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.
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.
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
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
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
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.
This method requires parameters as explained below.
Parameters:
Parameter | Sample Value | Info |
SAQL Query | q = group q by all; q = foreach q generate count() as 'count'; q = limit q 2000; | This is a standard Salesforce Analytics query language (SAQL) query which you can use in different ways. You just need to make sure, you need to omit the first line i.e “load dataset {datasetname}” from the query as you can choose the required dataset from the dropown of dataset parameter and system injects that in query by itself. |
Datasets | Pipeline Trending (VoiceworxSalesApp) | Choose the required dataset from dropdown you want to execute SAQL query against. |
Other than these two parameters, you need to provide following standard inputs:
Parameter | Info |
Method Name | You can give any name. This name will be displayed in the methods list. |
Request Type | Einstein.ExecuteSAQLQuery This is the method that you are using |
Parameters | As explained in the previous table |
Result Type | ListOfRecords (Auto Selected) It indicates that the method can return one or more records |
Record Limit | Numeric value (e.g. 10) If Method is returning larger number of records, then you can limit this result by providing this value. |
Record JsonPath | Each method returns data in json format and to pick any specific information from the json, we need to specify the Record JsonPath so Voice Worx platform will pick that data in consideration while displaying results. Example: $.results.records[*] This selects all the records that is returned. |
Empty Result Template | When the method does not return any data, this response will be generated. So we can specify something like: “Sorry, I could not find the data” |
Record Template | Let’s assume that the following json represents a record. {
},
]
} In this example, you want to access the items of records array, So record template can be written as {{StageName}}, amount {{sum_Amount}} Note: Anything written in between {{ }} is represented as a json field and it’s case-sensitive. {{StageName}} is not same as {{stagename}} |
Result Template | This indicates how method results should be represented. Here you go, We have found the following historical pipeline by stage, {{Records}} Here, {{Records}} represents one or more records separated by a separator. Now the response looks like: I have found the following historical pipeline by stage, Prospecting, amount 24597662, Qualification, amount 53942843, Needs Analysis, amount 64842060, Value Proposition, amount 29715331, Perception Analysis, amount 38981892, Proposal/Price Quote, amount 15889140, Negotiation/Review, amount 17044891, Prospecting, amount 24597662, Qualification, amount 53942843, Needs Analysis, amount 64842060 |
This method requires parameters as explained below.
Parameters:
Parameter | Sample Value | Info |
Lens | Historical Pipeline Stage by Quarter (VoiceworxSalesApp) | Choose the required lens from dropdown. |
Other than these two parameters, you need to provide following standard inputs
Parameter | Info |
Method Name | You can give any name. This name will be displayed in the methods list. |
Request Type | Einstein.ExecuteLens This is the method that you are using |
Parameters | As explained in the previous table |
Result Type | ListOfRecords (Auto Selected) It indicates that the method can return one or more records |
Record Limit | Numeric value (e.g. 10) If Method is returning larger number of records, then you can limit this result by providing this value. |
Record JsonPath | Each method returns data in json format and to pick any specific information from the json, we need to specify the Record JsonPath so Voice Worx platform will pick that data in consideration while displaying results. Example: $.results.records[*] This selects all the records that is returned. |
Empty Result Template | When the method does not return any data, this response will be generated. So we can specify something like: “Sorry, I could not find the data” |
Record Template | Let’s assume that the following json represents a record. {
},
]
} In this example, you want to access the items of records array, So record template can be written as {{StageName}}, amount {{sum_Amount}} Note: Anything written in between {{ }} is represented as a json field and it’s case-sensitive. {{StageName}} is not same as {{stagename}} |
Result Template | This indicates how method results should be represented. Here you go, We have found the following historical pipeline by stage, {{Records}} Here, {{Records}} represents one or more records separated by a separator. Now the response looks like: I have found the following historical pipeline by stage, Prospecting, amount 24597662, Qualification, amount 53942843, Needs Analysis, amount 64842060, Value Proposition, amount 29715331, Perception Analysis, amount 38981892, Proposal/Price Quote, amount 15889140, Negotiation/Review, amount 17044891, Prospecting, amount 24597662, Qualification, amount 53942843, Needs Analysis, amount 64842060 |
This method is used to fetch all the available analytics resources like datasets,lenses,dashboards,etc.
This method does not require any parameter.
Contact object has around 61 fields so this method will return you that much records, one record represents one field.
This method is used to fetch all the available dashboards that you created in Einstein platform.
This method does not require any parameter.
This method is used to fetch all the available datasets that are availabled in your Einstein platform acccount.
This method does not require any parameter.
This method is used to fetch all the available lenses that are available in your Einstein platform account.
This method does not require any parameter.
Create a Data Source