LogoLogo
  • Home
  • Integration & SDKs
    • Web / Browser Push
      • Wordpress Integration Steps
      • Wix Integration Steps
      • Safari
        • Safari on Desktop
        • Safari on Mobile (iOS / iPadOS)
      • SDK
        • SDK Methods
        • SDK Events
        • Customizing Prompt CSS
        • AMP Support
        • E-Commerce / Abandoned Cart
    • Native App Push
      • Apple / iOS
        • P8 Key or P12 Cert Setup
        • SDK: Swift / Obj-C
          • Activity Tracking
          • Deep Linking
          • Live Activities
          • App Messages
          • Identity Synchronization
          • SDK Methods
          • SDK Delegates
        • SDK: React Native
        • SDK: Flutter
        • Advanced
          • Self-Managed Integration
        • iOS SDK Changelog
      • Android
        • Firebase App Setup
        • SDK: Kotlin / Java
          • Deep Linking
          • Activity Tracking
          • App Messages
          • Identity Synchronization
          • SDK Methods
          • SDK Callbacks
          • Live Activities
        • SDK: React Native
        • SDK: Flutter
        • Advanced
          • Self-Managed Integration
        • Android SDK Changelog
      • React Native
        • Android: Firebase App Setup
        • iOS: P8 Key or P12 Cert Setup
        • SDK: React Native
          • Deep Linking
          • Activity Tracking
          • Subscriber Matching
          • Live Activities
          • App Messages
          • SDK Methods
      • Flutter
        • Android: Firebase App Setup
        • iOS: P8 Key or P12 Cert Setup
        • SDK: Flutter
          • Deep Linking
          • Activity Tracking
          • Subscriber Matching
          • Live Activities
          • App Messages
          • SDK Methods
  • API
    • API Access Management
    • API Reference
  • Platform
    • Dashboard
    • Notifications
      • A/B Testing
      • Custom Buttons
      • Notification Previews
      • Inline Segmentation
      • Notification Templates
      • Macros
      • Native App Push Notifications
    • App Messages
    • Segments
      • Custom Geo Segmentation
    • Campaigns
    • Insights
    • User Management
    • Organizations
      • Multi-Factor Authentication
      • Single Sign On
        • Google Workspace
        • Microsoft Azure AD
        • Okta Workforce
      • Multi-Domain Notifications
      • Multi-Domain Segments
      • API Access
    • Multi-Channel Notifications
  • Info Center
    • Launch Guide & Best Practices
      • Landing Domain Whitelist
    • Web / Browser Push
      • Common Questions
      • Browser Support
      • Retrieve Push User ID
      • Not Getting Prompted
      • Not Receiving Notifications
      • How to Unsubscribe
    • Native App Push
      • Retrieve Push User ID
    • Workflow Planning
Powered by GitBook
On this page
  • Macro Basics
  • Using the Macro List
  • Specifying a Default Value
  • Examples
  • Advanced Usage
  • Filter: Date Format
  • Filter: Relative Dates
  1. Platform
  2. Notifications

Macros

PreviousNotification TemplatesNextNative App Push Notifications

Last updated 4 years ago

Macro Basics

Macros allow you to personalize elements of a notification for each subscriber that receives it.

Using the Macro List

The list of available macros can be shown by clicking the {} icon inside of the title, body, or landing URL text box. Once the list is open, click on any of the macros to automatically insert it.

Specifying a Default Value

It is always good practice to specify a default replacement value when using a macro. This ensures that even if the subscriber does not have a value for the chosen macro the text displayed will make sense.

To specify a default value add the following after the name of the macro:

{{profile.city | default: "your area"}}

Examples

If you are sending a notification focused on a weather event and want to target a geographic area that includes multiple cities but want to ensure that the subscriber's city is displayed in the notification's title you could accomplish this with the following:

Tornado Warning in {{profile.city | default: "your area"}}. Take Cover!

In the above example, if the subscriber who is receiving the notification has a city in their profile the title will be displayed as: Tornado Warning in Miami. Find Shelter!. If they do not have a city then the title will read Tornado Warning in your area. Find Shelter!.

Advanced Usage

If you would like help constructing macros for your notification please reach out to your account manager.

Filter: Date Format

You can use the date filter to convert a date to any format you desire. For example, to provide the date the subscriber opted in to notifications as part of your landing page URL:

https://ex.com/?subscribed={{profile.subscribed_date | date: '%Y-%m-%d'}}

The following date format strings are supported:

Input

Format

%a

The abbreviated weekday name (E.g., Sun)

%A

The full weekday name (E.g., Sunday)

%b

The abbreviated month name (E.g., Jan)

%B

The full month name (E.g., January)

%d

Day of the month (01..31)

%e

Day of the month (1..31)

%H

Hour of the day, 24-hour clock (00..23)

%I

Hour of the day, 12-hour clock (01..12)

%k

Hour of the day, 24-hour clock (0..23)

%l

Hour of the day, 12-hour clock (0..12)

%m

Month of the year (01..12)

%M

Minute of the hour (00..59)

%p

Meridian indicator (E.g., AM or PM)

%S

Second of the minute (00..60)

%Y

Year with century

%%

Literal % character

Filter: Relative Dates

The relative_date filter allows you to provide a date in a wide range of grammatical date formats and have it converted to an absolute date.

For example, if you need to include last Saturday's date in the URL of your notification and format it as Year/Month/Day you can provide the following macro:

https://ex.com/{{'the saturday before today' | relative_date | date: '%Y/%m/%d'}}/example

Some additional examples of the type of relative dates formats you can use:

next thursday
last wednesday
today
tomorrow
yesterday
next week
next month
next year
3 days from now
three weeks ago

Additionally, you can prefix any of the above with the following to further alter the computed date:

day after
the day before
the monday after
the monday before
2 fridays before
4 tuesdays after

If you are sending subscriber properties or a custom integration the macro list will also show these as options under the Custom grouping.

Remember to use our to ensure your macros look the way you expect!

Our macro functionality supports the use of to add more customization to the substituted value. We support both the control flow and iteration tags as well as the use of most filters.

Note the inclusion of the date filter to format the date as desired. If not provided, the relative_date filter will return an formatted date (E.g.,2020-09-10T15:41:41).

Since there is an ambiguity in the grammar of relative date formats always use the functionality to ensure the relative date is properly interpreted.

via our SDK
Preview Functionality
Liquid Templates
ISO-8601
Notification Preview