Templates Functions Guide
Template functions enable you to add dynamic functionality within Text Messages in Studio, automated responses, Base Prompts, and Restriction Texts by using default variables and helper methods
Available Variables
YourGPT provides several default variables you can use in your templates to personalize responses:
FLOW.last_response
FLOW.last_utterance
FLOW.{variable_of_your_choice}
SESSION.status
SESSION.chat_mode
SESSION.state
VISITOR.name
VISITOR.region
VISITOR.language
VISITOR.browser
VISITOR.os
VISITOR.status
CONTACT.name
CONTACT.email
CONTACT.phone
CONTACT.company
CONTACT.country
CONTACT.city
CONTACT.region
CONTACT.tags
Available Functions
YourGPT provides several default functions that can be used in templates to enhance functionality and customize responses:
eq(a, b)
- Returns true ifa
equalsb
.gt(a, b)
- Returns true ifa
is greater thanb
.lt(a, b)
- Returns true ifa
is less thanb
.
and(...args)
- Returns true if all arguments are truthy.or(...args)
- Returns true if at least one argument is truthy.not(value)
- Returns the negation of the provided value.
uppercase(str)
- Converts a string to uppercase.lowercase(str)
- Converts a string to lowercase.trim(str)
- Removes whitespace from both ends of a string.concat(...args)
- Joins multiple strings into one.
isset(value)
- Returns true if the value is not undefined or null.includes(data, searchValue)
- Checks ifdata
containssearchValue
(works with strings, arrays, and objects).
date(date, format, timezone)
- Formats a date according to the given format and timezone.day(date, timezone)
- Returns the day of the week for a given date.
json stringify(context)
- Converts a context object into a JSON string.
safeHTML(str)
- Marks a string as safe for HTML rendering.
How to Setup
- Base Prompt:

- Inside Chatbot Studio:

- Using With Automated Response
Working with Date Formats
- Short Date:
{{date format="MM/DD/YYYY"}}
→ 12/19/2024 - Long Date:
{{date format="MMMM Do, YYYY"}}
→ December 19th, 2024 - Day Only:
{{date format="dddd"}}
→ Thursday
✅ What to Do
- Use correct tags like
{{/if}}
. - Check if the variable exists in your data.
- Verify spelling and case (uppercase/lowercase matters).
❌ What to Avoid
- Don’t leave tags incomplete; it will break the template.
- Don’t use curly quotes (
“”
); always use straight quotes ("
). - Don’t ignore typos—they are a common cause of errors.
- Don’t add spaces in conditions where they don’t belong.