How to make Cards self-refresh periodically

You may wish to create a Card which repeatedly fetches new data at a certain interval, so that changes can be reflected without the user needing to reload the page itself.

This can be achieved with a custom action, as covered in the Card Actions guide.

The custom action will poll the Card's internal or external connector script at a given interval to update the data model.

Refresh action logic

All that is required to enable the refresh action for a Card, is to set the card's action.initialize function to the following:

action.initialize = function (evt) {
  window.setInterval(function () {{
      args: {
        atAgentAction: "refresh"
  }.bind(this), 300000);

The refresh period is set in milliseconds and is represented by the 300000 in the example above (5 minutes) - you can alter this value to any desired period in milliseconds.

You can find the custom actions tab in the Card Designer:


This same process can be applied to any Card to enable self-refreshing functionality.