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

Custom payload unreadable structure #60

Closed
Daners opened this issue Feb 8, 2021 · 2 comments
Closed

Custom payload unreadable structure #60

Daners opened this issue Feb 8, 2021 · 2 comments
Assignees
Labels
api: dialogflow Issues related to the googleapis/nodejs-dialogflow-cx API. type: question Request for information or clarification. Not an issue.

Comments

@Daners
Copy link

Daners commented Feb 8, 2021

Hello, I am creating a small project, where I have found the following situation.
I'm using:

  • Nodejs: 12.20.0
  • google-cloud / dialogflow-cx: 2.2.0

I have a custom payload configured within a page in the response, which has the following structure:

image

When making a request to the Dialogflow CX API v3beta1, I get a correct and readable structure, however when I do it through the SDK I get an unreadable response with a lot of garbage information:

image

This is a small fragment of the code where I get the response from the SDK.

const {SessionsClient} = require('@google-cloud/dialogflow-cx');
const client = new SessionsClient({ 
  apiEndpoint: "us-central1-dialogflow.googleapis.com",
   keyFilename:"./auth.json" });
...
 const sessionid = req.params["sessionid"]
const sessionPath = client.projectLocationAgentSessionPath(
    "PROJECT_ID",
    "us-central1",
    "AGENT_ID",
    sessionid
      );
    const body =  req.body;
    body.session = sessionPath
    client.detectIntent(body).then((data)=>{
      const [response] = data;
      console.log(JSON.stringify(data));
      res.json(response.queryResult)
    })

Could you help me to know if I am omitting any configuration?

@product-auto-label product-auto-label bot added the api: dialogflow Issues related to the googleapis/nodejs-dialogflow-cx API. label Feb 8, 2021
@yoshi-automation yoshi-automation added the triage me I really want to be triaged. label Feb 9, 2021
@b-loved-dreamer
Copy link
Contributor

b-loved-dreamer commented Feb 12, 2021

Hi @Daners, Nodejs returns a protobuf.Value, which is a Struct datatype. The behavior you're seeing is working as intended. Please take a look at this. Additionally, you might want to read the docs and this.

@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Feb 13, 2021
@munkhuushmgl munkhuushmgl added type: question Request for information or clarification. Not an issue. and removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Feb 15, 2021
@b-loved-dreamer
Copy link
Contributor

Thank you for filing this issue. We provided some clarifying details a week or more ago and never heard back from you. Please feel free to re-open this issue if you'd like.

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-cx API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants