TrelloPowerUp and addeventlistener

If I understand correctly, there is not presently a way to determine when (i.e. the timestamp) a label was added to a card.

So I would like to use addEventListener to capture label events. But what is the “right” way to get the ‘t’ object to use (to check authorization, get and set data, etc.)? The following seems to work:

window.addEventListener("message", function(event) {
  let d =[0].data
  if(d.command == "card-badges") {
    var t = window.TrelloPowerUp.iframe({
      appKey: my_key,
      appName: my_appname
    t.args[0].context =[0].data.args[0].context;
    t.args[0].secret =;
   // now do something with t

But I get the warning Cannot call TrelloPowerUp.iframe() from your index connector...

Is there a better way of achieving this?

There is not a way to use a Power-Up to listen in for changes like this in Trello.

If you want to have Trello send you data for when “actions” take place inside of a Trello board, you’d want to use webhooks:

There are a number of types of actions ( that get sent to webhooks, but you’d specifically want to filter for addLabelToCard types to determine when a label was added to a card.

Thank you for the reply! So then I would include the authorization token in the webhook request so that I could call the API from my server to update the card data upon receiving the POST request from trello?

(Any chance labels could be timestamped in the future?)

Could you be more specific? The addLabelToCard action does have a timestamp for when the label was added to the card.

You need a token to create the webhook. And then, generally, your server would hold onto the token (remember, a token is a secret and should never be publicly available) and use it to make whatever requests you need to make once you’ve received the actions you’re looking for from Trello.