Create a Task Configuration File

The Conversation task configuration file describes all the settings for a particular conversation task, including prompts, triggers, response validation, and the details of Lua scripts to run.

You can retrieve the full schema for the task configuration JSON file by sending the GetResources action with the Type parameter set to Schema.

TIP: For ease of maintenance, you can split your task configuration across multiple JSON files. Answer Server merges the configurations together when it runs.

The task configuration file contains one or more conversation tasks. Each task must contain a unique ID (id). You can also set a display_id, which is a user friendly display name that Answer Server uses in a disambiguation message when user input matches the triggers for more than one task (see Conversation Triggers).

The other options you use in a task depend on what you want to the task to do. The following sections describe the main options that you can use in task configuration:

  • Pre-Task Actions. Pre-task actions run at the start of the task. You can use pre-task actions to set an initial prompt for the task, by setting some text or by specifying a Lua function to run to generate a prompt.
  • Conversation Triggers. A conversation trigger defines when to run a particular conversation task. You can use several different types of trigger to activate a particular task by matching user text against a simple word list, a regular expression pattern, or an agent.
  • Task Requirements. Task requirements request pieces of information that the user must provide before Answer Server can complete the tasks. You can save the requirement result as a variable, either for the duration of the task or for the whole conversation session.
  • Post-Task Actions. Post-task actions run at the end of the task, after all the requirements have been satisfied. You can use post-task actions to send an acknowledgment to confirm that the requirements are met, or to call a Lua function to perform an external operation.
  • Task Routing. Routing allows you to specify the task to run after the current task. You can route directly to a particular task, or you can use a further prompt to allow you to route to another task depending on user input.
  • Response Validation. Response validation allows you to check that the user provides a response that you can use in the task, and to deal with the response if it is not valid. You can validate the response by using a simple word list, a regular expression, Eduction, or a Lua script.
  • Lua Processing Scripts. You can use Lua functions in your task configurations to run additional more complicated operations, and to send calls to external systems to complete tasks. You configure a single Lua script in your task configuration, and then call individual functions. You can use functions to generate a custom preamble for a task, to perform an operation at the end of the task, and you can use Lua functions for response validation and to process user input that is not valid.

In addition to the task configuration, and the associated validator configuration, the task configuration file also contains:

  • Initial Task. The ID of the first task to run when the conversation session starts, if you do not have any initial user text. You must include an initial task in your task configuration.
  • Fallback Task. The ID of a task to run when there are no other active tasks. You must include a fallback task in your task configuration.
  • Default Messages. Custom text to use for default responses, such as when the user does not provide any valid input, or to provide the user with disambiguation options when their text triggers more than one task. There are default values for these messages, which you can override with your own values (for example, if you want to create conversations in a different language).
  • Task Cancellation. Settings that determine how to allow users or the system to cancel a task, and what to do when a task is canceled.