Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Passing Parameters to Contexts #402

Closed
arielschvartz opened this issue Aug 10, 2019 · 5 comments
Closed

Passing Parameters to Contexts #402

arielschvartz opened this issue Aug 10, 2019 · 5 comments
Assignees
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. status: duplicate Duplicate. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@arielschvartz
Copy link

When passing parameters to a new contexts (via createContext or detectIntent), you cannot just passa an object.

For example:

contextsClient.createContext({
  parent: sessionPath,
  context: {
    name: "projects/my-project-id/agent/sessions/my-session-id/contexts/my-context-name",
    lifespanCount: 1,
    parameters: {
      foo: "bar"
    }
  }
})

In the above example, the foo parameter is not set in the context. For it to work you should pass like:

contextsClient.createContext({
  parent: sessionPath,
  context: {
    name: "projects/my-project-id/agent/sessions/my-session-id/contexts/my-context-name",
    lifespanCount: 1,
    parameters: {
      fields: {
        foo: {
          stringValue: "bar"
        }
      }
    }
  }
})

As solution, I think the better way would be for the lib to handle that and convert. The other way of resolving this problem would be simply updating the documentation.

By the way, I didn't find anywhere in the Dialogflow documentation the possible values for a field (like stringValue). Is there something like numberValue, datetimeValue?

Hope it help other people! =)

@arielschvartz
Copy link
Author

Just discovered that exactly the same applies to passing parameters to the payload of the detectIntent.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Aug 11, 2019
@bcoe bcoe added type: question Request for information or clarification. Not an issue. priority: p2 Moderately-important priority. Fix may not be included in next release. type: docs Improvement to the documentation for an API. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed 🚨 This issue needs some love. triage me I really want to be triaged. type: question Request for information or clarification. Not an issue. labels Aug 19, 2019
@callmehiphop callmehiphop added status: duplicate Duplicate. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. type: docs Improvement to the documentation for an API. labels Sep 4, 2019
@callmehiphop
Copy link
Contributor

👋 @arielschvartz this looks like a duplicate of #97, which is a fairly common complaint we get here. The client itself is actually generated, so I think getting a feature like this in will be tricky and probably take some time (although I do believe it is on our radar).

In the mean time we've been suggesting using pb-util to convert protobuf structures like this.

@arielschvartz
Copy link
Author

Thank you very much @callmehiphop ! Gonna use the lib for now!

But I suggest adding it to the docs in the dialogflow website! Would be simples and help a lot of people!

@callmehiphop
Copy link
Contributor

@arielschvartz thanks for the suggestion!

@bcoe any idea how we can do a better job of documenting this? Seems like a common point of frustration for users here, but I'm not really sure how to solve the issue since everything for Dialogflow is generated.

@vchopDev
Copy link

@arielschvartz Thanks a lot man!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow API. status: duplicate Duplicate. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

5 participants