How can i track workflow state changes to save in my database?

Hello, I’m looking to store state changes in my temporal workflows to my database, i see that temporal doesn’t have open webhooks to monitor changes.

What im currently thinking is having calls to my API from within workflows that notify my backend on state changes and log the changes by consulting with the SDK and storing the obtained info to my database.

What do you guys think? Is this a valid way of doing it? What problems do you think might arise?

Thanks!

The best way is to call activities that update your DB.

For example, im using nest for backend, what you sugest is use nest to call for DB updates and skip the API entirely?

I don’t know Typescript. My understanding is that you can call any API or framework from Temporal activities.

That’ll do, thanks

We have publish status activity, that writes to postgres table(via api) and it’s added wherever there is state change, that needs to be tracked.

And this helps with another issue, temporal events store expires after 30 days. So, having a copy helps with longer retention .

That sound very interesting, is there any documentation on this? is it a custom integration? any part of the SDK i can use?