Generic Template is a small card with few lines of text, an optional image and buttons.



Two or more generic templates can be combined together in a carousel by simply chaining Generic Template node (to maximum of 10). Each template can have a maximum of 3 buttons, title and subtitle are limited to 80 chars.

Each template can have up to 3 buttons, see Buttons node for a complete list of available buttons (only quick-reply and location are not available here).

Each Generic Template node has also a default action which acts like a url button. The first button of type url in the buttons section will be used as default action of the item.

In order to create a generic template in a upstream Function node


msg.payload = {

  title: 'my title',

  subtitle: 'I am a sub title',

  imageUrl: 'http://image.server.com/cover.png',

  buttons: [

    {

      type: 'url',

      url: 'http://javascript-jedi.com',

      label: 'Javascript Jedi'

    }

  ],

  sharable: true,

  aspectRatio: 'horizontal'

}


or in order to pass a collection of elements for the carousel


msg.payload = {

  sharable: true,

  aspectRatio: 'horizontal',

  elements: [

    {

      title: 'my title',

      subtitle: 'I am a sub title',

      imageUrl: 'http://image.server.com/cover.png',

      buttons: [

        {

          type: 'url',

          url: 'http://javascript-jedi.com',

          label: 'Javascript Jedi'

        }

      ]

    },

    {

      title: 'another title',

      subtitle: 'Second sub title',

      imageUrl: 'http://image.server.com/cover2.png',

      buttons: [

        {

          type: 'url',

          url: 'http://javascript-jedi.com',

          label: 'Javascript Jedi'

        }

      ]

    }

  ]      

}



Available parameters for the msg.payload

Name

Type

Description

title

string

Title of the list element

subtitle

string

Sub title of the list element

imageUrl

string

Url of the image element

buttons

array of [button]

Array of buttons, see Buttons node for more details

sharable

boolean

The list can be shared

aspectRatio

string

Aspect ratio of the image. Valid values: horizontal, square

elements

array of [element]

An array of elements for the carousel (here are the elements created by the previous chained Generic Template node

The [element] object

Name

Type

Description

title

string

Title of the generic template element

subtitle

string

Sub title of the generic template element

imageUrl

string

Url of the generic template image

buttons

array of [button]

Array of buttons, see Buttons node for more details