Digital Assistant Cards can be dynamic, which means that the data shown in the Card can be set to update automatically. In general, there are 2 ways to update a card: using a scheduler or through web hooks.
Card scheduler can be set to update the card at a fixed time interval e.g. every hour. Every time the interval expires the card executes the code inside its
script.js file. Therefore, if your Card relies on dynamic content coming from an API, you could populate the
script.js file with API calls that would fetch the data and update the card.
Have a look at our article of building a Card with API proxy for an example.
To set the scheduler we should first enter the Card edit menu:
Here, you should see a section for the scheduler, which allows to set the time interval for updates:
Another way to implement Card updates is through the use of web hooks. By using a web hook the Card is updated only when an event associated with it occurs e.g. a Card displays the latest commit message only when a new commit is pushed to the code repository.
To enable a web hook for Digital Assistant Card we need to enter the Card edit menu and tick the checkbox in the schedule section:
The Web Hook url, also known as the payload url, is the address that should be called by the web hook provider once an event is triggered. Once an event is triggered, the web hook provider should send a HTTP message to this url, which will run the associated Card's
script.js file and trigger an update.
The Assistant Card work space is designed to ease the cognitive load for the user by displaying Card notifications only when they're relevant. In order to avoid the work space being cluttered with stale content Digital Assistant uses an update decision mechanism called 'Delta Recognition'. This mechanism strives to ensure that the user gets Card notifications only if the data derived from them is meaningful.
For example, if you have a Card that notifies whether the build process of your application has been successful you may want to see a Card notification only if the build status has changed e.g. went from successful to failed. This way instead of receiving notifications consecutively they are displayed only when new information can be gained.