# Variables

In BJS we have useful global variables.

| **Variable**                                                         | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>tgUpdate</p><p></p><p><em>Old name: request (deprecated)</em></p> | <p>it is collection with a lot of data. You can see it by: </p><p><code>Bot.inspect(tgUpdate)</code></p><p></p><p>All fields available <a href="https://core.telegram.org/bots/api#update">here</a>. All field will be in request.<br><br>With tgUpdate you can track all updates. <a href="../always-running-commands#all-updates">Read more</a></p>                                                                                                                                                                                                                            |
| message                                                              | current message from user - string                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| user                                                                 | <p>user who sent a command or text. </p><p></p><p><strong>Fields:</strong> <br>id (BB id), </p><p>telegramid (telegram id),</p><p>first\_name,</p><p>last\_name,</p><p>username, </p><p>created\_at,</p><p>updated\_at,</p><p>just\_created (true for new user or false for already exist. </p><p><strong>User must be totally new</strong> in BB! He is old if he start <strong>any</strong> BB bot before)<br><br><strong><code>Can be blank:</code></strong></p><p>first\_name, last\_name, username <br></p>                                                                 |
| chat                                                                 | <p>data for current chat. </p><p></p><p><strong>Fields:</strong> </p><p>id (BB id), </p><p>chatid (telegram chat id), </p><p>bot\_id, </p><p>title, </p><p>chat\_type (can be: "private", "group", "supergroup"), </p><p>user\_id, </p><p>created\_at, </p><p>updated\_at, </p><p>just\_created - <code>true</code> for new (just created) chat or <code>false</code> for already exist</p><p></p><p><strong><code>Note:</code></strong></p><p>BB delete blocked chats after 6 months. If user start blocked bot after 6 months this chat have just\_created field again<br></p> |
| bot                                                                  | <p>data for bot. </p><p></p><p><strong>Fields:</strong> </p><p><code>id</code>, </p><p><code>name</code>, </p><p><code>token</code>, </p><p><code>created\_at</code>, </p><p><code>updated\_at</code>, </p><p><code>csv\_url</code>, </p><p><code>last\_run\_at</code>, </p><p><code>store\_bot\_id</code>, </p><p><code>status</code></p>                                                                                                                                                                                                                                       |
| command                                                              | <p>data for command. </p><p></p><p><strong>Fields:</strong> </p><p><code>id</code>, </p><p><code>name</code>, </p><p><code>folder</code>, </p><p><code>need\_reply</code>, </p><p><code>auto\_retry\_time</code>, <code>last\_auto\_retry\_at</code>, <code>created\_via\_csv\_import</code>, <code>last\_csv\_import\_at</code>, </p><p><code>created\_at</code>, </p><p><code>updated\_at</code></p>                                                                                                                                                                           |
| params                                                               | command parameters - text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| owner                                                                | information about bot owner: email, id and etc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| completed\_commands\_count                                           | the count of previously completed commands on `Bot.runCommand` calls. Can be used for [security](https://help.bots.business/scenarios-and-bjs/bjs-security#use-completed_commands_count-variable)                                                                                                                                                                                                                                                                                                                                                                                |
| iteration\_quota                                                     | current quota information: limit, progress and etc. You can see it by `Bot.sendMessage( inspect(iteration_quota) )`                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| payment\_plan                                                        | current bot owner payment plan information                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| BB\_API\_URL                                                         | api url: api.bots.business. Each Cloud have own Api Url                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |

###

### You can inspect any variable for debug

```
Bot.sendMessage( inspect(user) )
Bot.sendMessage( inspect(chat) )
```
