SalesForce Custom App
Objective
This document will demonstrate how easy it is to integrate SalesForce to the ixHello platform and create methods to pull data.
Pre-requisites
An active Salesforce Account
An active Salesforce account is required for this integration. The skill will require the user to log into their Salesforce account.
If an account needs to be created, please follow the steps 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 ixHello 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 compulsory.
Create New Instance of Amazon Connect
If you are new to Amazon Connect, you can start by creating a Free Tier Amazon Web Services account.
Create a new instance of Amazon Connect and obtain a phone number using this official documentation from Amazon. Depending upon your location and the location of your target customers, you might need to perform some additional work here. Help from technical department might be required depending upon the scenario.
After creating the instance, Amazon Connect Home.
Sign up for ixHello platform
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 app in ixHello
Publish the skill
Test the Lex
Before you proceed from here, please make sure that these prerequisites have been fulfilled.
Setup connection to Salesforce
On the resulting Connect External System form, fill out the following details, and click on ‘Connect System’.
Integration Category: Custom
System Type: SalesforceCustom
System Instance Name: Salesforce Demo
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.
Once you click on “Connect System” button, you will be redirected to the SalesForce login page as shown below. Enter your username and password and click on “Login” button.
Once you are logged in, Salesforce might show a screen with permissions options, allow it. You will be redirected to the platform with a success screen as shown below.
Now, you have successfully integrated Salesforce with the platform.
Now Salesforce has been successfully integrated with the ixHello platform. Now, click “Return to Integration Configuration” to return to the connections page. SalesforceCustom will appear in the list as shown below.
Create a custom App in
Fill following details in the Add Custom window and click ‘Save’.
Name: Salesforce Custom
Custom Skill Type: Search
The following popup screen will appear, add following details and click on Save.
Name: Salesforce DataSource
Integration Configuration: Select Salesforce Integration Config created in Step 2.
Create Methods to fetch the data from Salesforce
Next step is to create Methods. Methods allows you to fetch data from Salesforce. The salesforce supported custom queries can be used to define the data to be fetched from the linked Salesforce account.
ixHello 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
For this document, we’ll create only one method. Users can refer to the appendix to explore all other supported methods.
Scenario/ Use Case (Contact Finder):
Method: GetSOQLQueryResult
This method requires just one parameter. Please review the information below.
Parameters:
SOQLQuery
SELECT Id, FirstName, LastName,Phone
FROM Contact
WHERE FirstName='John'
and LastName='Bond'
This is a standard Salesforce Object Search language (SOQL) query which you can use in different ways
Other than these two parameters, provide following standard inputs:
Method Name
You can give any name. This name will be displayed in the methods list.
Request Type
GetItems
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 ixHello platform will pick that data in consideration while displaying results.
Example: $.[*]
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 contact details”
Record Template
Let’s assume that the following json represents one record.
{
"attributes": {
"type": "Contact",
"url": "/services/data/v47.0/sobjects/Contact/0032w000002GFOVAA4"
},
"Id": "0032w000002GFOVAA4",
"FirstName": "John",
"LastName": "Bond",
"Phone": "(312) 596-1000"
}
In this example, Phone is at root level and can be accessed by {{Phone}}
So record template can be written as
Phone number of {{FirstName}} {{LastName}} is {{Phone}}
So, when a method is executed, this will be displayed as,
Phone number of John Bond is (312) 596-1000
Note:
Anything written in between {{ }} is represented as a json field and it’s case-sensitive.
{{Phone}} is not same as {{phone}}
Result Template
This indicates how method results should be represented.
Here you go, {{Records}}
Here, {{Records}} represents one or more records separated by a separator.
Sample Response:
[
{
"attributes": {
"type": "Contact",
"url": "/services/data/v47.0/sobjects/Contact/0032w000002GFOVAA4"
},
"Id": "0032w000002GFOVAA4",
"FirstName": "John",
"LastName": "Bond",
"Phone": "(312) 596-1000"
}
]
Now let’s us proceed back to method building in ixHello. Click on ‘Create New Method’, and fill out following details in the Create New Method pop up.
Name: GetContactMethod
Request Type: GetSOQLQueryResult
SOQL Query: SELECT Id, Name,Phone FROM Contact WHERE Name='{{ContactName}}'
Result Type: ListOfRecords
Record Limit: 1
Record JsonPath: $.[*]
Empty Result Template: Sorry I could not find phone number for requested name
Record Template: Phone number for {{Name}} is {{Phone}}.
Result Template: {{Records}}
Click: Save
Before moving further, you want to test whether the method build is success and the method is able to extract correct data from Salesforce or not. Click on ‘Test’ to test the created method.
Now, to test the method, let us go back to the Salesforce portal and create a Contact.
Create Intents
In the top menu tabs, select “Intents” and “Create New Intent”. Then select or enter the following:
Fill following details and click on Save
Name: SearchContactIntent
Intent Type: Search
Intent Action: Executive Method
DataSource: Salesforce DataSource
DataSource Method: GetPhoneNumberByName
Create Slots
In next step, we have to create Slots. Slots correspond to the parameters in SOQL query that we defined in the method screen. In the top menu tabs, select “Slots” and select “Create New Slot”.
Fill the following details.
Note: The Reprompt message is what Lex will ask if it can’t fill/resolve the person slot. Then select or enter the following:
Name: ContactName
Slot Order: Blank
Reprompt Message: What is the name
Type: Full name
Custom Skill: Salesforce Custom Skill
Intent: SearchContactIntent
Click: Save
Create Utterance
Utterance are words spoken to launch specific intents. In the top menu tabs, select “Utterance” and select “Create New Utterance”. Now input or select the following:
Value: What is the phone number of {ContactName}
Custom Skill: Salesforce Custom Skill
Intent: SearchContactIntent
Create Input
In the top menu tabs, select “Input” and select “Create New Input”.
Fill the following details:
Name: SearchContactInput
Custom Skill: Salesforce Custom Skill
Custom Intent: SearchContactIntent
Data Source: Salesforce DS
Data Source Method: GetContactMethod
Once the Input is created, click on ManageParameters. You need to follow this step if you have defined Slot.
On the resulting screen, click on Input Parameter and add the following details.
Input Parameter Name: ContactName
Parameter: ContactName
Data Type: Text
Publish to Lex
The next step is to Publish the app. Here, we are going to publish to Amazon 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 CRM Demo 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: Amazon Lex
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 Lex select and do the following:
Selected App: Salesforce custom skill
External App Name: SalesForce CRM Demo Skill
Amazon Lex Version: V2
Select Amazon Lex Account:
Select the Lex account setup by your admin or the one you set up in step 4 above.
Click: Publish To Amazon Lex
On the resulting screen, ensure that a success message shows for the publishing steps before clicking “Test Lex”. If success message not shown, click “Go Back to App Publishing” to fix any issue shown in publishing result.
Once clicked on "Test Lex Bot", you will be redirected to App Publishing screen, and the Test Bot will appear at the right corner showing the App name along with the welcome message:
Congratulations!
You have successfully completed building a SalesForce-Custom Skill.
Last updated