Macro Variables

Updated 1 month ago by Yohan Loyer

Below is a list of variables that can be inserted into macros to populate them with customer data from third-party apps.

To use variables from another app, please ensure that you’ve added it as an integration first.

How it works

Once you set up a variable within a macro, each time that you use this macro the system will replace the variable with a relevant piece of customer data. Here's a quick step-by-step below:

Setup instructions

Please find a list of some of the most common macro variable setups below!

Ticket variables
  • Ticket channel:
  • Ticket subject:
  • Message body:
    {{ticket.messages[0].body_text}} (no negative)  ←for chat
    {{ticket.messages[0].stripped_text}} ←for email

These will pull the first message on every ticket. If you want to pull the second message please use [1] and so on.

  • Receiver email:
  • Ticket id:
  • Ticket customer id:
  • Ticket customer email:
  • Ticket url:{{}}/
Please note that we will use the Gorgias subdomain 'sfbycicles' in these examples, but this is where you will want to put your Gorgias account subdomain.
  • Ticket sender’s email:
  • Ticket assignee email:
  • Last message datetime:
  • Ticket created datetime:
  • Ticket updated datetime:

Date variables

You can format the date using the moment.js syntax. See below some examples: 

  • Refund date formatted like "Mar 22nd 18":
    {{ticket.customer.integrations.shopify.orders[0].refunds[0].processed_at|datetime_format("MMM Do YY")}}
  • Refund date formatted like "03/22/2018":

Shopify variables
  • Customer id:
  • Customer's address: 
  • Last order id:
  • Tracking url of the last order:
  • Product name: 
  • Variant name:  
  • Credit card number: 
  • Refund process date: 

Magento variables
  • Order number:
  • Tracking ID of last shipment:
{{ticket.customer.integrations.magento2.orders[0].created_at|datetime_format("MMMM d YYYY")}}
  • Tracking number:
  • Tracking URL:
  • Shipping street:
  • Shipping city:
  • Shipping country:
  • Shipping postcode:

Big Commerce variables
  • Big Commerce Data:
  • First Name:
  • Last Name:
  • Phone:
  • Big Commerce Order Id:
  • Customer message:
  • Date created:
  • Date shipped:
  • Items shipped:
  • Items total:
  • Refunded amount:
  • Staff notes:
  • Status:
  • Total inc tax:
  • Date created:
  • Shipping provider:
  • Tracking link:
  • Tracking number:
  • City:
  • Company:
  • Country:
  • Country iso2:
  • Email:
  • First name:
  • Last name:
  • Phone:
  • State:
  • Street 1:
  • Street 2:
  • Zip:

Back-office variables

Back-office variables are a bit harder to use, since each back-office is unique. For instance, you can display the ETA of an order, or the order_count of a customer. 

To use a variable from your back-office in a macro, follow the steps below: 

  1. Go to the HTTP integration's page that you use to fetch back-office data.
  2. On this page, copy the integration_id at the end of the URL. For instance, if the URL is, the integration_idis '9141'.
  3. Now, the path to your integration is ticket.customer.integrations[{{integration_id}}]
  4. Head over to a ticket that contains back-office data, and click on the gear icon.
  5. Now, follow the data structure to find the names of the variables. All variables have this form: {{ticket.customer.integrations[9141].data.delivery_cost}}

You can have a look at this video tutorial as well for further guidance:

That's it! This is probably one of the most complex parts of Gorgias.

What do you think? Yay or Nay?