admin管理员组文章数量:1290995
I want to get the original input of a parameter in my fulfillment code.
I tried:
var time = agent.parameters.time.original
but the result was undefined.
I have tried:
var query = agent.query
but could not accurately parse the parameter I need the original input of.
I want to get the original input of a parameter in my fulfillment code.
I tried:
var time = agent.parameters.time.original
but the result was undefined.
I have tried:
var query = agent.query
but could not accurately parse the parameter I need the original input of.
Share Improve this question asked Jul 30, 2018 at 15:39 Nathan LiuNathan Liu 2845 silver badges13 bronze badges 4- Are you using Actions on Google Node.js client library? – Aza T Commented Jul 30, 2018 at 20:53
- @AzaTulepbergenov Not using for this function, but it is a dependency. – Nathan Liu Commented Jul 31, 2018 at 8:46
-
1
Could you paste in the value of
agent.parameters
at the point that this code is running?console.log(agent.parameters)
– techpeace Commented Jul 31, 2018 at 20:18 -
1
@techpeace Sure, it is
{ time: '2018-08-01T15:00:00+01:00', openclose: 'open', date: '2018-08-01T09:52:34+01:00' }
– Nathan Liu Commented Aug 1, 2018 at 8:53
4 Answers
Reset to default 3According to an answer on the old API.ai discourse forums, it looks like original parameters may only be available in a webhook fulfillment request if you set a context on the intent. At that point, the original parameter should be available in the contexts
key in the request.
The actual name of the original value used for the parameter is "time.original". In order to get this, you need to use something like
var time = agent.parameters['time.original'];
What you were trying was to get an attribute of agent.parameters.time
named original
instead of an attribute of agent.parameters
named time.original
.
The solution i found as dated 3rd-Apr-2019 is following
Add custom parameter with actual entity name
heaving value $yourparametername.orignal
And get its value like that
Please try:
var time = agent.contexts[0].parameters['time.original']
本文标签: javascriptGet original parameter inputDialogflow FulfillmentStack Overflow
版权声明:本文标题:javascript - Get original parameter input - Dialogflow Fulfillment - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741521821a2383231.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论