# More about scripts

Brief video instruction for this section:

{% embed url="<https://www.youtube.com/watch?v=hdMlUPyUma8>" %}

After you have registered with the service, you will have access to a test script - onboarding.

{% hint style="info" %}
**Script** is a sequence of steps that the bot performs in response to events, such as an incoming message in a messenger, joining a group on a social network, or paying for an item in your online store.
{% endhint %}

Go to script. You will see a graph of the bot's dialogue with the subscriber:

![](/files/Sp1TsKOQyuHUkKiHKWnX)

Script has *events* and *actions*

An event is an external influence that the bot can respond to. For example, the receipt of a message from a subscriber. An action is a step that the bot performs in response to an event.&#x20;

{% hint style="info" %}
**An event** is an external influence that the bot can respond to. For example, the receipt of a message from a subscriber
{% endhint %}

{% hint style="info" %}
**An action** is a step that the bot performs in response to an event&#x20;
{% endhint %}

Look at the generated script. It has several events (they are highlighted in blue) and arrows leading from them to actions:

![](/files/S5E55crXDkuVGZxxOPGF)

In the example above, you can see 2 events "message is similar to hello" and "message is equal to acquaintance". This means that the user can get into this scenario if they write the message "hello" or "acquaintance". Moreover, depending on the message, it will fall into different chains.&#x20;

{% hint style="info" %}
**A chain** is an event and the actions that follow it within a script.
{% endhint %}

![](/files/M0Mhd30OG63upbQj5B8c)

Smartbot works on a simple principle:&#x20;

If at the moment the user is not in any of the chains, then at the time of the event (for example, a message from the user has arrived), smartbot will look for a suitable scenario and launch the desired chain.


---

# 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.smartbotpro.io/beginning-of-work/more-about-scripts.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.
