Update format-url capability

Update format-url Capability

We’ve added a more robust unfurling experience for the format-url capability.

The capability now accepts the following options to allow Trello to provide a more robust experience: subtext, thumbnail, and actions.

For example, the Dropbox Power-Up provides a preview thumbnail, information about a links’ last edit as subtext, and the option to “Download” as one of its actions.

Example Code

window.TrelloPowerUp.initialize({
  'format-url': function (t, options) {
    // options.url has the url that we are being asked to format
    return {
      icon: GRAY_ICON, // don't use a colored icon here
      text: '👉 ' + options.url + ' 👈'
      subtext: 'This will show us some text.',
      thumbnail: IMAGE_URL // OK to use colored image here.
      actions: [{
        text: 'Download',
        callback: () => {
          // The function to run when the button is clicked.
          return
        },
      }]
    };

    // if we don't actually have any valuable information about the url
    // we can let Trello know like so:
    // throw t.NotHandled();
  }
});

2 Likes