Extensions API Iframe

saidheerajv
Participant

I am using extensions API to open a iframe and perform a certain action and Iframe is closed after the process is complete, Is there any way I can get the output from the iframe and change my card accordingly to reflect the output of action done in iframe ? If not card is there anything else I can manipulate to indicate if process in Iframe was success or failure even after user closes the iframe ?
PS : I am using window.post(); to close the iframe.

0 Upvotes
3 Replies 3
IsaacTakushi
HubSpot Employee

Hi, @saidheerajv.

 

If I understand your use case correctly, there is no way to directly update a card's contents from an iframe action, but you can indirectly update a card by returning different data to HubSpot data fetch requests.

 

When an action iframe is closed, HubSpot should make a new data fetch request to "refresh" the card data. Thus, if a user's action in an iframe should change the data displayed in a card, you can change the payload your server responds with to HubSpot data fetch requests. HubSpot will process the changes and reload the card with the new data.

 

Please let me know if I can clarify further.

Isaac Takushi

Associate Certification Manager
saidheerajv
Participant

Thanks @IsaacTakushi  that was very helpful. 
I am new to Hubspot app dev and to my best knowledge data fetch requests are made during page load. But,
When you say "HubSpot should make a new data fetch request to "refresh" the card data." Does that mean that there is way I can make it ? or trigger data fetch request dynamically.  if yes, Can you please suggest me the resource to utilizing feature.  

0 Upvotes
IsaacTakushi
HubSpot Employee

Hi, @saidheerajv.

 

There is no way to directly trigger a data fetch request, but HubSpot will automatically fetch new data on page load as well as when one of your card's actions are completed, such as closing an iframe.

 

So, let's say a user clicks a card in HubSpot, your extension defintion opens iframeelement, the user takes some action within theiframe, changing data in your system, you then update what your server should respond with to data fetch requests for that object. At the moment the user closes the iframe, HubSpot makes a second data fetch request to your service, you return the updated data, and HubSpot changes the data displayed to the user accordingly.

 

Please let me know if I am making sense.

Isaac Takushi

Associate Certification Manager
0 Upvotes