Have you you looked into Static Data? That allows you to store some data from a code node and use it in the workflow and following workflows, We have a couple of workflow templates that use it for things like only posting new tweets to RocketChat which could be a good example for you.