> For the complete documentation index, see [llms.txt](https://help.wotnot.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.wotnot.io/build/action-blocks/set-variable.md).

# Set variable

The Set Variable action block lets you assign a specific value to a variable during a conversation flow. As the name suggests, you can define or update a variable with a new value at any point in the chat.

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

## Why use the Set Variable block?

Variables are powerful because they allow you to store information, pass it between steps, and personalize the conversation. The Set Variable block makes it easy to:

* **Control logic in the flow** – Define flags or states (e.g., mark if a user is a “qualified lead”).
* **Pass data to integrations** – Pre-set values that need to be sent to your CRM, helpdesk, or other systems.
* **Simplify expressions** – Store a reusable value instead of repeating it in multiple places.
* **Personalize experiences** – Assign values like “plan = Premium” or “status = Returning Visitor” to tailor responses.

## Where can it be used?

You can use the Set Variable block in a variety of situations, such as:

1. **Lead qualification**
   * Example: If a user selects “Company Size = 500+,” you can set a variable lead\_segment = Enterprise.
   * This makes it easier to filter and route leads later.
2. **Conversation routing**
   * Example: Set support\_priority = High if the user reports an urgent issue.
   * You can then use this variable in assignment or branching rules.
3. **Default values**
   * Example: When no data is captured from the user, you can set a variable like region = Unknown.
4. **Experimentation & tracking**
   * Example: For A/B testing different flows, set test\_group = A or test\_group = B.

## How to configure the block

1. Drag and drop the Set Variable action block into your flow.
2. Choose the variable you want to set (or create a new one).
3. Enter the value you want the variable to hold.
4. Connect it to the next step in the conversation.

{% hint style="info" %}
**NOTE:**&#x20;

* You can use variables to map values to variables.
* You can use arithmetic operators to define values as well.
  {% 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://help.wotnot.io/build/action-blocks/set-variable.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.
