Git Product home page Git Product logo

Comments (4)

Fleker avatar Fleker commented on July 17, 2024

Are you referring to the Dialogflow function? Did you run into a syntax error when trying to run it?

from dialogflow-conversation-components-nodejs.

Canain avatar Canain commented on July 17, 2024

The code uses the wrapper for BasicCard

The buttons property accepts both an array and a single Button for ease of use (because right now only one button is allowed).

from dialogflow-conversation-components-nodejs.

strttn avatar strttn commented on July 17, 2024

Yes, I'm referring to the Dialogflow function.

I am setting the buttons property after having already instantiated the BasicCard rather than using it within the "new" function.

E.g.

let basicCard = new BasicCard({
    text: cardText
});

basicCard.buttons = [new Button({
    title: linkText,
    url: linkUrl
})];

Without the square brackets I was getting a malformed response error on sending back the response.

from dialogflow-conversation-components-nodejs.

Canain avatar Canain commented on July 17, 2024

Yeah, the wrappers are intended to be created just from the constructor.

If you assign to it manually, you will bypass the abstractions and just directly manipulate the raw GoogleActionsV2UiElementsBasicCard API which can only have buttons as an array.

You'll have to assign it with an array like you mentioned.

But this isn't really an issue with the sample as the samples don't manipulate the raw API directly and just use the wrappers with the constructor so it's valid.

  conv.ask(new BasicCard({
    text: `This is a basic card.  Text in a basic card can include "quotes" and
    most other unicode characters including emoji 📱.  Basic cards also support
    some markdown formatting like *emphasis* or _italics_, **strong** or
    __bold__, and ***bold itallic*** or ___strong emphasis___ as well as other
    things like line  \nbreaks`, // Note the two spaces before '\n' required for
                                 // a line break to be rendered in the card.
    subtitle: 'This is a subtitle',
    title: 'Title: this is a title',
    buttons: new Button({
      title: 'This is a button',
      url: 'https://assistant.google.com/',
    }),
    image: new Image({
      url: IMG_URL_AOG,
      alt: 'Image alternate text',
    }),
  }));

from dialogflow-conversation-components-nodejs.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.