Builder variables December 17, 2024 11:04 Updated Index: Context Variables User Variables Configuration Variables System variables Blip Desk Service Variables Sensitive Variables When setting up your application in Builder, it may be necessary to store inputs in variables. This is essential for building conditional flows, or for simply storing / retrieving inputs throughout user interaction. At any point in the conversation flow, you can retrieve the input of any previously defined variable. In contrast, it is only possible to store inputs in a variable in specific Builder locations, such as: User data entry (in the control and content blocks); Results of API requests; Result of executing a script; Global configuration variables screen. A builder variable is formed exclusively by a sequence of alphanumeric characters (uppercase or lowercase), and special characters are not allowed. All variables are case-sensitive. There are four types of variables in Builder: Context variables, user variables, configuration variables and system variables. Check out each one: Context Variables In a conversation between two or more people, we unconsciously build a context. For example: in a casual encounter between two friends, Mary and John, one of them starts talking about his dog. Upon meeting John, Mary says: - Hi John, how are you? John then replies: - Hello Mary, everything is great. Today I'm radiant, I just got a cute puppy. Right after the first contact, Mary starts asking questions about the John’s puppy: - Cool! What is his name? John promptly replies: - His name is Toby. Notice that, in Maria's speech, there is no explicit connection between the phrase “what is his name?” and John's dog. The connection between the possessive pronoun “his” and John's dog is only noticeable due to the context of the conversation - the two friends know that, at first, they were talking about John's dog. The context variables allow the storage / retrieval of inputs related to the subjects discussed between the user and the bot. It is possible to store inputs in a context variable through the user input and HTTP contents, in addition to HTTP request actions, script execution, definition of variables and processing of commands. To retrieve the inputs of a context variable, just use the following pattern at any point in the conversation flow: {{context.VariableName}} Or just {{variableName}} Where: variableName represents the name of the desired context variable. User Variables Every user who talks to a bot built in Blip has an account (Contact). Contact is a structure that stores attributes (information) of the user depending on the channel (messaging application) that he uses. For example: any Facebook Messenger user who contacts your bot will already have basic and public information, such as name and URL of the profile picture defined in your account. User variables make it possible to use any information defined in the users' account in a simple way. For full details on how Blip Contact information is stored, check the directory extension at this link (https://docs.blip.ai/#directory). To retrieve the input of a user variable, just use the following pattern at any point in the conversation flow: {{contact.VariableName}} Where: variableName represents the name of the desired contact variable. If you want to send a greeting message with the name of the user who is interacting with your bot, use the {{contact.name}} variable for this. For example: “Hello {{contact.name}}, welcome!” The table below presents all contact variables available in Blip and a description of what they represent. The inputs and availability of the data depends on the user's channel. Name of Variables Description name The name of the contact address The contact's address city The city of contact. email The contact's email. source The channel name of the contact. phoneNumber The contact's phone number. photoUri The URI of the contact's public photo. cellPhoneNumber The contact's cell phone. gender The sex of the contact. timezone The GMT contact timezone. culture The user's culture information (in IETF format). extras A generic JSON to store pairs of strings (key and value). identity The contact's identity in the name @ domain format. Mandatory ownership group Indicates the name of the group to which the user belongs * Note: Some channels do not provide any contact information other than their identifier, defined by the {{contact.identity}} variable. Configuration Variables Configuration variables make it possible to store general-purpose configuration inputs. Imagine, for example, that the conversation flow performs 10 HTTP request actions for the same endpoint API https://myapi.com. In this scenario, it is possible to create, for example, an endpoint configuration variable with the input https://myapi.com and reuse this variable in all 10 actions of the flow. If your API address changes, just change the input of the variable. To create or change the input of any configuration variable, click on the Builder settings, expand the option Configuration variables and add the name and input of the variable. To recover the input of a configuration variable, just use the following pattern, anywhere in the conversation flow: {{config.VariableName}} Where: variableName represents the name of the desired configuration variable. System variables The system variables provide a lot of flexibility for those who are developing the bot. Through them, it is possible to know information such as calendar inputs (time and date), the user's last entry, in addition to unique identifiers, numbers and random strings. To recover the input of a system variable, just use, at any point in the conversation flow, one of the following patterns: {{variableName}} Where: variableName represents the name of the desired configuration variable. If you want to send a random number to a customer who is interacting with your bot, use the {{random.integer}} variable for this. For example: “Your random number is: {{random.integer}}!” The sheet below presents all the system variables available in Blip, in addition to a description of what they represent. Variable Name Description application.domain Domain on which the bot application is running (usually 'msging.net') application.identifier Unique identifier of the bot application application.identity Bot application identity (same as 'identifier @ domain') application.instance The bot application node instance application.node The bot application node (same as 'identifier @ domain / instance') calendar.datetime Current date and time GMT-0 (MM / dd / yy HH: mm: ss). calendar.date Current date GMT-0 (in yyyy-MM-dd format). calendar.day Value representing the day in the current month. calendar.month Value representing the current month. calendar.year Value representing the current year. calendar.time Current time GMT-0 (in HH format: mm). calendar.hour Value representing the current time. calendar.minute Value representing the current minute. calendar.second Value representing the second current. calendar.unixTime Current date in unix timestamp format calendar.unixTimeMilliseconds Current date in unix timestamp format (milliseconds). calendar.dayOfWeek Value that represents the day of the current week (where 0 is Sunday and 6 is Saturday). calendar.tomorrow.datetime Tomorrow's date and current time GMT-0 calendar.tomorrow.date Tomorrow's date GMT-0 calendar.tomorrow.day Value representing tomorrow in the current month. calendar.tomorrow.month Value representing the month of tomorrow's date calendar.tomorrow.year Value representing the year of tomorrow's date calendar.tomorrow.time Current time on tomorrow's GMT-0 date. calendar.tomorrow.hour Value representing the current time on tomorrow's date calendar.tomorrow.minute Value representing the current minute on tomorrow's date calendar.tomorrow.second Value that represents the second current on tomorrow's date. calendar.tomorrow.unixTimeMiliseconds Tomorrow's date in unix timestamp format (milliseconds) calendar.tomorrow.unixTime Tomorrow's date in unix timestamp format calendar.tomorrow.dayOfWeek Value representing the day of the week of tomorrow's date (where 0 is Sunday and 6 is). calendar.yesterday.datetime Yesterday's date and current time GMT-0 calendar.yesterday.date Yesterday GMT-0 calendar.yesterday.day Value representing yesterday in the current month calendar.yesterday.month Value representing the month of yesterday's date calendar.yesterday.year Value representing the year of yesterday's date calendar.yesterday.time Current time on yesterday GMT-0 calendar.yesterday.hour Value representing the current time on yesterday's date calendar.yesterday.minute Value representing the current minute on yesterday's date calendar.yesterday.second Value representing the second current on yesterday's date calendar.yesterday.unixTime Yesterday's date in unix timestamp format calendar.yesterday.unixTimeMiliseconds Yesterday's date in unix timestamp format (milliseconds) calendar.yesterday.dayOfWeek Value representing the day of the week from yesterday's date (where 0 is Sunday and 6 is Saturday) input.content Content of the message sent by the user input.entity.?.id Identifier of the recognized entity (where? Should be replaced by the name of the entity) input.entity.?.name Name of the recognized entity (where? Should be replaced by the name of the entity) input.entity.?.value Value of the recognized entity (where? Should be replaced by the name of the entity) input.entity.?.name Name of the recognized entity (where? Should be replaced by the name of the entity) input.intent.id Recognized intention identifier input.intent.name Recognized intention name input.intent.score Reliability tied to recognized intent input.intent.answer One of the responses linked to the recognized intention input.length Number of contents in the message sent by the user input.type Type of message sent by the user input.message Message envelope received by the bot input.message.from Originator node of the received message input.message.fromidentity Identity of the originator of the received message input.message.id Received message id input.message.pp Node of the originator of the received message, in case of delegated messages input.message.ppidentity Identity of the originator of the message received, in the case of delegated messages input.message.to Receiver node of the received message (usually the bot application node) input.message.toidentity Identity of the recipient of the received message (usually the identity of the bot application) random.guid Unique alphanumeric identifier random.string Random character set random.integer Random integer calendar.plus/minus 12345 (milisseconds seconds minutes hours days weeks months years dayOfWeek) Available date manipulation functions state.id Current block id in flow state.name Name of the current block in the stream state.previous.id Previous block id in the stream state.previous.name Previous block name in the stream tunnel.destination Tunnel recipient, which is usually the identity of the bot application. Available only for tunnel messages (forwarded by a router, for example). tunnel.identity Tunnel identity. Available only for tunnel messages (forwarded by a router, for example). tunnel.originator Tunnel originator node, which is the customer's identifier in the tunnel owner. On a router, it is the customer's original identifier. Available only for tunnel messages (forwarded by a router, for example). tunnel.owner Identity of the tunnel owner. On a router, it is the identity of the router's application. Available only for tunnel messages (forwarded by a router, for example). Note: System variables are read-only Blip Desk Service Variables The Blip Desk attendance variables can be used in ready-made responses to present information inherent to the attendant. Therefore, it is possible to know the attendant's full name, e-mail, identity and telephone number. Find out how to apply these variables in the article using variables in the Blip Desk ready responses. Variable Name Description agent.identity The agent's identity in the name @ domain format. agent.fullName The name of the agent. agent.email The agent's email. agent.phoneNumber The agent's phone. agent.firstName Only the agent's first name Sensitive Variables Sensitive variables make it possible to store secret values for use in Builder. Imagine, for example, that in the conversation flow it is necessary to make an HTTP request to an API in which it is necessary to send an access token. In this scenario, it is possible to create, for example, a sensitive variable with the name Token and the desired token value and reuse this variable in flow requests. After creating the variable, its values are suppressed for greater data security. If you just want to change the value, enter it again in the designated field. If you want to change the key name, adjust the name and also re-enter the desired value. To create or change the value of any sensitive variable, click on the Builder settings, expand the Sensitive variables option and add the name and value of the variable (as shown in the image below). To use sensitive information in the flow, use: {{secret.nomeVariavel }} Where: variablename represents the name of the desired sensitive variable. For more information, visit the discussion on the subject in our community or the videos on our channel. 😊 Related articles Exit Conditions in the Builder How to Use Variables in Blip Desk Canned Responses Sending WhatsApp Active Messages on Blip Desk Active Messages - Error Codes Audience file configuration - Bulk notification sending