Working with variables
How to get client variable values
get_client_var() | get_client_vars()
Description
To get the value of a single variable
get_client_var(client_id, variable)
Parameters: ! client_id - client ID ! variable - variable name
To get the values of multiple variables
get_client_vars(client_id, names)
Parameters: ! client_id - client ID ! names- array of variables
Example
Let's send the manager a message with the lesson number that one of the participants in our project is taking:


The same option, but with output, for example, of the level and the lesson within it:


Code example for copying
/*Getting a single variable*/
trial=get_client_var(64732310, 'lesson')
/*Getting multiple variables*/
names=["level","lesson"]
trial=get_client_vars(64732310, names)How to assign a client variable
set_client_var() | set_client_vars()
Description
To assign a single variable value
set_client_var(client_id, variable, value)
Parameters:
client_id — MaviBot client ID variable — a name of the variable to be assigned value — the variable value
To assign multiple variables
set_client_vars(client_id, variables_dict)
Parameters:
client_id — MaviBot client ID variables_dict — dictionary; contains all variable names and their values to be added. Format: '{"var_name1": "var_value1", "var_name2": "var_value2", "var_name3": "var_value3"}'
Last updated



