Hey there!
Here's an example of how you would write each in code:
// Output warning that axes take longest route
if (retractDistance <= 0) {
error(localize("Rotary axes are taking longest route without tool retraction."));
return;
} else {
var text = localize("Tool is retracting due to rotary axes limits.");
warning(text);
writeComment(text);
}
So you're correct in your assumption about them taking strings.
Is it possible to use these to feed messages back to the Post user?
Yes there is, technically. I'm just now sure if it's what you're looking for exactly. But basically if you use an error, then the code will not post, it will error out, and a log will pop up with the error message. That looks like this:

A warning however won't abort code generation, but it will display an error log file with the warning, but it will also save a complete gcode file. An error causes the code to abort, and you only end up with something like half of a file.
Here's a good example of that:

I'm assuming you wanted something a little more visually though for the users? Of which this is going to be the best option available unless you have enough free time to write additional software too.
Hope that helps clear things up a little bit for you, best
-Xander Luciano