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:
- Finds each variable
- Looks up the actual value
- Replaces the placeholder
- Shows you the final text
Available Variables
Customer Variables
| Variable | Description | Example |
|---|---|---|
{{customer.first_name}} | Customer's first name | John |
{{customer.last_name}} | Customer's last name | Smith |
{{customer.name}} | Full name | John Smith |
{{customer.email}} | Email address | john@example.com |
{{customer.phone}} | Phone number | +1 555-0123 |
{{customer.company}} | Company name | Acme Corp |
Ticket Variables
| Variable | Description | Example |
|---|---|---|
{{ticket.id}} | Ticket number | 12345 |
{{ticket.subject}} | Subject line | Order #5678 question |
{{ticket.status}} | Current status | Open |
{{ticket.priority}} | Priority level | High |
{{ticket.created_at}} | Creation date | Jan 15, 2025 |
{{ticket.channel}} | Source channel |
Agent Variables
| Variable | Description | Example |
|---|---|---|
{{agent.first_name}} | Your first name | Sarah |
{{agent.last_name}} | Your last name | Jones |
{{agent.name}} | Your full name | Sarah Jones |
{{agent.email}} | Your email | sarah@company.com |
Organization Variables
| Variable | Description | Example |
|---|---|---|
{{org.name}} | Organization name | Relay Support |
{{org.support_email}} | Support email | help@relay.com |
Date Variables
| Variable | Description | Example |
|---|---|---|
{{date.today}} | Today's date | January 15, 2025 |
{{date.tomorrow}} | Tomorrow's date | January 16, 2025 |
{{date.weekday}} | Day of week | Wednesday |
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, 2025MM/DD/YY→ 01/15/25YYYY-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