Using the V2 API — Dialogflow

Pranav Bhatia
3 min readOct 29, 2019

I am sure everyone would be familiar with Google-owned development suite for creating conversational interfaces — called Dialogflow. Recently, if your apps were using webhooks you would have gotten a notification for moving your skill to V2. In this article, I will be focussing on doing that migration.

Running your app locally —

  1. Clone/Download zip of repository. Github link — https://github.com/prav10194/dialogflow-v2
  2. Extract content of the zip.
  3. Open cmd to run the following code -
cd "folderpath where zip is extracted"
npm install

4. After the installation, run -

npm start

Setting up the ngrok link for your app —

  1. For this we will install ngrok. Download from here — https://ngrok.com/download
  2. Open another terminal and run the following command -
ngrok http 8080

8080 is the port number on which our app will run.

3. After that you will get a black terminal screen. Look for url after forwarding. It will appear similar to —

https://xxxxxxx.ngrok.io

Setting up the google actions —

1. Visit the following link — https://console.dialogflow.com/api-client/#/login.

2. Click Sign in with Google. After that click on Go to console.

3. In console, click on Create New Agent as shown and name it “space-men”.

4. Click on setting icon and verify whether it is using the V2 API.

5. After that, click on Intents on the left and you will see this screen. Click on options dotted icon and click on upload Intent.

6. Upload the json that you will find in the github project.

7. You can see those in the Intents.

8. In the fulfillment screen, add the ngrok link. Add /spacemen after the ngrok link.

9. Go to integrations and click on Integration Settings for Google Assistant.

10. Click on Add Intent — and add GetNumber, GetNames, LastResult.

11. Click on Overview tab and select “decide how your Action is invoked”

12. Give it a name “space men”.

13. Go to test tab and run the following commands —

That was the end of article. If you have any doubts regarding the code, you can mention in the comments below.

--

--