Preprocess code is executed before the output is prepared. If you want to trigger a different message or do anything based on user’s initial input, this is usually the best place to do it.
Postprocess code is executed after the output is prepared, but before it is sent. This is usually the best place to put code that deals with results coming from a Web Responder.
Process User Response¶
Process User Response code runs after the output has been sent to the user and the user has responded with another message. This is usually the best place to put code that deals with user feedback, such as selecting from options or answering questions.
If you use Quick Replies, you can put code to handle the Quick Reply response in Process User Response. If you don’t handle them here, responses to Quick Replies will be handled by Pattern matching.
Special Note: setTriggerNextMessage()¶
Note that in all cases,
setTriggerNextMessage() does not immediately trigger the next message. The embedded code finishes executing before the nest message is triggered. (That is: you cannot use
setTriggerNextMessage() in place of a