Where to save persistent data in a published node

This may help you

https://nodered.org/docs/user-guide/context