Template Variables For SMS

What are Custom Variables for SMS?

Custom variables are the way Recapture supports adding personalized information to your SMS messages.  Using a custom variable in a template will take the customer's specific data when the message is sent and update the template with the customer-specific value.

Suppose you have the following template: 

Hi there!  We'd love to offer you {{ discount }} for your next order with us!  Reply STOP to opt out.  Msg & data rates apply.

In our template above, the custom variable is {{ discount }}

When Recapture gets ready to send the SMS and sees  {{ discount }} in a template and you've associated the discount of 15OFFNOW to the message, Recapture will substitute "15OFFNOW" in the message where you see{{ discount }}when it sends.

Custom emails use SWIG template replacement, which is a fancy way of saying you put placeholders in the template code and we'll put in the right value for your cart/store when the SMS is being sent:

To use the variable placeholders, you'll want to use these template conventions:

{{ object.field_name }}

There's a space on each side of the curly braces for readability-- but they are optional, so this is valid too:

{{object.field_name}}

You can use default values (when a variable is empty, the default value is used instead of the variable value):

Hey {{ cart.first_name | default('there') }}!

The full syntax available to you is documented here:  http://eddywashere.com/blog/swig-for-designers/

Supported Custom Variables in SMS Templates

The following variables will expand to the customer-specific values when you use them in Recapture SMS messages.

For Order Notification campaigns we have:

  • user (which includes a TON of fields--see below)
  • order (which includes a TON of fields--see below)
  • store_name
  • order_status_url
  • first_name
  • last_name
  • email
  • phone
For Abandoned Cart campaigns we have:
  • user (which includes a TON of fields--see below)
  • cart (which includes a TON of fields--see below)
  • store_name
  • first_name
  • last_name
  • email
  • phone
  • action_url
  • discount

The User, Order and Cart objects have a lot of additional fields available to them, which include:

User fields that are valid:

  • user.first_name
  • user.last_name
  • user.currency

Order fields that are valid:

  • order.first_name
  • order.last_name
  • order.email
  • order.grand_total (raw number)
  • order.grand_total_display (formatted string)
  • order.last_active_at (date)
  • order.products[0].name
  • order.products[0].sku
  • order.products[0].price (numeric only)
  • order.products[0].price_display (formatted with currency code)
  • order.products[0].image (path to image URL)

Cart fields that are valid:

  • cart.first_name
  • cart.last_name
  • cart.email
  • cart.grand_total (raw number)
  • cart.grand_total_display (formatted string)
  • cart.last_active_at (date)
  • cart.products[0].name
  • cart.products[0].sku
  • cart.products[0].price (numeric only)
  • cart.products[0].price_display (formatted with currency code)
  • cart.products[0].image (path to image URL)

The cart, order and customer variables are similar to those in our Email Custom Variables article

Still need help? Contact Us Contact Us