Pre-Task Actions
Pre-task actions run before the main part of the task. When user input triggers a particular task, Answer Server runs the pre-task actions before checking for requirements. The main use of this option is to provide an initial prompt at the start of the task.
To configure pre-task actions, you set the pre
object in the configuration object for an individual task.
The pre
object is not required. If you do not add a pre
object to the task, Answer Server runs the next step of the task, for example processing and gathering the requirements.
The following table describes the properties that you can set in the pre
object.
Property | Type | Description |
---|---|---|
response
|
string | (Optional) A string response to return to the user. For example, this might be an introductory sentence to start the task. |
lua
|
string | (Optional) A lua function to run before the rest of the task, for example to generate a dynamic task preamble response. The function that you specify must accept a taskUtils object. See Lua Processing Scripts. |
{ "tasks" : [ { "id" : "GREET", "pre" : { "response" : "Hello and Welcome to the Virtual Assistant. How can I help you?" }, "trigger" : { "simple" : { "phrases" : [ "hello", "hi" ] } } } ] }