You want to use .loadSemanticComponents(); for your STSession That will stop UI components loading, like your error message box. The my guess then is default for session is loadallcomponents, ie with UI components.
You've basically built a Sametime bot, take a look at this article to help you:
http://www.ibm.com/developerworks/lotus/library/ls-ST_Bots1/
Am I right in thinking you work for IBM?