I will have a post soon on NamedMessages. The key takeway from that post is to subclass Messages like so (in the betaassi framework):
class NamedMessage(BaseMessage) :
Tx_id:Optional[str] = Field(default="")
Behind the scene, it uses up one slot (out of 16) in the metadata. Then after you retrieve the latest msg ( if you use the run mechanism), you can update the metadata with the response message with the type and tx_id.
Then you can list the messages belonging to the specific tx_id.
The betaassi framework is written in python… so ymmv