Dialogue flow and salesforce integration topic to be covered in this session.Google home assistant integration with salesforce. you will learn how to write rest apex class and integrate with another system.
2. Google Home
Assistant Integration
with Salesforce.
RAJKIRAN DEWARA
Sr. Salesforce Consultant
Incapsulate,Ahmedabad
Gujarat, India
Trailhead
https://trailhead.com/me/rajkiran-dewara
Facebook
https://facebook.com/rajkiran.dewara
LinkedIn
https://linkedin.com/in/rajkiran-dewara/
Twitter
https://twitter.com/dewara_rajkiran
3. Dialogflow Configuration
1. Dialogue flow topic to cover in this
session
a. Sign up dialogue flow
b. Create Agent
c. Create Intents
i. Contexts
ii. Events
iii. Training phrases
iv. Action and parameters
v. Response
vi. Fulfillment
d. Integration
e. Demo with test simulator
2. Salesforce topic to cover in this session
a. Site creation.
b. Remote site setting
c. Apex rest class
d. Connected app
e. Account creation
4. Sign up for Dialogflow
1. Go to https://console.dialogflow.com/
, https://dialogflow.com/ or
https://dialogflow.cloud.google.com/
2. Sign in with your google account.
5. Create Agent
1. Click on the setting icon left
side menu bar and click
create new agent.
2. Give your agent name in
the form and click
create.keep all the
predefined value as it is.If
you want to change your
default language than
change in the form.
6. Create Intent
1. Once you are done with
creating your agent now
it’s time to create your
intent for the agent. Intent
will help to identify your
question or queries so that
assistant can give answer
to the queries or question.
2. Intents are mappings
between a user's queries
and actions fulfilled by
your software.
9. Create Intent- Training
1. Training phrases are the questions answer. Once bot ask you , how may i help
you and if you says to bot create account, it will ask you the follow up question or
have action on the answers. This will be shown in demo.
10. Create Intent- Action
1. Action and parameters each param is bind with a question.If bot ask what is your
account name and you submit your account name “Rajkiran” it will store the value
into “Name” param. Similar other param are stored and later utilized to sent to
other integrated system(Salesforce)
11. Create Intent- Responses
1. Once all the action param answered and stored in parameter, the final question
bot will ask through this intent. Are you sure you want to process ? this is
something we need to give yes or no answer so for this purpose, we need to
create the follow up intent.
12. Intents
1. Click on the add follow up intent and it will prompt you the what intent you want to
create exactly, in our case we are going to create yes follow up intent.
13. Intents
1. Click on the add follow up intent and it will prompt you the menu what intent you
want to create. In our case we are going to create yes follow up intent.
14. Create Intent
1. Once you create follow up intent, it will be shown under the parent
intent create account.
15. Follow up Intent- Training phrase
1. Training phrase will already have predefined set of question because its a yes
follow up intent so the training phase will be sure,yes , okay etc.
17. Follow up Intent- Responses
1. This intent is our end of conversation intent so we are going to enable the response
as end of conversation and send the collected data to integrated system.
18. Follow up Intent- Fulfillment
1. Fulfillment is nothing but to enable the webhook(integration api) between dialogue
flow and the integrated system.This configuration we will see in Fulfillment section.
19. Salesforce- Rest Apex Class
1. Before we setup the fulfillment configuration lets create a apex rest class in
development org and we need to have few more setting the the org, lets see.
20. Salesforce - Site creation
1. Go to setup and search for site and create a site in salesforce, this site url and
path we will be using in dialogflow fulfillment section as a api.
21. Salesforce- Site Detail
1. Give the site name other field, there is a custom url for site you can create one and
give the path for the url this is we are going to use in dialogflow fulfillment section.
22. Salesforce- Sites
1. Site url and path from this site we will be using in dialogue flow fulfillment section.
23. Fulfillment
1. In the url section we used site
htttps://{salesforcesiteurl}/{salesforcesitepath}/services/apexrest/{salesforcerestapexcl
assrestresourcename}
2. https://xxxxx-developer-edition.xx.force.com/dialogflow/services/apexrest/Dialogflow
24. Salesforce- Remote site setting
1. White list the dialogflow url in the remote site setting.
25. Salesforce- New Connected App
1. Go to Apps-> App Manager and create new connected app to allow the dialogflow to
salesforce integration.
26. Salesforce- Connected App
Details1. There is other way to call salesforce api using the connected app details in the
fulfillment url request header, but we are not using at present these configuration.
27. Integration of intent.
1. We need to integrated our welcome intent and by default its dialogue flow but we
required our “Create Account” intent to be default for this agent.Click on the
integration setting.
28. Integration of intent
1. Once you click on the integration setting popup will appear and you need to search
for “Create Account” intent in implicit invocation search box select the intent and
click on the “Test” button bottom right.
29. We are all set to test the
Google Assistant integration
with Salesforce. Lets start
the simulator to test what
we have built it.
1.
30. Agent detail
1. This agent detail will appear in the test simulator as a user.in our case the project
Id will be in the test simulator screen.(raj-cpejkm)
31. Test Simulator
1. Once you are in the simulator all the agent created by you will be appear in the list top right section.Select
your agent.
2. Left side Action Directory is your google assistant.Display name is publicly displayed in the Actions directory.
Users say or type the display name to begin interacting with your Actions. For example, if the display name is
Dr. Raj, users can say "Hey Google, Talk to Dr. Raj", or type "Talk to Dr. Raj" to invoke the Actions.
3. Click on “Talk to Dr. Raj” Raj is your agent name by default it comes agent name but you can modify this in
Develop section.
32. Test Simulator
1. Once you click on “Talk to Dr. Raj” first question will appear from you agent-intent that is
greeting message.
2. Type your answer or input in the box, in our case we want to create account.
33. Test Simulator
1. Once you type and enter “add account” or “create account” it will show the next
follow up question based on required param we need for this intent.
2. Remember these param we have created in the intent.
34. Test Simulator
1. Type your account name and enter, next param question will appear , please provied
the phone number. Enter you phone number.
36. Test Simulator
1. Once you entered all the required param detail the final intent question shows all the
details and ask the confirmation to create the account using these entered details.
37. Test Simulator
1. Once you confirm with yes , the webhook enabled in the intent will call the salesforce
api through fulfillment and in the apex rest class we need to parse the request body
and get all the param and set in Account object and insert the detail done.
38. Salesforce- Account Details
1. Go to the salesforce org and search for your account name and verify the details you
entered.
39. Summary
1. In this session you were learnt
a. Google assistant integration with salesforce.
b. Creating the agent , intent and how to do webhook.
c. How to train the intent and give param.
d. How to white list the url in salesforce remote site setup.
e. How to create a site so that it can be directly used as a API in dialogue flow.
f. One good thing is when you create a site it will by default create the “User” and “Profile” using
same name of the site, if you have noticed the account details created by: “Rajkiran Virtual
Assistant Guest User” this user created by default when we create a public site.
g. How to test using simulator.
h. You can further enhance your knowledge in
i. https://dialogflow.cloud.google.com/#/assistant_preview
ii. https://console.actions.google.com/
iii. Explore the tab Develop,Deploy and analytics.