Special expressions & system variables

Special expressions & system variables

Here you can find information on system variables, special expressions and syntax that you can use as user input or in bot-answers.

System variables

System variables are predefined and contain user and chat-related information. They can be used in conditions or in bot answers.

  • $profile_name$ contains the profile name of a user defined in a messenger
  • $profile_number$ shows user’s telephone number (WhatsApp) or user ID (Facebook, Telegram, Apple Business Chat, Viber, Notify)
  • $profile_link$ holds a personal profile link
  • $profile_messenger$ contains information about the messenger that a user contacted your channel through, for example:
    • FB for Facebook
    • WB for WhatsApp Business
    • IM for Apple Messages for Business
    • IG for Instagram
    • TG for Telegram
    • VI for Viber
    • LC for (Live) Web Chat
    • IN for Notify

  • $profile_status$ contains current MIA-registration status of a user (1- active; 0 – inactive)
  • $profile_current_topic$ holds information about currently activated chatbot topic
  • $chat_text$ temporary variable that holds the last chat sent by a user
  • $chat_text_lower$ temporary variable that holds the last chat send by a user, saved in lower case
  • $chat_attachment_url$ temporary variable that holds a link to the last attachment sent by a user
  • $chat_timestamp$ temporary variable that saves timestamp of the last user chat
  • $ticket_id$ holds id of a currently opened user ticket or a ticket that can be potentially reopened on the basis of temporal settings defined in Settings/Channel/Settings “reopen ticket after contact within”. If no current ticket exists for a user, the variable contains a user id
  • $ticket_closed$ holds the timestamp of closing of the last user ticket. Returns 0 if currently an open ticket exists for the user; -1 if no ticket was ever opened for the user
  • $ticket_agent_firstname$ holds the first name of the agent to whom a user ticket is currently assigned (precondition: there should currently exist an open ticket of a user and it should be assigned)
  • $ticket_agent_lastname$ holds the last name of the agent to whom a user ticket is currently assigned (precondition: there should currently exist an open ticket of a user and it should be assigned).

Standard variables

Special expressions to be used as user input

The following special expressions can be set as user input in order to respond to specific actions:

  • * is a wildcard. Dialogues created with a * as user input prompt the same bot answer for every input.
  • __start  – sets up a welcome message for new users. This is an alternative way to setting up a welcome message in setting. Creating a welcome message in chatbot builder gives you more flexibility and allows to send welcome messages with pictures and (depending on Messengers) buttons, or posting several messages one after another.
  • ­­­­__start_mia  – for MIA-users only: sets up an welcome message for new subscribers to your MIA news service
  • ­­__stop – for MIA-users only: sets up a MIA-unsubscription confirmation
  • __img – makes it possible for the Bot to recognize photos as user input and to respond. For audio messages there is the trigger __audiofor video respectively __video  and __pdf for PDF-documents.
  • “word” – use quotation marks for telling the bot that only one exclusive word or string should trigger an action. When this word or string is part of a sentence, nothing should happen. e.g. the user question contact should trigger the bot response with the contact options, whereas thanks for your nice contact should not trigger a message.

Special syntax to use within bot-answers

The following operations can be executed if defined as part of bot-answer by means of a special syntax:

  • Delete all set values for all variables: $clear_variable$
  • Delete all set values for all variables and themes: $clear_all$ 
  • Delete the value of the specific variable: $clear_variablename$  (for example, clear value of the variable “age” $clear_age$)
  • Increment by one: $variablename++$ . For instance, $counter++$ increases the value of the variable  $counter$ of type number by 1.
  • Set value of a numeric variable: $variablename=number$, e.g., variable $counter$ will be set to a new value of 3:  $counter=3$
  • Set value of a variable of type text/word: $variablename=”text”$ , e.g., variable $mycolor$ will be set to a new value “blue”:  $mycolor=”blue”$
  • Assign a variable a value from another variable: $variablename2=$variablename1$$  ($variablename1$  gets a value of  the variable $variablename2$,  see also an example in the next paragraph)
  • Concatenate variables: $variablename_res+=$variablename1$$. For instance, for every user we would like to generate a login ($login$) on the basis of already set variables $name$ and $favouritenumber$. In the first step we will assign variable $login$ the value from variable $name$ as follows: $login=$name$$. In the second step, we shall concatenate variable $login$ with the variable $favouritenumber$: $login+=$name$$ .
  • Compute a value of a numeric variable: $variablename=(YOUR FORMULA)$. For instance, the average of the two numeric variables, $number1$ and $number2$ can be computed and saved as a variable $average$ as follows:   $average=(($number1$+$number2$)/2)$