Intro to article
Dialogflow provides a new and innovative way for users to interact with mobile apps by integrating voice-based conversational interfaces powered by AI. The conversational platform allows developers to connect with users via the Google Assistant, Amazon Alexa, and other platforms. For the purpose of this post, we will be focusing on using Dialogflow to create your own conversation. A Dialogflow conversation includes how users will invoke the app, the valid things they can say to the assistant, and how the assistant will respond to them.
In this tutorial, you will learn how to create a simple Google Assistant application with one intent with a static response, and learn to test your application on the emulator or your personal device.
By the end of our blog series, we will have finished creating a Google Assistant app that lets you schedule appointments to Clearbridge Mobile’s Sales Team calendar. Getting Started: Setting Up Your Dialogflow
Creating Your Agent For Your Project
- Sign in to Dialogflow. If you don’t have an account, sign up using your Google account. Note that your Google account will be used to test your app on any of your devices logged in to your account with Google Assistant.
- Create an agent by clicking “Create Agent” on the top left corner. In our case, we will name our agent “ClearbridgeAppointments”. Since we will be creating this project from scratch, we will use the default values set by Google/Dialogflow. This is where we program and train our app. Implementing An Intent For Your Conversation
- Next, we will create an intent. An intent maps the user’s command with actions for your app. This is an important part of Dialogflow as this is how users will interact with your app. To create an intent, navigate to “Intents” from the left side menu, then click on “Create Intent”. For the purposes of our appointment application, we will be creating a help intent that helps navigate users through our app. For our help intent, if the user tells the app “I need assistance”, the app will respond by telling the user “You can ask me to book an appointment for you”.
- Start by giving your intent a name. We will call ours “help”.
- Then provide sample phrases for your app. These phrases will serve as cues for your application to pick up. Keep in mind, the more phrases your provide, the better your app will be at comprehending your commands (we will demonstrate the power of Dialogflow’s ability to understand phrases below.)
- Then, in the “Response” field, write the message that you would like your intent to return to the user.
- You can see how I created my intent in the screenshot. I have provided 6 phrases that I would like my app to listen for and named my action as “tell.help”. You can also see the default response that I would like my app to return. After filling out all the information, click “Save”. It is not necessary to give your intent an action name when returning static responses. The action name is used to connect our intents with our code later, so it is good practice to name them.
- Since our app is composed of intents and entities, it’s important to understand the differences between them. As IBM explains, “intents represent verbs (something a user wants to do) and entities represent nouns (such as the object of, or the context for, an action.)”
- Now that we’ve created our first intent, let’s test our application.
- There are two ways of testing your application with Dialogflow. The simplest and quickest way of checking that your command is working is by using the built-in test console on the right side of the page. Here, you can type your command, and Dialogflow will return you its response.
- Notice that I told Dialogflow “I need help”, and it triggered our help intent as expected. But something really cool happened here! Notice that the phrase “I need help” was not provided to Dialogflow when I was setting up the intent.
- This is the beauty of Dialogflow – it is a machine learning program. Dialogflow will recognize similar phrases and trigger the intents even though you haven’t specified it in the examples. Although the test console is quick and easy to use, the downside of it is that it cannot display images, and other rich displays, which is something that will be covered in the second blog. To remedy this, Dialogflow has another way of testing using the emulator or your device.
- To use the emulator, simply navigate to “Integrations” section of the app. Then click “Google Assistant” then “Test”. This will bring up another webpage with an emulator. Start the conversation by entering “Talk to my test app”. This will start our application, and our application will be listening for our command. We can enter “I need help” to our emulator, and it will trigger our “help” intent. Alternatively, we can test our app using our personal devices. Open your Google Assistant on your phone and log in using the account that you used to create this app. Then, say “Talk to my test app”. This will open the test version of our app. We can now trigger our intents by asking the app for help.
Alternatively, after accepting the project invitation on your test account, you can log into your Google Assistant on your mobile device that supports Google Assistant, and invoke your test app by saying “Okay Google, talk to my test app”.
Make sure to tweak your responses to your liking and test your final product. Testing your app is a vital factor of the development process that ensures proper functionality and an overall high-quality product. It’s important to also invite other people to your project so they can test your app before you publish it.
That’s everything for this tutorial! If you’ve made it this far, I want to congratulate you on making your first app with Dialogflow! Intents and Entities are the fundamental building blocks to creating conversational experiences. In our next blog, How to Develop a Google Assistant App: Creating a Fulfillment in Dialogflow we focus on the visual aspect of our application by learning about Fulfillment.
This year we’ll undoubtedly see explosive growth in voice-enabled devices now that Google, Amazon, and other massive brands have made voice development a lot more accessible to developers. There will be a rise of companies leveraging voice-activated apps to provide consumers with the ability to connect directly and more conveniently with the content they want. If you have any questions about Google Actions or voice-enabled apps, feel free to contact us for more information.
Enhancing Your Conversation With Entities
Testing Your App
1. There may be an issue with the simulator where the simulator does not work and returns the message
2. “My test app isn’t responding right now. Try again soon.”
3. There have been various answers online to fix this bug.
4. However, the best way that I found getting around this bug is by using a separate testing account to test your application.
Setting Up Your Testing Account
1. To set up a separate testing account, click on the Settings Icon on Actions on Google, and navigate to “Permissions”.
2. Then click on “Add”, and enter the email address of your testing account.
3. Then select the role as “Project Owner”. This is giving full project access to the email that you provided in step 2.
4. Click Add, and log into your testing account’s email. There should be an invitation email to join the project.
5. Click on “Accept Invite”. This should lead you to Actions on Google page, where you can navigate to the simulator to test your device.
Top 8 New Technology Trends for 2020
Technology is now evolving at such a rapid pace that annual predictions of trends can seem out-of-date before they even go live as a published blog post or article. As...Read all
10 Best Web Hosting Companies (2020)
Below is a list of 10 best website hosting providers that we’ve found reliable and with good speed. They have all performed well in the last 24-months.... Read all
Top 10 Programming Languages to learn in 2020