> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/feature/other/conversation-script-variables.md).

# Conversation script variables

## Overview

In conversation scripts, in addition to the "Live Chat" channel, you can control the conversation flow by setting script variables externally. In addition, there are many default conversation variables available. These default variables can be used during the conversation process to personalize and customize your responses.

These default conversation variables can cover related information such as the user's name and the customer's name. You can provide more personalized and timely responses based on these variables. Likewise, these variables can also be used in "Webhook Conversation Scripts" for call forwarding.

By setting script variables and using default conversation variables, you can customize conversation scripts according to your needs and context to provide a better user experience and solution. Whether in Live Chat or through a Webhook, these variables can help you create more personalized and interactive conversations.

{% hint style="warning" %}
**⚠️ Notes on Using Variables**

Please note that**variables do not always have corresponding values in all scenarios**, and actual availability depends on the usage scenario and source conditions:

1. **`contact_*` related variables**: A named Contact record must already be created or associated, otherwise the corresponding value cannot be brought in.
2. **`page_*` related variables**: Only generated when the user enters through**Live Chat**, and is used to track information such as the source page.
3. **`contactable_liff_user_id`**: Only available in scenarios where **LINE LIFF** is integrated and**Live Chat is used to start**. Other channels or cases where LIFF is not enabled will not have a value.
   {% endhint %}

## Default Variables

| Variable                    | Name                              | Description                                                                                                               |
| --------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| queue.length                | Number of people waiting in queue | The current total number of people waiting and being assigned in the conversation queue.                                  |
| page.url                    | Source page URL                   | The URL of the page from which the live chat customer came.                                                               |
| page.title                  | Source page title                 | The title of the page from which the live chat customer came.                                                             |
| contactable\_user\_id       | Incoming source identifier        | The identifier corresponding to the incoming source, such as the ID used for LINE or Facebook Messenger API verification. |
| contactable\_username       | Incoming source user name         | The display name of the user corresponding to the incoming source, such as the profile name on LINE or Facebook.          |
| contactable\_liff\_user\_id | LIFF user ID                      | If LIFF is integrated through Live Chat, you can use this variable to obtain the LIFF user's user ID.                     |
| session\_id.session\_id     | Script Session system code        | When each conversation enters the script, a unique code will be automatically generated for identification.               |
| contact.id                  | Customer system ID                | The customer system ID associated with the incoming source.                                                               |
| contact.name                | Customer name                     | The customer name associated with the incoming source.                                                                    |
| contact.first\_name         | Customer last name                | The customer's last name associated with the incoming source.                                                             |
| contact.last\_name          | Customer first name               | The customer's first name associated with the incoming source.                                                            |
| contact.membership\_no      | Customer membership number        | The customer membership number associated with the incoming source.                                                       |
| contact.identity\_no        | Customer ID number                | The customer's ID number associated with the incoming source.                                                             |

<figure><img src="https://3300265106-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MNRu7dk70ei7JV9HlW9%2Fuploads%2FXV5Zvnp8FPdHNjRsL440%2Fimage.png?alt=media&amp;token=dcfd174a-b25f-4cfb-9704-67ab209a9a44" alt=""><figcaption></figcaption></figure>
