Is there a way to remotely update card badges?
Example: An external service is calling my REST endpoint via a webhook, thus notifying me of an update of some data. I would like to be able to trigger all cards who display a piece of that data in their badges to be seamlessly updated (without any action need on the part of the user).
How can I achieve that?
Card labels are supported in our API. You can POST/DELETE to the “card/:cardId/idLabels” endpoint to add or remove labels on a card. Make sure you have the id of the label handy.
You can read more about it here: https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post
I meant card badges and not labels, as per card-badges capability.
Can you suggest a way I could use to trigger their re-render?
There isn’t a rock solid way of doing this and I feel like I’ve heard of a few different solutions…
A very hacky way of doing this would be making a PUT call to the card you want to update and change something minor like adding a space to the description.
t.render should be called when the card’s data is updated.
That sound hacky indeed
What do you mean by "
t.render should be called…"? This function is available only client-side. The whole trick is to trigger to re-render, from the backend.
Right - to be clear, there is no way to trigger it from the backend. There isn’t a call or capability or anything that does this. So you have to workaround it by making one of the things happen that causes a re-render to happen on the frontend.
Got it. Thanks for clarifying, @bentley!