# Rules

Rules are your users' questions mapped to stories (bot's answer). Rearrange rules to prioritize over others.&#x20;

P1 = highest priority.

<figure><img src="/files/XpSWIEYvhM6YjlRNZaMM" alt=""><figcaption><p>Rules Dashboard</p></figcaption></figure>

1. **Filter Rules from Message** enables you to enter a search query and automatically filter its associated Rules. Your search query may contain keywords related to the group name, rule name, or condition properties and values. With just a click or tap, **Reset** allows you to clear the search bar content.

<figure><img src="/files/sDlGKQW7gIEWDvjI3uFM" alt=""><figcaption><p>Searching Rules using a Keyword</p></figcaption></figure>

2. **Show System Rules** allows you to view system rules autogenerated by your bot when toggled. Please be careful when changing these rules as they might affect your chatbot’s operation.
3. **Select Action** dropdown allows you to access the **Export Rules to CSV** function that exports rules to a CSV file that can be downloaded.
4. **New Group** creates a new group in which associated rules can be created or placed under.
5. **New Rule** creates a new rule. If a rule is not created under an existing group, it will be placed in the UNASSIGNED group by default.
6. **Collapse All** enables you to collapse all expanded rule groups and rules.

<figure><img src="/files/vuI7VsCta0H7knXIjoWG" alt=""><figcaption><p>Collapse all Expanded Rules</p></figcaption></figure>

7. Shows all existing rules and rule groups.

### Creating a New Group

Click on the <img src="/files/Kx33tUNqsfxZyx4xf8Pb" alt="" data-size="line"> button and then give your group a name that best represents the rules that will be placed under it. Once done, click **Save**.

<figure><img src="/files/e0X4pjeV4YaILozbFCDW" alt=""><figcaption><p>Naming your Group</p></figcaption></figure>

<figure><img src="/files/k9Zykuc1Nkfp8rUpX5O6" alt=""><figcaption><p>New Group Successfully Created</p></figcaption></figure>

### Add a Rule

There are two ways to create a new rule.&#x20;

* Clicking on <img src="/files/AvkY4JkZ3LViQrwDDT9y" alt="" data-size="line"> creates a rule under the UNASSIGNED rule group. All user-created rules can move between groups by clicking on **Move to group**.

<figure><img src="/files/dImCxpVzddNzWEQPK0ry" alt=""><figcaption></figcaption></figure>

* Clicking on <img src="/files/dzsSCQEmTy4Ao4x6uyoG" alt="" data-size="line">creates a rule under the corresponding rule group.

<figure><img src="/files/Alirml0H2QaZm9rumdrA" alt=""><figcaption><p>Rule Group</p></figcaption></figure>

<figure><img src="/files/deKqZZ2cfRD8gd4ZS8Bb" alt=""><figcaption><p>Creating a Rule in a Rule Group</p></figcaption></figure>

1. Regardless of which method is used, created rules require a rule name. In this example, create a rule with “Who is your best friend?” as its name (the example indicates preparing rules for users to ask about Bob’s friends).
2. Add the condition. (In this case) set the condition to recognize the keyword(s) “best friend”.
3. Name your story and link the new story to the rule. The story is the *reply to the **question***.

<figure><img src="/files/owZB268vLSoqh2NeSHxH" alt=""><figcaption><p>Creating a Rule</p></figcaption></figure>

![Story Example](/files/-LjBqEVHTI-A4wuqxyOt)

<figure><img src="/files/0tqTPh1gCzreXGdjTFAa" alt="" width="375"><figcaption><p>Testing a Rule</p></figcaption></figure>

### Viewing Rules used in a Story

To view all rules used in a particular story, navigate to that story and all the nonlinear and linear rules used will be displayed.

<figure><img src="/files/Ge1z7RwB0k0dxl6b0byY" alt=""><figcaption><p>View all Rules used in a Story</p></figcaption></figure>

To edit a rule used in a story, click on the rule you wish to edit and the rule will automatically be filtered and expanded.

<figure><img src="/files/HXyI91CfagEFLyN0DSvd" alt=""><figcaption><p>Filtered Rule from a Story</p></figcaption></figure>


---

# 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://docs.botdistrikt.com/features/rules.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.
