Macro Variables
Below is a list of variables that can be inserted into macros to populate them with customer data from third-party apps.
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.channel}}
- Ticket subject:
{{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.receiver.email}}
- Ticket id:
{{ticket.id}}
- Ticket customer id:
{{ticket.customer.id}}
- Ticket customer email:
{{ticket.customer.email}}
- Ticket url:
https://sfbycicles.gorgias.com/app/ticket/{{ticket.id}}/
- Ticket sender’s email:
{{ticket.sender.email}}
- Ticket assignee email:
{{ticket.assignee_user.email}}
- Last message datetime:
{{ticket.last_message_datetime}}
- Ticket created datetime:
{{ticket.created_datetime}}
- Ticket updated 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":
{{ticket.customer.integrations.shopify.orders[0].refunds[0].processed_at|datetime_format("L")}}
Shopify variables
- Customer id:
{{ticket.customer.integrations.shopify.customer.email}} - Customer's address:
{{ticket.customer.integrations.shopify.customer.default_address.address1}},
{{ticket.customer.integrations.shopify.customer.default_address.address2}},
{{ticket.customer.integrations.shopify.customer.default_address.zip}},
{{ticket.customer.integrations.shopify.customer.default_address.city}},
{{ticket.customer.integrations.shopify.customer.default_address.province}}
- Last order id:
{{ticket.customer.integrations.shopify.orders[0].id}}
- Tracking url of the last order:
{{ticket.customer.integrations.shopify.orders[0].fulfillments[0].tracking_url}}
- Product name:
{{ticket.customer.integrations.shopify.orders[0].line_items[0].name}}
- Variant name:
{{ticket.customer.integrations.shopify.orders[0].line_items[0].variant_title}}
- Credit card number:
{{ticket.customer.integrations.shopify.orders[0].payment_details.credit_card_number}}
- Refund process date:
{{ticket.customer.integrations.shopify.orders[0].refunds[0].processed_at|datetime_format("L")}}
Magento variables
- Order number:
{{ticket.customer.integrations.magento2.orders[0].increment_id}}
- Tracking ID of last shipment:
{{ticket.customer.integrations.magento2.orders[0].created_at|datetime_format("MMMM d YYYY")}}
- Tracking number:
{{ticket.customer.integrations.magento2.orders[0].last_shipment.last_track.track_number}}
- Tracking URL:
{{ticket.customer.integrations.magento2.orders[0].last_shipment.last_track.tracking_url}}
- Shipping street:
{{ticket.customer.integrations.magento2.orders[0].extension_attributes.shipping_assignments[0].shipping.address.street[0]}}
- Shipping city:
{{ticket.customer.integrations.magento2.orders[0].extension_attributes.shipping_assignments[0].shipping.address.city}}
- Shipping country:
{{ticket.customer.integrations.magento2.orders[0].extension_attributes.shipping_assignments[0].shipping.address.country_id}}
- Shipping postcode:
{{ticket.customer.integrations.magento2.orders[0].extension_attributes.shipping_assignments[0].shipping.address.postcode}}
Big Commerce variables
- Big Commerce Data:
{{ticket.customer.data}}
- First Name:
{{ticket.customer.data.firstname}}
- Last Name:
{{ticket.customer.data.last_name}}
- Phone:
{{ticket.customer.data.phone}}
- Big Commerce Order Id:
{{ticket.customer.data.orders[0].id}}
- Customer message:
{{ticket.customer.data.orders[0].message}}
- Date created:
{{ticket.customer.data.orders[0].date_created}}
- Date shipped:
{{ticket.customer.data.orders[0].date_shipped}}
- Items shipped:
{{ticket.customer.data.orders[0].order_products[0].name}}
- Items total:
{{ticket.customer.data.orders[0].items_total}}
- Refunded amount:
{{ticket.customer.data.orders[0].refunded_amount}}
- Staff notes:
{{ticket.customer.data.orders[0].staff_notes}}
- Status:
{{ticket.customer.data.orders[0].status}}
- Total inc tax:
{{ticket.customer.data.orders[0].total_inc_tax}}
- Date created:
{{ticket.customer.data.orders[0].shipments[0].date_created}}
- Shipping provider:
{{ticket.customer.data.orders[0].shipments[0].shipping_provider}}
- Tracking link:
{{ticket.customer.data.orders[0].shipments[0].tracking_link}}
- Tracking number:
{{ticket.customer.data.orders[0].shipments[0].tracking_number}}
- City:
{{ticket.customer.data.orders[0].shipping_addresses[0].city}}
- Company:
{{ticket.customer.data.orders[0].shipping_addresses[0].company}}
- Country:
{{ticket.customer.data.orders[0].shipping_addresses[0].country}}
- Country iso2:
{{ticket.customer.data.orders[0].shipping_addresses[0].country_iso2}}
- Email:
{{ticket.customer.data.orders[0].shipping_addresses[0].email}}
- First name:
{{ticket.customer.data.orders[0].shipping_addresses[0].first_name}}
- Last name:
{{ticket.customer.data.orders[0].shipping_addresses[0].last_name}}
- Phone:
{{ticket.customer.data.orders[0].shipping_addresses[0].phone}}
- State:
{{ticket.customer.data.orders[0].shipping_addresses[0].state}}
- Street 1:
{{ticket.customer.data.orders[0].shipping_addresses[0].street_1}}
- Street 2:
{{ticket.customer.data.orders[0].shipping_addresses[0].street_2}}
- Zip:
{{ticket.customer.data.orders[0].shipping_addresses[0].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:
- Go to the HTTP integration's page that you use to fetch back-office data.
- On this page, copy the
integration_id
at the end of the URL. For instance, if the URL ishttps://sfbicycles.gorgias.com/app/integrations/http/9141
, theintegration_id
is '9141'. - Now, the path to your integration is
ticket.customer.integrations[{{integration_id}}]
- Head over to a ticket that contains back-office data, and click on the gear icon.
- 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.