To develop with Dialogflow, you first need to create an Actions project and a Dialogflow agent. Having a project allows you to access the developer console to manage and distribute your Action. The Dialogflow agent contains all the intents that define your Action.
Create an Actions project and Dialogflow agent
- Go to the Actions console.
- Click New project.
- Enter a name for your project and click CREATE PROJECT.
- Scroll down to the More options section and click on the Conversational card.
- Click Develop in the top menu, then click Actions in the left menu.
- Click ADD YOUR FIRST ACTION.
- On the Custom intent card, click BUILD.
- The Dialogflow console appears with the information automatically populated in an agent. Click CREATE to save the agent.
The Dialogflow console
You should now see the Dialogflow console and the menu panel on the left. If you're on a small screen and the menu is hidden, click menu in the upper left corner.
The center window shows the list of intents for the agent. By default, Dialogflow agents start with two intents. The Default Welcome Intent greets your users. Your agent matches the Default Fallback Intent when it doesn't understand what the users say.
The Dialogflow simulator is on the right side of the page. The simulator lets you try out your agent by speaking or typing messages. In the Dialogflow simulator, click Try it now, type anything, and press enter.
Figure 1. A screenshot of the Dialogflow console showing an agent.
Create your first intent
Dialogflow uses intents to categorize a user's intentions. Intents have Training Phrases, which are examples of what a user might say to your agent. For instance, a user who wants to know your agent's name might ask, "What is your name?", "Do you have a name?", or simply say "name". These phrases have the same end goal: to get the name of your agent.
To create an agent that handles this case, follow these steps:
- Click add next to Intents in the navigation menu.
Namein the Intent name text field.
- In the Training Phrases section, click Add Training Phrases.
- Enter the following phrases (press enter after each phrase):
What is your name?
Do you have a name?
- In the Responses section, click Add Response.
- Enter the following response in the Text Response window:
My name is Dialogflow!
- Click Save.
Try it out
To test your new Name intent, in the Dialogflow simulator, type "What's your name?" and press enter.
Your agent can respond to your question correctly even when you ask questions that aren't exactly the same as the training phrases (for example, "What's your name?" versus "What is your name?").
Dialogflow uses training phrases to train a machine learning model, which helps the agent match user utterances to the correct intents.