Retriggering app_card:connect

  • 12 August 2022
  • 4 replies
  • 22 views

Badge +1

Hey there

 

I’ve been updating our app that imports data from an external Issue management system to SDK v2.  

After I’ve done some tinkering with the new synchronization options offered with v2, I’m left with following question: How can we, respectively when does Miro (offer) re-sync for the created App Cards?  

In the SDK Reference, I could only find a reference about the event firing when you click the “Connect” button on the card, which I could only do once, after creating the item. Even after reloading the board, the Item is apparently still connected.

But how can I thereafter sync any updates I add on the external data source? How can I, or when does Miro ever (propose a) re-sync?


4 replies

Userlevel 5

Hey @aurech,

 

So it sounds like you’re wondering how to sync data on an App Card in Miro when there is an update to your data source. Do you have any web hooks available to your data source that you could tap into? Then you could listen to changes and use Miro’s Rest API to update the card when a change is made.

 

I’ve also built a guide + code sample on 2 way sync that you can check out here: https://developers.miro.com/docs/enable-2-way-sync-between-app-cards-and-github-cards#workflow-3-update-issues-and-project-cards-in-github

Badge +1

Thanks for the response @Addison Schultz 

 

Nice tutorial, will definitely refer further to it when we’re implementing 2-Way data sync, which we indeed have as a Backlog Item.

What I’m trying to achieve now is a more simple, lazy synchronisation though. One that is triggered manually, either per card or in a bulk operation for all cards on a board. 

That’s why I was looking for any way to refire “app_card:connect”, since my handler for it contains the logic to fetch items’ data from the source and sync them with it. Pretty straightfroward and a decently appetizing first iteration on implementing data syncing in my opinion ;)

Userlevel 5

What about adding a part in the SDK UI that allows you to “re-sync” the cards? You could use the platform to get all items on a board, filter out just the app cards, and sync them from there. 

Additionally, you could try using the Selection Update event, which fires when a card is selected: https://developers.miro.com/docs/sdk_types_dist#selectionupdateevent

Badge +1

I think I’ve probably just overlooked the obvious. You can sync items whenever you want using the sync() method, right?. I was somehow assuming this was only available inside / with app_card:connect.  

 

Can easily do what I intended with that.

 

Thanks for the replies.

 

Reply