> For the complete documentation index, see [llms.txt](https://docs.smartbotpro.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.smartbotpro.io/scripts/actions/extract-data.md).

# Extract data

{% hint style="info" %}
The "retrieve data" action is an indispensable assistant in obtaining and saving information. With it, you can extract any content from any string in a given format.&#x20;
{% endhint %}

Let's add a block by selecting an action in the additional menu on the left or by right-clicking on a free area of ​​the screen.

![](/files/D0S1Iuj1AeATHrmw5C6N)

The action block menu contains an input value, a message template, a filter, and a variable to write the data to.

![](/files/WI0TcORKVFFiQ9gQBzM8)

The "Input Value" field is an indication of any string from which to extract. &#x20;

{% hint style="info" %}
If you specify the %message% variable as the input value when performing the action, the bot will take data from the subscriber's last message
{% endhint %}

Start typing the pattern and the filters will appear.

![](/files/K2BSnKbqeESBeoDOHENX)

You can specify one of the filters and its settings, and then set a variable in which to write the received data.&#x20;

In addition, you can set *any string format* and extract the necessary data from its parts using a template.


---

# 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.smartbotpro.io/scripts/actions/extract-data.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.
