How to use Tokens

Tokens are representations of data. When a workflow runs, tokens are replaced with real data.

In this example, the Send an SMS message to your customer when their order is delivered template has been installed to the MESA dashboard.

In the SMS Send Message step, you can see that the Retrieve Order Customer Phone token is used. This will be replaced with your customer's phone number when the workflow runs.

This token came from the Tokens menu by clicking the {+} icon in the To phone number field. The menu will display on the right-hand side.

In the search field, you can search for "Phone" to find the Customer Phone token. 

The Shopify Retrieve Order step will contain data about the order including your customer's phone number. Select the Phone token under the Customer label from the Shopify Retrieve Order step.

When this workflow runs, the order that triggered it will determine the phone number to send the text to. For example, if we received an order from John Smith (123-456-7890), the workflow will send the text message to 123-456-7890 when their order is delivered.

Advanced usage

Using global store settings

Use the {{context.shop.PARAMETER}} tokens to pull in settings from your Shopify store. Some common tokens:

  • {{context.shop.email}} Your store's contact email, set in your Shopify Settings > General.
  • {{context.shop.domain}} Your store's url. Example: www.mystore.com if you have a custom domain, mystore.myshopify.com if you have not configured a custom domain.
  • {{context.shop.myshopify_domain}} will always return your .myshopify.com domain. Example: mystore.myshopify.com.
  • {{context.shop.name}} Your store's name.  Example: My Store.

Formatting tags with Liquid

Tokens are parsed similarly to Shopify's Liquid syntax. This can be useful when you wish to manipulate data before it's processed.

In this example, we replace all tags that contain 'Spring Range' with 'Summer Range'.

1. Select the token for the product tags

2. Double click on the token to edit it

3. Insert the replace filter to replace all tags that contain 'Spring Range' with 'Summer Range'

To learn more about Liquid syntax and its many functions, check out Shopify's Liquid documentation.

Dates and Times

You can get information about the current date and time by using the {{date:<format>}} token. For example, if the day of the week today is Tuesday, the token {{date:D}} will return "Tue". Full details and examples can be found in the Working with Dates article.

Additionally, you can format the "Created At" token to only display the date by using the following token: {{shopify_order.created_at | slice: 0, 10}}