Actions with Google
Bryan Herbst
Android Engineer @ Target
Slide 2
Slide 2 text
The Google
Assistant
“Ok Google” Allo
Google Home Android Auto
Android Wear
Slide 3
Slide 3 text
The Google Assistant
Google Home
Slide 4
Slide 4 text
Design principles
Voice interaction is different
Slide 5
Slide 5 text
What actions
can I take?
Slide 6
Slide 6 text
What actions
can I take?
Slide 7
Slide 7 text
What should I have
for dinner?
What are you in the mood
for? You can say Italian,
American, Mexican, or
Chinese.
!
Slide 8
Slide 8 text
What should I have
for dinner?
What are you in the mood
for? You can say Italian,
American, Mexican, or
Chinese.
! Take turns.
Slide 9
Slide 9 text
“Guide me downtown.”
Slide 10
Slide 10 text
“Guide me downtown.”
Downtown where?
New York?
Minneapolis?
Slide 11
Slide 11 text
“Guide me downtown.”
Driving or walking?
Starting from where?
Slide 12
Slide 12 text
Speech uses shortcuts
Filling in the blanks requires context.
Slide 13
Slide 13 text
Go scriptless
You are (not) a robot.
Slide 14
Slide 14 text
Freedom of speech
Say “help” for more options
Slide 15
Slide 15 text
Freedom of speech
Say “help” for more options
Slide 16
Slide 16 text
Anticipate errors
Shortcuts can cause ambiguity
Slide 17
Slide 17 text
”Buy me a KitKat bar.”
Slide 18
Slide 18 text
”Buy me a KitKat bar.”
Slide 19
Slide 19 text
”Buy me a KitKat bar.”
Slide 20
Slide 20 text
”Buy me a KitKat bar.”
Slide 21
Slide 21 text
”Buy me a KitKat bar.”
”Okay, ordering a king sized KitKat
bar from Amazon. Is that correct?”
Slide 22
Slide 22 text
”Buy me a KitKat bar.”
”Okay, ordering a king sized KitKat
bar from Amazon. Is that correct?”
“Yes.”
Slide 23
Slide 23 text
”Buy me a KitKat bar.”
”Okay, ordering a king sized KitKat
bar from Amazon. Is that correct?”
“No, make it a regular sized KitKat bar.”
Slide 24
Slide 24 text
Anticipate errors
Shortcuts can cause ambiguity
Slide 25
Slide 25 text
Be Flexible
Shortcuts can cause ambiguity
Slide 26
Slide 26 text
Types of actions
Conversation and direct
Slide 27
Slide 27 text
Conversation Direct
Trigger
“Talk to SERVICE about
TOPIC”
Responsibilities
Availability
Slide 28
Slide 28 text
Conversation Direct
Trigger
“Talk to SERVICE about
TOPIC”
Responsibilities
You handle interaction
and fulfillment
Availability
Slide 29
Slide 29 text
Conversation Direct
Trigger
“Talk to SERVICE about
TOPIC”
Responsibilities
You handle interaction
and fulfillment
Availability Now
Slide 30
Slide 30 text
Conversation Direct
Trigger
“Talk to SERVICE about
TOPIC”
“Do this action”
Responsibilities
You handle interaction
and fulfillment
Availability Now
Slide 31
Slide 31 text
Conversation Direct
Trigger
“Talk to SERVICE about
TOPIC”
“Do this action”
Responsibilities
You handle interaction
and fulfillment
Google handles interaction,
you handle fulfillment.
Availability Now
Slide 32
Slide 32 text
Conversation Direct
Trigger
“Talk to SERVICE about
TOPIC”
“Do this action”
Responsibilities
You handle interaction
and fulfillment
Google handles interaction,
you handle fulfillment.
Availability Now Soon
Slide 33
Slide 33 text
Conversation Actions
" Less ambiguity
# Limited trigger
Slide 34
Slide 34 text
Making Conversation
Actions
Slide 35
Slide 35 text
Conversation Actions Format
$ Your Action
Input
Slide 36
Slide 36 text
Conversation Actions Format
$ Your Action
Input
JSON
Request
Slide 37
Slide 37 text
Conversation Actions Format
$ Your Action
Input
JSON
Request
JSON
Response
Slide 38
Slide 38 text
Conversation Actions Format
$ Your Action
Input
Action
Response
JSON
Request
JSON
Response
Slide 39
Slide 39 text
Conversation Actions Format
Your Action
JSON Request
JSON Response
Conversation
API
Slide 40
Slide 40 text
Invocation
Dialogs
Fulfillment
“Ask AwesomeFlightApp
to book me a flight.”
Slide 41
Slide 41 text
Invocation
Dialogs
Fulfillment
“Ok, where would you
like to go?”
“Paris.”
Slide 42
Slide 42 text
Invocation
Dialogs
Fulfillment
“Okay, booking a flight
to Paris!”
Slide 43
Slide 43 text
Invocation - name
Unique
Slide 44
Slide 44 text
Invocation - name
Unique | Easy to say
Slide 45
Slide 45 text
Name restrictions
Two words (with exceptions)
Slide 46
Slide 46 text
Name restrictions
Two words (with exceptions) | Avoid reserved words
Slide 47
Slide 47 text
Trigger Phrases
• Let me talk to…
• I want to talk to...
• Can I talk to...
• Talk to...
• Ask...
• At...
• Tell...
• Tell me...
Slide 48
Slide 48 text
Deep links
“Talk to service about topic”
Slide 49
Slide 49 text
Not deep links
“Talk to service.”
Slide 50
Slide 50 text
Conversations
You need to end them
Slide 51
Slide 51 text
API.AI
Actions SDK
Slide 52
Slide 52 text
API.AI
Actions SDK
GUI
Slide 53
Slide 53 text
API.AI
Actions SDK
GUI
Natural Language Understanding
Slide 54
Slide 54 text
API.AI
Actions SDK
GUI
Natural Language Understanding
Integrations
Slide 55
Slide 55 text
API.AI
Actions SDK
It’s all on you
GUI
Natural Language Understanding
Integrations
Slide 56
Slide 56 text
No content
Slide 57
Slide 57 text
$
API.AI Agent
Entities Actions
Slide 58
Slide 58 text
Intent
examples
• Set an alarm for 6:00am
• Wake me up at 6:00am
• I need an alarm at 6:00am
• Set an alarm for March 1st at 6:00pm
Slide 59
Slide 59 text
Intent
examples
• Set an alarm for 6:00am
• Wake me up at 6:00am
• I need an alarm at 6:00am
• Set an alarm for March 1st at 6:00pm
Slide 60
Slide 60 text
Intent
examples
• Set an alarm for 6:00am
• Wake me up at 6:00am
• I need an alarm at 6:00am
• Set an alarm for March 1st at 6:00pm
Slide 61
Slide 61 text
Intent
examples
• Set an alarm for 6:00am
• Wake me up at 6:00am
• I need an alarm at 6:00am
• Set an alarm for March 1st at 6:00pm
Slide 62
Slide 62 text
Welcome
Intent
Talk to Clocky
Slide 63
Slide 63 text
Fallback
Intent
Tell Clocky to order me a pizza
Slide 64
Slide 64 text
Fallback
Intent
Tell Clocky to order me a pizza
I don’t know how to help with that.
Slide 65
Slide 65 text
Action
Capture parameters
Slide 66
Slide 66 text
Action
Capture parameters | Prompt for parameters
Slide 67
Slide 67 text
System
Entitities
• Number
• Name
• Location
• Date/time
• Airport
• And so much more!
Slide 68
Slide 68 text
Custom
Entities
• Food menu
• Team names
• Fantasy names
Slide 69
Slide 69 text
Response
These are logic-less
Slide 70
Slide 70 text
Demo time
Slide 71
Slide 71 text
Advanced Fulfillment
For everything else, there’s webhooks
Simple webhook server
let Assistant = require('actions-on-google').ApiAiAssistant;
let app = express();
app.post('/', function (req, res) {
const assistant = new Assistant({request: req, response: res}); }
}
Slide 79
Slide 79 text
Basic webhook
let actionMap = new Map();
actionMap.set(”set_alarm", setAlarm);
assistant.handleRequest(actionMap);
function setAlarm() {
assistant.tell("Hello from the webhook!");
}
Slide 80
Slide 80 text
Basic webhook
let actionMap = new Map();
actionMap.set(”set_alarm", setAlarm);
assistant.handleRequest(actionMap);
function setAlarm() {
assistant.tell("Hello from the webhook!");
}
Slide 81
Slide 81 text
Webhook with arguments
function withArguments() {
let time= assistant.getArgument(”time");
assistant.tell(”I will set an alarm for" + time);
}
Slide 82
Slide 82 text
SSML- Speech Synthesis Markup Language
function withSsml() {
assistant.tell("This response uses”
+ "SSML.”
+ "Isn't it awesome?");
}
Slide 83
Slide 83 text
User
Identity
• ID (resettable!)
• Display name
• Given name
• Family name
• Coarse device location (zip code and city)
• Precise device location (lat/lng, address)
Slide 84
Slide 84 text
User
Identity
• ID (resettable!)
• Display name
• Given name
• Family name
• Coarse device location (zip code and city)
• Precise device location (lat/lng, address)
Requires permission
Slide 85
Slide 85 text
Context
Context allows for natural conversations
Slide 86
Slide 86 text
What’s the weather
like in Minneapolis?
It is currently 10°
in Minneapolis.
!
Slide 87
Slide 87 text
What’s the weather
like in Minneapolis?
It is currently 10°
in Minneapolis.
!
Context
Location: Minneapolis
Temperature: 10°
Slide 88
Slide 88 text
What’s the weather
like in Minneapolis?
It is currently 10°
in Minneapolis.
!
Context
Location: Minneapolis
Temperature: 10°
Slide 89
Slide 89 text
Interaction 1 Interaction 2
Context
Output Input
Slide 90
Slide 90 text
Output Context
Contains all parameters from the action
Slide 91
Slide 91 text
Input Context
Intents only trigger if context exists
Slide 92
Slide 92 text
Input Context
Intents only trigger if context exists
Allows for branching flows
Slide 93
Slide 93 text
Context - Lifetime
Duration (in requests)
Slide 94
Slide 94 text
Context - Lifetime
Duration (in requests) | Ends with conversation
Slide 95
Slide 95 text
Demo time
Slide 96
Slide 96 text
Publishing
Slide 97
Slide 97 text
Actions
Directory
Slide 98
Slide 98 text
Create a Google Cloud Project
Register the Action
Deploy via API.AI
Wait for review
Slide 99
Slide 99 text
Create a Google Cloud Project
Register the Action
Deploy via API.AI
Wait for review
Slide 100
Slide 100 text
Create a Google Cloud Project
Register the Action
Deploy via API.AI
Wait for review
Slide 101
Slide 101 text
Create a Google Cloud Project
Register the Action
Deploy via API.AI
Wait for review