Macros

Updated 18 days ago ​by Romain Lapeyre

Macros are pre-made responses that you can use to respond to your customers faster.

Macros can perform a number of actions on a ticket including:

  • Insert response text: insert text into the response area. You can include variables such as the customer's first name
  • Set subject: change the subject of the ticket
  • Add tags
  • Set status
  • Set assignee
  • HTTP actions: trigger webhooks in other applications (such as refunding a customer on Stripe)

Macro variables

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, ensure that you’ve added it in Integrations first.

Gorgias variables

  • Ticket channel: {ticket.channel}
  • Ticket subject: {ticket.subject}
  • Receiver email: {ticket.receiver.email}
  • Ticket id: {ticket.id}
  • Ticket requester id: {ticket.requester.id}
  • Ticket url: https://{account.name}.gorgias.io/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}
  • Text of the first message: {ticket.first_message.body_text}
  • Ticket created datetime: {ticket.created_datetime}
  • Ticket opened datetime: {ticket.opened_datetime}
  • Ticket updated datetime: {ticket.updated_datetime}

Shopify variables

  • Customer id: {ticket.requester.integrations.shopify.customer.id}
  • Last order id: {ticket.requester.integrations.shopify.orders[0].id}
  • Tracking url of the last order: {ticket.requester.integrations.shopify.orders[0].fulfillments[0].tracking_url}

Back-office variables

Back-office variables a bit more harder to use, since each back-office 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 https://sfbicycles.gorgias.io/app/integrations/http/9141, the integration_id is 9141
  3. Now, the path to your integration is ticket.requester.integrations[9141]
  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 name of the variables. All variables have this form: {ticket.requester.integrations[9141].data[0].delivery_cost}

That's it. This is probably one of the most complex parts of Gorgias. If you need help, ping us on the Slack community!

HTTP actions

HTTP actions can be performed with macros. If you need any assistance adding HTTP actions, ping us at support@gorgias.io.

Shopify actions

HTTP actions can be used to trigger specific actions in Shopify that are not included by default in Gorgias.

Send an account invite for the customer:

Title: Send an account invite for the customer
POST: https://your-store.myshopify.com/admin/customers/{ticket.requester.customer._shopify.customer.id}/send_invite.json
Headers: X-Shopify-Access-Token {your-access-token}

Create a new $10 gift card with a custom code:

Title: Create a new $10 gift card with a custom code
POST: https://your-store.myshopify.com/admin/gift_cards.json
Headers: X-Shopify-Access-Token {your-access-token}
Body:
    {
        "gift_card": {
            "template_suffix": "gift_cards.birthday.liquid",
            "initial_value": 10,
            "code": "{ticket.requester.customer._shopify.customer.first_name}{ticket.id}10GC",
            "note": "Created by Gorgias for customer {ticket.requester.email}"
        }
    }

Loyalty Lion actions

HTTP actions can be used to trigger specific actions in Loyalty Lion.

Award any number of points to a customer:

Title: Award any number of points to a customer
POST: https://api.loyaltylion.com/v2/customers/{ticket.requester.customer.loyalty_lion[0].merchant_id}/points
Headers:
    Authorization Basic {based64 encoded API key}
    Content-Type application/x-www-form-urlencoded
Body: points 20

How did we do?