dialog flow v2 code not running

dialogflow memory
dialogflow api
dialogflow context parameters
dialogflow reset context
input and output context in dialogflow
set output context in dialogflow
google actions context
context google

I was testing the new code according to v2. Link: Build Your First App with Dialogflow code:

'use strict';

const {dialogflow} = require('actions-on-google');
const functions = require('firebase-functions');

const app = dialogflow({debug: true});

app.intent('Default Welcome Intent', conv => {
  console.log("-----welcome intent-----");
  conv.ask('Welcome');
});

exports.testMain = functions.https.onRequest(app);

But when I simulate it, it shows :

MalformedResponse
'final_response' must be set.

What can I do? The request is not reaching the function though Fulfillment is enabled.

---------UPDATED------------

now I am getting this error when I try to deploy the function to firebase:

Function load error: Code in file index.js can't be loaded
Is there a syntax error in your code?
Detailed stack trace: TypeError: dialogflow is not a funct
    at Object.<anonymous> (/user_code/index.js:6:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at getUserFunction (/var/tmp/worker/worker.js:388:24)
    at loadUserCode (/var/tmp/worker/worker.js:444:18)

I am unable to understand???

Here is my package.json:

{
  "name": "some name",
  "description": "some desc",
  "version": "0.0.1",
  "author": "Google Inc.",
  "engines": {
    "node": "~4.2"
  },
  "dependencies": {
    "actions-on-google": "^1.0.0",
    "firebase-admin": "^5.11.0",
    "firebase-functions": "^1.0.0",
    "dialogflow": "^0.3.0",
    "request": "^2.85.0",
    "uuid": "^3.0.1"
  }
}

------update 2------ I have changed node to :

"engines": {
        "node": "~6.0"

still same problem

-----Update 3--------

Deployment complete, but when the request goes to it, it shows:

Check what version of node you're using. The package.json suggests that you're using node 4, when you need to be using at least node 6 if you're using =>.

Since Firebase Cloud Functions is node 6 as well, you should likely switch to it for your local development as well. (Node itself is at version 8 for LTS, and working on version 9, so you should certainly consider updating.)

webhooks - dialog flow v2 code not running, Check what version of node you're using. The package.json suggests that you're using node 4, when you need to be using at least node 6 if  Creating a new agent that uses V2. In the agent list, click on Create new agent. Enter the desired information for the agent. Toggle the switch under the API VERSION section. Blue means the setting is enabled. Click the Save button. Enabling V2 in an existing non-production agent Note: This method should not be used on agents in production. Please see the next section for instructions.

Confirm which version of the actions-on-google library you're using. Your dependencies of "actions-on-google": "^1.0.0" specifies version 1.x of the library, but the rest of your usage is via the 2.0.0 syntax. The error suggests that there is no dialogflow object, which is also provided in version 2 of the library, but not version 1.

To use version 2.0.0 and up, you need to change the line in your package.json to

"actions-on-google": "^2.0.0"

and then run

npm update

dialog flow v2 code not running - webhooks - html, I was testing the new code according to v2. Link: Build Your First App with Dialogflow code: 'use strict'; const {dialogflow} = require('actions-on-google'); const  In order to use the V2 API, you will need to create a new Service Account and obtain a private key associated with the Service Account. The key is downloaded as a JSON file upon creation of the Service Account. Caution: Your project will have an existing service account, but this should not be altered. For additional client and developer API

Make sure that fulfillment is enable in the Dialogflow dashboard and that v2 of the API is turned on? Also check that the intent name you are using in your fulfillment matches the one in Dialogflow.

Your code looks good to me. Its probably a configuration issue.

Context Setting in DialogFlow version 2 not working · Issue #92 , GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together. Sign up. I am new to Google APIs. I want to know how to call Google Dialogflow API in C# to get intent form the input text. But I can't find any example to call Dialogflow using C#. Please provide some exa

Trying changing conv.ask('Welcome') to conv.close('Welcome');

also remove console.log("-----welcome intent-----"); line just for testing

Dialogflow REST API v2 is not compatible with your old webhook code, Did you try to use the Dialogflow REST API v2 and found out that your webhook which used to work before stopped working? Here is what the  Warning: The Dialogflow V1 API shutdown has been postponed to May 31st, 2020. Read more details here.. Throughout the migration process of going from V1 to V2, if you use Dialogflow fulfillment, you'll need to make sure you respond correctly to Dialogflow's V2 webhook requests.

changed the package.json:

"engines": {
    "node": "~6.11.1"
  },
  "dependencies": {
    "actions-on-google": "^2.0.0",
    "firebase-admin": "^5.11.0",
    "firebase-functions": "^1.0.0",
    "dialogflow": "^0.3.0",
    "request": "^2.85.0",
    "uuid": "^3.0.1"
  }

And this works

Setting up authentication, V2 of the API relies on a Google Cloud Platform Service Account for will have an existing service account, but this should not be altered. If you are currently using the Dialogflow V1 API, the following tables compare the V1 and V2 properties. Note: Some properties and types from the Dialogflow V1 API are no longer supported in the Dialogflow V2 API and are marked as "not applicable". Query

Migrate from API V1 to API V2, Warning: Do not switch your agent from V1 to V2 until you are certain your from API V1 to V2 now, but be aware that fulfillment and API calls may stop working. code to make your fulfillment and API calls compatible with both V1 and V2 (or  Java client for Dialogflow: Design and integrate a conversational user interface into your applications and devices. - dialogflow/dialogflow-java-client-v2

Package google.cloud.dialogflow.v2, Uploads new intents and entity types without deleting the existing ones. Fulfillment is code that's deployed as a webhook that lets your Dialogflow agent call business The collection of contexts to be activated before this query is executed. If utilizing fulfillment for your agent, you must update your fulfillment code to support the API V2 request and response formats before switching to API V2. All Dialogflow APIs have been redesigned and use OAuth for authentication. If you use this API directly, you need to update your client code before switching to API V2.

Quickstart: Interactions with the API, If you are not using an integration, you must write code to interact with end-users. For each POST https://dialogflow.googleapis.com/v2/projects/ project-id  V1 to V2 mapping Authentication setup Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License , and code samples are licensed under the Apache 2.0 License .

Comments
  • I am using node v9.11.1
  • All is set, but not working, and now I am getting the new error