# Configure Workflow

So far we have defined our intents and related parameters including the slots and triggers. Now we will proceed towards defining the set of actions that need to be done for a given intent. For example, once the *applyLeave* intent has been identified and the required parameters (startDate, endDate, and leaveReason) have been collected, the chatbot is required to do necessary action to ensure the leave is applied for the user. The action or rather the set of actions that need to be carried to successfully complete an intent is defined in the *IntentsAndAutomation->Skills/DSM* section.

![](/files/INTWrZ9H2n9Ap7HXyCL3)

There are two approaches to define the workflow or set of actions that need to taken to complete the intent

* Using *Dialog State Transition*.
* Using *Dialog Workflow.*

In this example, we would be using the *Dialog Workflow*. You can read more about the *Dialog State Transition* in our Configuration section. The *Dialog Workflow* provides a highly flexible editor to configure the workflow which makes it recommendable for users.

## Dialog Workflow

To create a workflow, using Dialog Workflow, go to the *IntentsAndAutomation->Skills/DSM* and select *Dialog Workflow* tab. Use the `+` button to create a new workflow.

![](/files/1egulT9b60PPskezRM1i)

Each workflow is characterized by

* Name : An unique string used to identify the workflow
* Description : Description of the workflow
* Action/Configuration : Definition of the workflow and actions

> > Note that you can define the *Action/Configuration* only after the *Name* and *Description* have been defined and saved. Both *Name* and *Description* are mandatory fields.

For the *applyLeave* intent we are working on this example, let us create a workflow *leaveApplicationSkill* as seen in the image above.

### Map to Intent

We will now proceed to map the workflow to the intent (in our working example, *applyLeave*). The intents can be mapped using the *Map Intent* button under the *Action/Configuration* column.

![Map intent](/files/9yH1VVpgBjfaco5Memyk)

This would display the *Map Handler And Intent* page that allows you to map the intent. All the intents you have defined would be displayed in the *Intent* combobox. Select the *applyLeave* intent and Save to continue.

### View / Edit Workflow

Having mapped the intent to the newly created workflow, it is now time to define the actual workflow. Use the *View/Edit Workflow* button under the *Action/Configuration* column to open the Workflow Editor.

> Note that the workflow editor will prohibit the user from defining the workflow if the Intent is not mapped. The Workflow Editor mandates the intent to be mapped prior to defining the workflow.

The Workflow Editor provides an easy WYSWYG editor for creating workflows with easy flow-charts.

![Workflow Editor](/files/nostZdbkHYTwHUq5ywU3)

The Editor comprises two key components.

* Dialog Functions
* Editor View

The Dialog Functions provides the available functions which can be executed by the Workflow Automation. This also includes an explicit *Start* and *Exit* function, which identifies the start and end of the workflow.

The key functions available are

* START : Signals the start of the workflow.
* EXIT : Signals the end of the workflow.
* IF : Specifies an if condition
* CALLAPI : \_Makes calls to an Rest Endpoint
* GET : Recieves the input from User
* SPEAK : Provide a response to the User
* SET : Set a slot's value, Eg SET validate = true ;
* DO : Call a sub intent. The skill linked to that intent will be called.
* SPEAK\_4\_EACH : If an API sets a parameter with value as List of strings, SPEAK\_4\_EACH can make the bot speak all the values in the list. For Example, SPEAK\_4\_EACH listOfShortListedCandidates ;
* WAIT : WAITS for the given micro seconds before executing next command. For Example, WAIT 2000 ;
* EXPECT : Expects a slot or a comma separated set of slots to be given by the user (there won't be a prompt utterance to ask for the slot in this case)
* TAKE\_PAYMENT : Takes payment and updates status to a slot
* ESCALATE : Escalate the conversation to the supervisor
* EMAIL : Send an email
* SAVE2\_SHEET : Save values to the spreadsheet. Spreadsheet is available in Reports Section

In addition to the Dialog Functions, the Editor also supports *Connectors* which describe the transition or relation between the actions. These include

* STRAIGHT
* NONE
* ANY
* USER\_DONT\_KNOW
* PRESENT
* VALUE

We will now proceed to define our workflow steps.

{% content-ref url="/pages/4A2BKtBcBo0PkUsUA5Cy" %}
[Read Inputs](/getting-started/train-your-bot/configure-workflow/read-inputs.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://readme.dhee.ai/getting-started/train-your-bot/configure-workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
