How do you address given name parameter in fulfillment code?
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
add a comment |
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
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
add a comment |
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
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
node.js dialogflow actions-on-google dialogflow-fulfillment
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
add a comment |
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
add a comment |
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
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
edited Jan 6 at 9:29
answered Jan 1 at 19:49
LsakurifaisuLsakurifaisu
74110
74110
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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