Pratyush Mayank
Pratyush Mayank

Reputation: 173

Dailogflow Inline Editor Response

I am trying to display response from inline editor in google's dialog flow but I am not getting the response.However , all the mandatory entities are already fetched from used.The response which I receive from the bot is "Not available".Below is the code which I am written in index.js file in the fulfillment section and enabled the fulfillment as well for the Intent which I am using.

'use strict';

const functions = require('firebase-functions');
exports.dialogflowFirebaseFulfillment =
    functions.https.onRequest((request,response)=> {
        var chat ="Here is a sample response ,this should actually give you real stock information";
        response.setHeader('Content-type','application/json');
        response.send(JSON.stringify({"speech":chat,"displayText":chat}))
    });

Please help me for the same.Thanks in advance.

Upvotes: 0

Views: 531

Answers (1)

mattcarrollcode
mattcarrollcode

Reputation: 3479

The JSON you are sending in response is for a v1 agent. The speech and displayText attributes have been replaced by fulfillmentText in v2. Replace:

response.send(JSON.stringify({"speech":chat,"displayText":chat}))

with this

response.send(JSON.stringify({fulfillmentText:chat}))

Upvotes: 1

Related Questions