Actions SDK overview (Dialogflow)

Actions on Google lets you extend the functionality of Google Assistant with Actions . Actions let users get things done through a conversational interface that can range from a quick command to turn on some lights or a longer conversation, such as playing a trivia game.

The Actions SDK is a method of developing conversation fulfillment without using Dialogflow. When using the Actions SDK, you use an Action package to map intents to their fulfillment. You must also provide query patterns in the Action package in order to define example phrases your users might say.

gactions CLI

When developing with the Actions SDK, you use the gactions command line interface (CLI) to test and update your Actions project. The gactions CLI also helps you create and manage the Action package for your Conversational Action.

Create Actions in your Action package

You create Actions in your Action package by mapping intents to fulfillment. An Action defines an entry point to start conversations with a unique identifier called an intent . Intents map to fulfillments, which process the intent.

For example, say you wanted to build a project that contained Actions to purchase some goods, check the status of orders, and to show some daily deals. You can define intents that are triggered by saying:

  • "Hey Google, talk to ExampleAction."
  • "Hey Google, talk to ExampleAction to buy some shoes."
  • "Hey Google, talk to ExampleAction to check on my order."
  • "Hey Google, talk to ExampleAction to show me today's deals."

The Action package JSON file might look something like this:

  { 
  
" actions 
" : 
  
 [ 
  
 { 
  
" name 
" : 
  
" MAIN 
" , 
  
" intent 
" : 
  
 { 
  
" name 
" : 
  
" actions 
 . 
 intent 
 . 
 MAIN 
"  
 }, 
  
" fulfillment 
" : 
  
 { 
  
" conversationName 
" : 
  
" ExampleAction 
"  
 } 
  
 }, 
  
 { 
  
" name 
" : 
  
" BUY 
" , 
  
" intent 
" : 
  
 { 
  
" name 
" : 
  
" com 
 . 
 example 
 . 
 ExampleAction 
 . 
 BUY 
" , 
  
" parameters 
" : 
  
 [{ 
  
" name 
" : 
  
" color 
" , 
  
" type 
" : 
  
" org 
 . 
 schema 
 . 
 type 
 . 
 Color 
"  
 }], 
  
" trigger 
" : 
  
 { 
  
" queryPatterns 
" : 
  
 [ 
  
" find 
  
 some 
  
 $ 
 org 
 . 
 schema 
 . 
 type 
 . 
 Color 
 : 
 color 
  
 sneakers 
" , 
  
" buy 
  
 some 
  
 blue 
  
 suede 
  
 shoes 
" , 
  
" get 
  
 running 
  
 shoes 
"  
 ] 
  
 } 
  
 }, 
  
" fulfillment 
" : 
  
 { 
  
" conversationName 
" : 
  
" ExampleAction 
"  
 } 
  
 }, 
  
 { 
  
" name 
" : 
  
" ORDER_STATUS 
" , 
  
" intent 
" : 
  
 { 
  
" name 
" : 
  
" com 
 . 
 example 
 . 
 ExampleAction 
 . 
 ORDER_STATUS 
" , 
  
" trigger 
" : 
  
 { 
  
" queryPatterns 
" : 
  
 [ 
  
" check 
  
 on 
  
 my 
  
 order 
" , 
  
" see 
  
 order 
  
 updates 
" , 
  
" check 
  
 where 
  
 my 
  
 order 
  
 is 
"  
 ] 
  
 } 
  
 }, 
  
" fulfillment 
" : 
  
 { 
  
" conversationName 
" : 
  
" ExampleAction 
"  
 } 
  
 }, 
  
 { 
  
" name 
" : 
  
" DAILY_DEALS 
" , 
  
" intent 
" : 
  
 { 
  
" name 
" : 
  
" com 
 . 
 example 
 . 
 ExampleAction 
 . 
 DAILY_DEALS 
" , 
  
" trigger 
" : 
  
 { 
  
" queryPatterns 
" : 
  
 [ 
  
" hear 
  
 about 
  
 daily 
  
 deals 
" , 
  
" buying 
  
 some 
  
 daily 
  
 deals 
" , 
  
" get 
  
 today's 
  
 deals 
"  
 ] 
  
 } 
  
 }, 
  
" fulfillment 
" : 
  
 { 
  
" conversationName 
" : 
  
" ExampleAction 
"  
 } 
  
 } 
  
 ], 
  
" conversations 
" : 
  
 { 
  
" ExampleAction 
" : 
  
 { 
  
" name 
" : 
  
" ExampleAction 
" , 
  
" url 
" : 
  
" https 
 : 
 //www.example.com/ExampleAction 
"  
 } 
  
 } 
 } 
 

Build and deploy a fulfillment webhook

When an Action in your project is invoked, Actions on Google calls your fulfillment to start a conversation with users to fulfill the Action.

In every request to your fulfillment webhook, you receive the user input as a text string. To process the intent, you typically parse the text input and return a response. This back and forth exchange happens until your Action's conversation ends.

Upload your Action package

Once you create your Action package and deploy its fulfillment , you can upload your Action package to the Actions console. The Actions console uses Action projects to group your Conversational Action with metadata like its review status and display name in the Assistant directory. The project also lets you define metadata about your Action and manage and track your Action through the approval process.

Once you have a project, you can upload your Action package that defines all your Actions using the gactions CLI .

Submit your project for approval and make it available to users

Samples

To explore completed projects, view the Node.js and Java Actions SDK samples .