How do you address given name parameter in fulfillment code?












-1















I have created an intent in Dialogflow web interface. It auto detected a parameter called given-name, which lists it as $given-name in the web interface. I am trying to address $given-name in the fulfillment inline editor provided by the web interface, but I am not having any success.



I've tried changing the parameter name to camel case, and also alternatively to using an underscore to replace the hyphen but neither seemed to work.



Here is the code snippet from the dialogflow fulfillment inline editor:



'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

// Can't address given-name, intentionally used an underscore
app.intent('run demo', (conv, {given_name}) => {
conv.close('Hi ' + given_name +'! This is the demo you asked me to run!');
});

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);


I want to know the correct way to address the given name parameter in the code section app.intent('run demo', (conv ...);










share|improve this question

























  • Think I found the online documentation: actions-on-google.github.io/actions-on-google-nodejs/classes/… . If someone could confirm that this the correct page that would be greatly appreciated.

    – Lsakurifaisu
    Jan 2 at 13:34
















-1















I have created an intent in Dialogflow web interface. It auto detected a parameter called given-name, which lists it as $given-name in the web interface. I am trying to address $given-name in the fulfillment inline editor provided by the web interface, but I am not having any success.



I've tried changing the parameter name to camel case, and also alternatively to using an underscore to replace the hyphen but neither seemed to work.



Here is the code snippet from the dialogflow fulfillment inline editor:



'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

// Can't address given-name, intentionally used an underscore
app.intent('run demo', (conv, {given_name}) => {
conv.close('Hi ' + given_name +'! This is the demo you asked me to run!');
});

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);


I want to know the correct way to address the given name parameter in the code section app.intent('run demo', (conv ...);










share|improve this question

























  • Think I found the online documentation: actions-on-google.github.io/actions-on-google-nodejs/classes/… . If someone could confirm that this the correct page that would be greatly appreciated.

    – Lsakurifaisu
    Jan 2 at 13:34














-1












-1








-1








I have created an intent in Dialogflow web interface. It auto detected a parameter called given-name, which lists it as $given-name in the web interface. I am trying to address $given-name in the fulfillment inline editor provided by the web interface, but I am not having any success.



I've tried changing the parameter name to camel case, and also alternatively to using an underscore to replace the hyphen but neither seemed to work.



Here is the code snippet from the dialogflow fulfillment inline editor:



'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

// Can't address given-name, intentionally used an underscore
app.intent('run demo', (conv, {given_name}) => {
conv.close('Hi ' + given_name +'! This is the demo you asked me to run!');
});

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);


