Back to User Guide

Macro Variables

Use dynamic variables to personalize macro responses automatically.

How Variables Work

Variables are placeholders that get replaced with real data:

Hello {{customer.first_name}},     →    Hello John,

When you apply a macro, the system:

  1. Finds each variable
  2. Looks up the actual value
  3. Replaces the placeholder
  4. Shows you the final text

Available Variables

Customer Variables

VariableDescriptionExample
{{customer.first_name}}Customer's first nameJohn
{{customer.last_name}}Customer's last nameSmith
{{customer.name}}Full nameJohn Smith
{{customer.email}}Email addressjohn@example.com
{{customer.phone}}Phone number+1 555-0123
{{customer.company}}Company nameAcme Corp

Ticket Variables

VariableDescriptionExample
{{ticket.id}}Ticket number12345
{{ticket.subject}}Subject lineOrder #5678 question
{{ticket.status}}Current statusOpen
{{ticket.priority}}Priority levelHigh
{{ticket.created_at}}Creation dateJan 15, 2025
{{ticket.channel}}Source channelEmail

Agent Variables

VariableDescriptionExample
{{agent.first_name}}Your first nameSarah
{{agent.last_name}}Your last nameJones
{{agent.name}}Your full nameSarah Jones
{{agent.email}}Your emailsarah@company.com

Organization Variables

VariableDescriptionExample
{{org.name}}Organization nameRelay Support
{{org.support_email}}Support emailhelp@relay.com

Date Variables

VariableDescriptionExample
{{date.today}}Today's dateJanuary 15, 2025
{{date.tomorrow}}Tomorrow's dateJanuary 16, 2025
{{date.weekday}}Day of weekWednesday

Fallback Values

Handle missing data with fallbacks:

{{customer.first_name|there}}

If first_name is empty → "there"

Examples

Hello {{customer.first_name|there}},
  • If name exists: "Hello John,"
  • If name missing: "Hello there,"
I see you're with {{customer.company|your company}}.
  • If company exists: "I see you're with Acme Corp."
  • If company missing: "I see you're with your company."

Conditional Content

Show content only when a variable has a value:

{{#if customer.company}}
I see you're reaching out from {{customer.company}}.
{{/if}}

This paragraph only appears if the customer has a company set.

If/Else

{{#if customer.first_name}}
Hi {{customer.first_name}},
{{else}}
Hello,
{{/if}}

Custom Fields

Access custom ticket fields:

{{ticket.custom.order_number}}
{{ticket.custom.product_name}}
{{customer.custom.account_tier}}

Custom field names match what you set in Settings.


Formatting Variables

Date Formatting

{{ticket.created_at|date:"MMM D, YYYY"}}

Formats:

  • MMM D, YYYY → Jan 15, 2025
  • MM/DD/YY → 01/15/25
  • YYYY-MM-DD → 2025-01-15

Text Transforms

{{customer.first_name|uppercase}}    → JOHN
{{customer.first_name|lowercase}}    → john
{{customer.first_name|capitalize}}   → John

Example Macro

Putting it all together:

Hi {{customer.first_name|there}},

Thank you for contacting {{org.name}} about your {{ticket.subject}}.

{{#if customer.company}}
I appreciate your business with {{customer.company}}.
{{/if}}

I'll look into this right away and get back to you shortly.

Best regards,
{{agent.first_name}}
{{org.name}} Support

Output (with data):

Hi John,

Thank you for contacting Relay Support about your Order #5678 question.

I appreciate your business with Acme Corp.

I'll look into this right away and get back to you shortly.

Best regards,
Sarah
Relay Support

Troubleshooting

Variable Shows as Text

If you see {{customer.first_name}} in the output:

  • Check spelling—variables are case-sensitive
  • Ensure the variable is supported
  • Check for typos in brackets

Value is Blank

If the variable disappears entirely:

  • The data doesn't exist for this customer/ticket
  • Add a fallback: {{variable|fallback}}

Wrong Value

  • Verify you're using the correct variable
  • Check if customer data is up to date

← Using Macros | Back to Macros