Embedding cards based on their list & position

I’m trying to embed three Trello cards on my website. I don’t want to embed the cards themselves, but rather embed the top three cards on a particular list, so when cards are added or removed from the list, the three embedded cards will change.

I’ve been trying to follow the instructions for ‘on-demand embedding’ here: https://developer.atlassian.com/cloud/trello/guides/embedding/embedding-cards/#on-demand-embedding, but without much luck.

Am I approaching this the wrong way, and is anyone able to point me in the right direction?

Thanks!

You won’t be able to achieve this with any of the card embeds as they are. None of them allow you to filter to a specific set of cards or respond to list changes.

To do something similar, you could write a script that gets the top three cards from a list and then use the embedded cards to draw them.

Or you could make your own “list” that only pulls the top three cards with the card component: https://developer.atlassian.com/cloud/trello/guides/components/card-components/.

Either way, you’re going to have to do some work on your end to get a hold of the data for which cards are at the top of the list at the point in time the page loads.