Making a Google Action Apptags:
Note that this tutorial was made with Dialogflow v1 (now deprecated)
The Google Assistant is powering more devices than there are people in the US and Canada combined. Actions are at the heart and soul of this revolutionary AI service, letting ordinary developers extend it vast array of functionalities. With some free time on my hands, I decided to play around with Google Actions and the hot new chatbot framework Dialogflow. Like most of my projects, I wanted to make something that appealed to everybody. It was the beginning of … Inspiration Nation
Corny, I know. But it was a good way of testing the different features of Dialogflow. I looked around the dashboard but eventually had to watch a Google I/O video. The graphical interface wasn’t very helpful as it was hard to make the app have complex logic to make the dynamic features I wanted. This meant that I had to resort to… programming (dun dun dun).
The app would work as such:
- The user says “inspire me” and the action would play an inspirational clip
- The user says “repeat” and it will repeat the last clip played
- The user says “help” and all the available commands would be said.
Before I could start anything, I needed some data. I checked their Knowledge tab (which was in beta at the time of writing) but it felt like more work when compared to making a simple object. It didn’t seem like Dialogflow could hold very big data structures so I had to go over to the fulfillment tab to work some object-magic. I created a JSON object to store my clip properties like ‘url’ and ‘author’
Next I had to create the intents which map out user inputs to specified outputs. The main ones were ‘Ask’, ‘Help’, ‘Repeat’, and ‘Specific’ (the cool features were added later). The intents with dashes were follow-up intents which are intents that build off the info of the original intent (like an inherited class or Props from ReactJS). In this case, they were asking if the user wanted to listen to the same clip again.
Next, I had to update the intents on the GUI interface to make sure they used the fulfillment code instead of the default Dialogflow handlers.
I also needed to remind the user of how to use the app but that seemed like a menial task…something perfect for the Dialogflow GUI!
Since I was using dynamic data within the same slot (a spot in the sentence where different instances of the same type of data could occur). In my case, it was the tag name. Therefore I needed to make use of entities.
And there’s the barebones structure of the app! Now to test it out on the Dialogflow simulator…
Seems like it’s working. But to make sure it’s working on our end client, I head over to the Actions simulator.
Hurrah! Everything works! And another inspirational app done! I hope this inspires you to test out Dialogflow and voice apps for yourself