> For the complete documentation index, see [llms.txt](https://docs.hablla.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hablla.com/hablla-docs-en/hablla/settings/repository-rpo.md).

# Repository (RPO)

Coming soon

The **Repository (RPO)** is a Hablla resource intended for storing and managing **JavaScript Classes and Scripts** that can be used in your workspace automations.

Its main purpose is to allow more complex logic to be **centralized and reused**, preventing the same implementation from having to be built and maintained individually in different flows.

{% hint style="warning" %}
The **Repository (RPO) is an advanced resource**, intended mainly for users who have knowledge of **JavaScript, APIs, system integrations, and development**.

If you do not have technical knowledge in these areas, we recommend that the creation or modification of Classes and Scripts be performed by a qualified person.
{% endhint %}

### When to use the RPO?

The RPO is especially useful when the same logic needs to be used at different points in your operation.

A common example is **integrations with external systems**.

Imagine that different flows need to query or send information to the same system. It is possible to build all the necessary logic individually within each flow. However, as the number of automations increases, this approach also increases maintenance complexity.

Without centralized logic, we could have a scenario like:

```mermaid
flowchart LR
    A["Flow A"] --> D["Integration"]
    B["Flow B"] --> E["Integration"]
    C["Flow C"] --> F["Integration"]
```

In this scenario, if any integration rule is changed, it may be necessary to update each of the flows that have that implementation individually.

Using the RPO, certain logic can be centralized and later reused by the automations that need it:

```mermaid
flowchart LR
    A["Flow A"] --> RPO1["RPO"]
    B["Flow B"] --> RPO2["RPO"]
    C["Flow C"] --> RPO3["RPO"]

    RPO1 --> INT["Integration"]
    RPO2 --> INT
    RPO3 --> INT
```

In this way, part of the logic can be kept in one place and reused in different processes.

Some scenarios in which the RPO can be used include:

* Integrations with external systems;
* Queries and sending of information through APIs;
* Data handling and transformation;
* Reuse of rules or logic across different flows;
* Centralization of features used by different automations.

### Classes and Scripts

Inside the **Repository (RPO)**, you will find two main areas: **My Classes** and **My Scripts**.

#### Classes

The **Classes** allow you to organize functionalities that can be reused in different automations.

A Class can concentrate different actions related to the same purpose. In an integration with an external system, for example, a single Class could concentrate functionalities responsible for querying, creating, or updating information.

In this way, different flows can use these functionalities without needing to reproduce the entire implementation individually.

#### My Scripts

The section **My Scripts** allows you to store JavaScript code intended to execute specific logic or actions within automations.

While Classes are especially useful for organizing and reusing sets of functionalities, Scripts can be used to store implementations that are more focused on a specific action.

<table><thead><tr><th width="201.862060546875">Resource</th><th>When to use</th></tr></thead><tbody><tr><td><strong>Classes</strong></td><td>When a logic or set of functionalities needs to be organized and reused in different automations.</td></tr><tr><td><strong>Scripts</strong></td><td>When it is necessary to store JavaScript code intended for a specific action or logic.</td></tr></tbody></table>

{% hint style="danger" %}
**Be careful when changing existing code in the RPO.**

Classes and Scripts can be used by different automations in your workspace. For this reason, an incorrect change in shared code may affect **various flows and processes in your operation simultaneously**.

If you do not know the purpose of an existing Class or Script, we do not recommend making changes or tests directly in that code.
{% endhint %}

## How to access the Repository (RPO)

### 1. Access the Workspace settings

Inside the **Hablla Studio**, click the **gear**icon, located in the upper-right corner of the screen.

### 2. Access the Repository (RPO)

In the left-side menu of the settings, find and click the option **Repository (RPO)**.

<figure><img src="https://1592162275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrmxWrIrMauHcIrsuqfGq%2Fuploads%2F9FTgUYTnBlaNcKf6P4hg%2Frepositorio.png?alt=media&amp;token=e9034e71-d84c-401a-b5ed-444db1bffb65" alt=""><figcaption></figcaption></figure>

When you access the repository, you will find the two available areas:

* **My Classes:** shows the Classes registered in your workspace;
* **My Scripts:** shows the JavaScript Scripts stored in the workspace.

## Creating a Class in the RPO (Advanced)

{% hint style="warning" %}
Creating and editing Classes requires knowledge of **JavaScript and software development**. This documentation presents how the feature works and the rules needed to use Classes in the RPO, but it is not intended to teach programming or JavaScript development.
{% endhint %}

### 1. Create a new Class

In the area of **My Classes** of the Repository (RPO), create a new Class by clicking the button <kbd>**+ New class**</kbd> and enter a name to identify it.

When you finish typing the Class name, the system will automatically add the prefix "<kbd>**W\_**</kbd>" to the provided name and capitalize the first letter.

For example, if you enter: "**`test`**" Hablla will define the Class name as: "**`W_Test`**"

### 2. Use the name generated by Hablla in the code

The name shown by Hablla after defining the Class name must be used in your JavaScript implementation.

For example, if you initially entered: "**`test`**" and Hablla registered the Class as: "**`W_Test`**"

The Class declaration in the code must use that same name:

```javascript
class W_Test {
    // ...
}
```

Therefore:

<table><thead><tr><th width="264.7586669921875">Step</th><th>Name</th></tr></thead><tbody><tr><td><strong>Name provided during creation</strong></td><td><code>test</code></td></tr><tr><td><strong>Name generated by Hablla</strong></td><td><code>W_Test</code></td></tr><tr><td><strong>Name declared in the code</strong></td><td><code>W_Test</code></td></tr></tbody></table>

#### Demonstration video on how to create a class.

<figure><img src="https://1592162275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrmxWrIrMauHcIrsuqfGq%2Fuploads%2Fgt65gBaUaalYiZ0uiAGk%2F%5BDOCS%5D%20-%20Como%20criar%20uma%20Classe.gif?alt=media&amp;token=5b6d5236-69f9-4823-a908-02d3e62e0686" alt=""><figcaption></figcaption></figure>

{% hint style="warning" %}
The **name declared in the code must match the final name presented by Hablla**.

The prefix `W_` and the capitalization of the first letter are automatically applied by the platform when defining the name, but must be present in the Class declaration within the code.
{% endhint %}

### 3. Publish the Class

After finishing the creation and checking your Class code, it is necessary to **publish it** so that it becomes available for use in the workspace.

To do this, click the "<kbd>**Publish my classes**</kbd>" button, located in the upper-right corner of the My Classes section.

When clicking this button, confirm the action by typing the confirmation word to proceed and finally click "<kbd>**Confirm**</kbd>" to apply the changes made.

> **⚠️ Important**
>
> Whenever you make a change to a Class's code, it will be necessary to **publish it again** so that the new version becomes available for use.

### Classes can use other Classes

A Class stored in the RPO can also use functionalities provided by another existing Class in the same environment. This allows responsibilities to be divided and functionalities to be reused without needing to repeat the same implementation.

For example, a Class responsible for billing could use another Class responsible exclusively for authentication with the external system:

```mermaid
flowchart LR
    A["Flow"] --> B["Billing Class"]
    B --> C["Authentication Class"]
    C --> D["External System"]
```

This structure makes functionality reuse easier, but it also creates a **dependency between the Classes**.

{% hint style="danger" %}
**Before editing or deleting a Class, check whether it is used by other Classes and/or automation flows in the workspace.**

A Class can work as a dependency for other implementations. Therefore, a change can affect other code and flows even if the Class does not seem to be used directly.
{% endhint %}

## Best practices when using the RPO

Since this is an advanced feature capable of impacting different automations, we recommend some precautions during its use:

* Use the RPO only if you have sufficient technical knowledge to understand the code being implemented or changed;
* Before changing an existing Class or Script, check where that resource is being used;
* Avoid performing tests directly on code used by production automations;
* Use names that make it easy to identify the purpose of Classes and Scripts;
* Consider the dependencies between Classes before making changes or deletions;
* Whenever possible, validate changes before using them in critical operational processes.

{% hint style="info" %}
If your operation requires an implementation in the RPO and your team does not have the technical knowledge to develop it, we recommend that the setup be carried out by a **professional with experience in JavaScript, APIs, and system integrations**.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.hablla.com/hablla-docs-en/hablla/settings/repository-rpo.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
