> For the complete documentation index, see [llms.txt](https://happytalk.gitbook.io/happybot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://happytalk.gitbook.io/happybot/block_scenario/block/buttonblock/variable.md).

# \[버튼] 변수 설정

***

## 1. ![](/files/BQZiE4sJTYNpAfG70dJo) '변수'설정' 블럭이란?

{% hint style="success" %}
챗봇 진행 중에 버튼 파라미터 혹은 고객 입력을 통해 변수 부여가 가능합니다. \
하지만, 상황에 따라서는 이 방법을 통해 변수 부여가 불가능한 경우가 있을 수 있습니다.

이런 경우 변수 설정 블록을 추가하여, \ <mark style="color:green;">**블록을 지나가기만 해도 변수를 부여할 수 있는 기능을 가진 블럭**</mark>입니다.
{% endhint %}

<figure><img src="/files/sliLkxugbFNT5sRI3NWH" alt=""><figcaption><p>부서를 선택하면 회사 이름이 자동으로 입력되는 시나리오의 예</p></figcaption></figure>

***

## 2. 블럭의 형태 및 사용 방법

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

<table><thead><tr><th width="206">No</th><th width="178">구분</th><th width="71">필수</th><th>설명</th></tr></thead><tbody><tr><td>①</td><td>블럭 타이틀</td><td>X</td><td><ul><li>40자 이하 입력/수정 가능 </li><li>생성 시 “<em>변수 설정 {No}</em>” 형태로 생성 됨</li></ul></td></tr><tr><td>②</td><td>설정된 변수 개수</td><td>O</td><td><ul><li>설정한 변수 개수 표기</li></ul></td></tr><tr><td>③</td><td>서브 블럭 연결 버튼</td><td>O</td><td><ul><li>해당 블럭과 연결될 블럭을 블럭 편집 창 or 마우스 Drag&#x26;Drop으로 연결 가능</li></ul></td></tr><tr><td>④</td><td>블럭 간략 설정 버튼</td><td>-</td><td><ul><li>클릭 시 아래 액션이 가능한 버튼 레이어 노출 <br>a. 미리보기 <br>b. 복제하기 <br>c. 내용접기 <br>d. 블럭 삭제</li></ul></td></tr></tbody></table>

***

#### **👉 따라 해 보세요!**

### <mark style="color:orange;">※ 변수 생성 방법</mark>

> 1\) 먼저 회사 이름과 부서 이름을 저장할 변수를 생성합니다.

![](/files/gbHFld1c8RTLJTgFTpxK)

> 2\) 텍스트 카드 블록에서 버튼 클릭 시 부여할 변수와 변수 값을 설정합니다. \
> 각 버튼에 dept(부서) 변수를 연결하고, 부서 이름을 변수 값으로 저장합니다.

![](/files/ikYO5DV2M58SckONIxUV)\ <br>

> 3\) 변수 설정 블록에서 부여할 변수와 변수 값을 설정합니다. \
> \
> 시나리오 흐름 안에서 이 블록을 지나가게 되면, 설정해둔 변수에 변수 값이 저장됩니다. \
> 이 블록에는 company(회사) 변수를 연결하고, 이 블록을 지나가면 자동으로 변수 값이 저장됩니다.

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

> 4\) 텍스트 카드 블록에서 변수 설정이 잘 되었는지 화면에 보여지게 설정합니다.\
> &#x20;블록의 메시지 내용에 {{  }}를 사용하여 변수를 적으면 해당 변수의 값이 화면에 보여집니다.

> 5\) 실제 봇에서 제대로 작동하는 지 체크합니다.

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


---

# 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://happytalk.gitbook.io/happybot/block_scenario/block/buttonblock/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.
