Luma provides a set of pre-defined functions that enable Administrator/Developer to parse, process and modify user text response or JSON response received by the system. The modified response can be used to configure payload to execute an action/skill.
These functions are available in ‘Skill builder’ module and can be invoked by typing ‘@fn.’ on Text Response field on ‘Skill Builder’ screen.
Below are the available functions:
‘Split’ function can be used to split a text or JSON response into smaller strings while building a skill. On ‘Skill Builder’ page- Text Responses section, use @fn.split function to split a string in an attribute at a specified position.
In the above example, ‘John@test.com'. The string is split at the character ‘@’ starting from location ‘’, which is the start of the string. The result string is 'John’.
‘Substring’ function extracts characters from a text string to create another string. The function selects characters between specified locations and returns the same as a new string. On ‘Skill Builder’ page- Text Responses section, use @fn.substring function to select a substring from an attribute value.
In the above example, ‘Serviceaide'. Substring is selected starting at location ‘’ till character at location  (i.e. string length (11)-4 ). The result is 'Service'
‘Replace’ function replaces characters specified by location in a given text string with another text string. On ‘Skill Builder’ page- Text Responses section, use @fn.replace function to replace a part of the text response with another string. Note that the function does an exact match and is case sensitive.
RandomNumber function generates a 4-digit random number that can be saved in an attribute for later action while building skills. Random numbers are mostly used for user authentication and verification. For example, OTP generation used for user authentication.
On Skill Builder page- Text Responses section, use @fn.randomNumber function to generate a 4 digit random number.