Skip to content

List Template node

Guidone edited this page Sep 28, 2021 · 5 revisions

This node is deprecated, use Messenger Template Node instead

The List Template node is a template that allows you to present a set of items vertically.

It can be rendered in two different ways. The first way renders the first item with a cover image with text overlaid. This is good to making the first item appear prominently above the other items. The second way renders each item identically and is useful for presenting a list of items where no item is shown prominently.

Two or more List Template node can be chained to create a list to a maximum of four elements. Each template may have a maximum of one button. To see a list of available buttons see the Button node.

The list may have a global button at the end of the list, to add the global button just chain a List Template node with an empty title, the buttons here will be used as global button for the list.

For each List Template node only the first button of the buttons section will be shown. Every list item has also a default action which acts like a url button. The first button of type url will be used as default action of the item (only the first button will be shown, if there's an additional url button in the buttons list it will be used as default action).

In order to create a list template element 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,
  topElementStyle: 'large'
}

or in order to pass a collection of list element

msg.payload = {
  sharable: true,
  topElementStyle: 'large',
  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'
        }
      ]
    },
    {
      title: '', // global button    
      buttons: [
        {
          type: 'url',
          url: 'http://my-site.com',
          label: 'Open'
        }
      ]
    }
  ]      
}

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
topElementStyle string Style for the first element. Valid values: large, compact
elements array of [element] An array of elements for the list template (here are the elements created by the previous chained List Template node

The [element] object

Name Type Description
title string Title of the list element
subtitle string Sub title of the list element
imageUrl string Url of the element image
buttons array of [button] Array of buttons, see Buttons node for more details

Facebook

Clone this wiki locally