# Step 4. Watching Features

## Step 4.1: Email Confirmation

{% embed url="<https://youtu.be/srYAF1imzho>" %}
15:49
{% endembed %}

Set the default role `not authorised` for every new user (object from `WebUser`) and create a simple scenario:

![](/files/-MbA_EpiHSK-U1rRQbZt)

Add two data structures.

`ConfirmRequest` with the following fields:

* `user_id` — link to `WebUser`
* `code` — type of string
* Fields for sync [result processing](/web-pages/components/legacy-components/form.md#online-result-processing)
  * `is_success` type of boolean
  * `result_title` type of string
  * `result_text` type of string.

`CodeRequest` with the following fields:

* `user_id` — link to `WebUser`
* Fields for sync [result processing](/web-pages/components/legacy-components/form.md#online-result-processing):
  * `is_success` type of boolean
  * `result_title` type of string
  * `result_text` type of string.

Create a new web page called '**Watch features'** and add two [conditional sections](/web-pages/setting-up-pages-layout.md#conditional-sections-visibility):

* The first section is visible only for users with the `not confirmed` role and includes two forms:
  * Form for submitting `ConfirmRequest`
  * Form for submitting `CodeRequest`
* The second section is visible only for users with the `confirmed`role.

![](/files/-MbA_uDS2p-VoFma0Ykg)

The '`CodeRequest'`form triggers a scenario in sync mode, which generates and sends a code to the user. The code is then saved in the`WebUser` object.

![](/files/-MbAbCTW3e_uJdA3Lswi)

The '`ConfirmRequest`' form compares the provided code with the one saved in the the '`WebUser'` object. If they match, the role '`not confirmed'` is removed, and the role '`confirmed'` is added to the '`role'` field in the '`WebUser'` object.

![](/files/-MbAbiRra4R3vqgUJm7_)

## Step 4.2: Watching Features

{% embed url="<https://youtu.be/FoRWMmOcn-g>" %}
12:34
{% endembed %}

Create a new data structure called 'WatchRequest' with the following fields:

1. 'user\_id' – a link to 'WebUser.'
2. 'feature\_id' – a link to 'features.'
3. 'type' – a string type to store 'watch' or 'unwatch'."

Add a new field 'users\_watching\_ids' with the type 'arrayLink' to the 'Features' data structure.

Create a new API-endpoint and a new web-page named 'Watch features.' In the endpoint, set a filter 'users\_watching\_ids arrayContainsAny {{id}}' to select only the features where the user's ID is in 'users\_watching\_ids.'

Now, add two actions:

1. 'Watch' on the 'Upvote features' web-page.
2. 'Unwatch' on the 'Watch features' web-page.

Scenario for processing WatchRequest (can be either synchronous or regular)

![](/files/-MbAli7EyQyxgXJbtwNT)

Next, create a new scenario triggered by changes in the development\_status and request\_status fields of the feature object. This scenario sends objects from the users\_watching\_ids to the 'Notify users' scenario, passing the feature\_id as a parameter ([context variable](/scenarios/using-variables/context-variables.md)).

![](/files/-MbAmScZ3YmCOcOH5Eiq)

That is it! Thank you for using Directual. You can find the Open Development Roadmap app among our free templates.


---

# 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.directual.com/directual-step-by-step/open-development-pipeline/step-4-watching-the-features.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.
