Text variables allow you to customize various aspects of your platform

Text variables allow you to insert chat information into various configuration elements. For example when you compose new e-mails with the E-Mail integration.

This page lists all the available variables that are available as well as the options available when using them.

Using a variable

To insert a variable you just need to include the variable within curly braces. For example:

{{chat.visitor_name}}

This can be inserted in any field that includes the variable symbol to the right of the input.

Available variables

The following variables are available. Any entries which end with ... are relationships which means you can use any of the variables from the appropriate object here too.

{{chat.uuid}}
{{chat.status}}
{{chat.last_message_at}}
{{chat.created_at}}
{{chat.city}}
{{chat.country}}
{{chat.ip_address}}
{{chat.user_agent}}
{{chat.country_code}}
{{chat.closed_at}}
{{chat.accepted_at}}
{{chat.assigned_at}}
{{chat.messages_count}}
{{chat.time_to_acceptance}}
{{chat.time_to_closure}}
{{chat.initiator}}
{{chat.rating}}
{{chat.visitor_name}}
{{chat.account...}}
{{chat.visitor...}}
{{chat.site...}}
{{chat.department...}}
{{chat.user...}}
{{chat.last_message...}}
{{chat.anonymous_animal...}}
{{site.uuid}}
{{site.name}}
{{site.token}}
{{site.transcript_from_name}}
{{site.transcript_from_address}}
{{site.initials}}
{{site.average_time_to_acceptance}}
{{site.primary_color}}
{{site.primary_contrast_color}}
{{site.tray_color}}
{{site.tray_contrast_color}}
{{site.account...}}
{{account.uuid}}
{{account.name}}
{{account.subdomain}}
{{account.domain}}
{{account.domain_with_protocol}}
{{department.uuid}}
{{department.name}}
{{department.account...}}
{{user.uuid}}
{{user.first_name}}
{{user.last_name}}
{{user.full_name}}
{{user.display_name}}
{{user.email_address}}
{{user.avatar_url}}
{{user.status}}
{{user.account...}}
{{anonymous_animal.name}}
{{anonymous_animal.avatar_url}}
{{anonymous_animal.display_name}}
{{visitor.uuid}}
{{visitor.name}}
{{visitor.email_address}}
{{visitor.avatar_url}}
{{visitor.chats_count}}
{{visitor.total_chat_duration}}

Fallback

If a requested value isn't available, the default behaviour will just do nothing and you'll just see your interpolation in the result.

However, you can add a fallback value to any object which will returned if the variable requested doesn't exist or a formatter (see below) is not suitable. This is achieved by simply adding your fallback string as shown below:

You live in: {{chat.city| unknown city}}

If at any point it cannot determine a value for a given interpolation, it will simply return do nothing.

Formatters

Natterly also includes support for formatting of inserted data. For example:

Hello {{chat.visitor_name.upcase}}

If any errors occurred while trying to format a value, it will return a '???' string.

Built-in formatters

Strings

  • downcase - converts all letters to lowercase
  • upcase - converts all letters to uppercase
  • humanize - capitalizes the first letters and downcases all others
  • sha1 - returns a SHA1 hash for the value
  • md5 - returns an MD5 hash for the value

Numerics

  • double - doubles the value
  • triple - triples the value

Arrays

  • join_with_commas - joins all values of array with commas
  • join_with_spaces - joins all values of array with spaces
  • join_with_new_lines - joins all values of array with new lines
  • to_sentence - joins all values of array into a sentence
  • as_list - creates a "bulleted" list of all items

Date/timestamps

  • long_date - Sunday 23rd October 1960
  • long_date_without_day_name - 23rd October 1960
  • short_date - Fri 30 Jan 2015
  • short_date_without_day_name - 30 Jan 2015
  • ddmmyyyy - 23/10/1960
  • hhmm - 14:52
  • hhmmss - 14:52:10
  • hhmm12 - 02:52pm
  • hhmmss12 - 02:52:10pm
Car left 1 Car left 2 Car left 3 Car left 4 Car right 1 Car right 2 Car right 3
Windmill Windmill Windmill