Workflow metadata for web app consumption

Hello there,

I am building a web app where user can start the execution of temporal workflows from the browser.

Once a workflow has started, I would like to show a page in the web app with the metadata of the workflow run. E.g workflow id, start/end time, type, workflow/activity input/output, status. I don’t need the full history/replay data.

What is the best way to go about this? From my research, I see 2 solutions.

  1. Should I create endpoints in my backend to call the visibility API through the SDK? when the retention period has passed, I believe archival can be enable? And I can still fetch the data I need?
  2. Should I create workflow/activity interceptors and hook them in my worker to save the workflow/activity data I need in the persistence store of my backend service?

Thanks for you help