I am new to FIGMA, I am looking for a way to send an event from the FIGMA prototype to the parent window which renders the FIGMA prototype when a user clicks on a particular button(Submit/Done/Complete) from the last screen/design on the FIGMA prototype.
Is this possible? if yes, Please do let me know the steps for implementing it
Yes, it is possible to send an event from a FIGMA prototype to the parent window. You’ll need to use the postMessage API to communicate between the FIGMA prototype and the parent window.
Hey @DivizH, thank you for reaching out and apologies for the delayed response!
I can check this internally with the team, but could you show me a screenshot of your screens and describe again what you’re trying to achieve?
I’d like to understand what exactly you’re trying to achieve here:
“send an event from the FIGMA prototype to the parent window which renders the FIGMA prototype when a user clicks on a particular button(Submit/Done/Complete)”
Also, feel free to share your file if you’re okay to share in the Forum. You can invite support-share@figma.com with “can edit” permission so we I look into this.
Note that users with @figma.com emails on your team do not count towards your billing.
Actually i’m quite interested to know if a solution exist to listen/get prototype events in order to trigger requests on a custom API. That way, it will be possible for a Figma prototype to be connected to something external from it.
Eg : I play a Figma prototype with a button. When I click on the button, I want to be able to request a custom API route on my service.
Is it possible ? If yes, how ? With a plugin, a widget, your REST API ? Thanks
Ohh okay I see this is possible when we use embedded thank you very much !
Correct me if I’m wrong but it seems that today it only support those messages :
Listen which element has been clicked by id
Ask the prototype to navigate to another page by id
But is it possible to change the content of the prototype dynamically ? Eg. change the value of a text in prototype mode
If not, is there a roadmap to support dynamic content in prototype mode ?
It would be a game changer and eliminate the need to use protopie in some cases.
Hey @DivizH, may I ask if you managed to post messages from your Figma prototype to the parent window? I followed the documentation Gayani_S provided and I’m able to read the events from the prototype – but these are standard ones. I want to create a set of custom events such as “Sign up completed” and post these to the parent.
Thanks for getting back @Albert13. I’m glad to hear the standard events are working, and I understand the need for custom events like “Sign up completed” to track specific actions. I’ve shared this with the team to get you more details, and I’ll keep you updated as soon as I hear back.