I usually script my stuff into a python.py file.Then I add my python script to a toolbox.And finally I publish the gp result as a geoprocessing service as shown on the tutorial I recommended above.After a quick look at python toolboxes, it seems to me that it is almost the same thing except that my two first steps are merged in one.Then to publish it a geoprocessing service, it works the same way.You can define inputs but you don't have to if you don't need any inputs from the webapp.
input = arcpy.GetParameterAsText(0) #It should be working the same in a python toolbox or it should be something similar
You can define an output too if you want (that could be the "message" you are talking about) :
if the script works :
output = "job done"
else :
output = "job not completed"
arcpy.SetParameterAsText(1, output)
- > in GetParameterAsText(0) and SetParameterAsText(1), 0 and 1 refer to the row number of the parameters list.What I don't know is how to define the inputs, output data-type (String, File), direction (Input, Output) and type (Optional, Derived) from a python toolbox (parameters don't appear in the toolbox properties). It might be filling out automatically with python toolbox.Then, when you call your geoprocessing service from you webapp, it will return an output if you defined one.