You can setup a system variable with nodeTags.
example template (simple):
Dear, {mc:firstName}.... etc
You would then call an evaluate template after setting the message cache example code:
messageCache.setValue('firstName', 'John');
var letter = qie.evaluateTemplate(qie.getVariable('someVariable'));