I want to know the correct way to address the given name parameter in the code section app.intent('run demo', (conv ...);










share|improve this question
















I have created an intent in Dialogflow web interface. It auto detected a parameter called given-name, which lists it as $given-name in the web interface. I am trying to address $given-name in the fulfillment inline editor provided by the web interface, but I am not having any success.



I've tried changing the parameter name to camel case, and also alternatively to using an underscore to replace the hyphen but neither seemed to work.



Here is the code snippet from the dialogflow fulfillment inline editor:



'use strict';

// Import the Dialogflow module from the Actions on Google client library.
const {dialogflow} = require('actions-on-google');

// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');

// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});

// Can't address given-name, intentionally used an underscore
app.intent('run demo', (conv, {given_name}) => {
conv.close('Hi ' + given_name +'! This is the demo you asked me to run!');
});

// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);


I want to know the correct way to address the given name parameter in the code section app.intent('run demo', (conv ...);







node.js dialogflow actions-on-google dialogflow-fulfillment






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 6 at 9:30







Lsakurifaisu

















asked Jan 1 at 18:00









LsakurifaisuLsakurifaisu

74110




74110













  • Think I found the online documentation: actions-on-google.github.io/actions-on-google-nodejs/classes/… . If someone could confirm that this the correct page that would be greatly appreciated.

    – Lsakurifaisu
    Jan 2 at 13:34



















  • Think I found the online documentation: actions-on-google.github.io/actions-on-google-nodejs/classes/… . If someone could confirm that this the correct page that would be greatly appreciated.

    – Lsakurifaisu
    Jan 2 at 13:34

















Think I found the online documentation: actions-on-google.github.io/actions-on-google-nodejs/classes/… . If someone could confirm that this the correct page that would be greatly appreciated.

– Lsakurifaisu
Jan 2 at 13:34





Think I found the online documentation: actions-on-google.github.io/actions-on-google-nodejs/classes/… . If someone could confirm that this the correct page that would be greatly appreciated.

– Lsakurifaisu
Jan 2 at 13:34












1 Answer
1






active

oldest

votes


















1














Solution



One solution I found is this piece of code:



app.intent('run demo', (conv, params) => {
conv.close('Hi ' + params['given-name'] +'! This is the demo you asked me to run!');
});


Explanation



The (conv, params) => {...} of app.intent('run demo',... is actually a callback function which is anonymous (aka anonymous callback function). The conv and params are arguments/parameters passed into the callback function. The definition of the function appears to be on this page of the API: Callable. It stats the the parameters/arguments that can be passed in could be conv, params, argument, status.



Final thoughts



The API documentation for actions on google helped: actions on google api reference link






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53997699%2fhow-do-you-address-given-name-parameter-in-fulfillment-code%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Solution



    One solution I found is this piece of code:



    app.intent('run demo', (conv, params) => {
    conv.close('Hi ' + params['given-name'] +'! This is the demo you asked me to run!');
    });


    Explanation



    The (conv, params) => {...} of app.intent('run demo',... is actually a callback function which is anonymous (aka anonymous callback function). The conv and params are arguments/parameters passed into the callback function. The definition of the function appears to be on this page of the API: Callable. It stats the the parameters/arguments that can be passed in could be conv, params, argument, status.



    Final thoughts



    The API documentation for actions on google helped: actions on google api reference link






    share|improve this answer






























      1














      Solution



      One solution I found is this piece of code:



      app.intent('run demo', (conv, params) => {
      conv.close('Hi ' + params['given-name'] +'! This is the demo you asked me to run!');
      });


      Explanation



      The (conv, params) => {...} of app.intent('run demo',... is actually a callback function which is anonymous (aka anonymous callback function). The conv and params are arguments/parameters passed into the callback function. The definition of the function appears to be on this page of the API: Callable. It stats the the parameters/arguments that can be passed in could be conv, params, argument, status.



      Final thoughts



      The API documentation for actions on google helped: actions on google api reference link






      share|improve this answer




























        1












        1








        1







        Solution



        One solution I found is this piece of code:



        app.intent('run demo', (conv, params) => {
        conv.close('Hi ' + params['given-name'] +'! This is the demo you asked me to run!');
        });


        Explanation



        The (conv, params) => {...} of app.intent('run demo',... is actually a callback function which is anonymous (aka anonymous callback function). The conv and params are arguments/parameters passed into the callback function. The definition of the function appears to be on this page of the API: Callable. It stats the the parameters/arguments that can be passed in could be conv, params, argument, status.



        Final thoughts



        The API documentation for actions on google helped: actions on google api reference link






        share|improve this answer















        Solution



        One solution I found is this piece of code:



        app.intent('run demo', (conv, params) => {
        conv.close('Hi ' + params['given-name'] +'! This is the demo you asked me to run!');
        });


        Explanation



        The (conv, params) => {...} of app.intent('run demo',... is actually a callback function which is anonymous (aka anonymous callback function). The conv and params are arguments/parameters passed into the callback function. The definition of the function appears to be on this page of the API: Callable. It stats the the parameters/arguments that can be passed in could be conv, params, argument, status.



        Final thoughts



        The API documentation for actions on google helped: actions on google api reference link







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 6 at 9:29

























        answered Jan 1 at 19:49









        LsakurifaisuLsakurifaisu

        74110




        74110
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53997699%2fhow-do-you-address-given-name-parameter-in-fulfillment-code%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

            Npm cannot find a required file even through it is in the searched directory