Platform overrides with templates

Override push settings and provide content for specific platforms (selected by device_type) using a template. Templated platform overrides automatically allow personalization using Handlebars.

Android overrides with template

Use a template with an Android-specific fields. You can reference a template by ID, or use {{handlebars}} directly in your message.

Jump to examples ↓

OBJECT PROPERTIES
  • actions object<Actions>

    Describes Actions to be performed by the SDK when a user interacts with the notification. You can personalize message actions using Handlebars.

  • category string

    Helps determine notification sort order. Available on Android Lollipop+.

    Possible values: alarm, call, email, err, event, msg, promo, recommendation, service, social, status, sys, transport

  • collapse_key string

    A key indicating that this message can replace, or be replaced by, another message with the same collapse_key. This feature comes into play when a device is offline (e.g., airplane mode) or in doze mode; if multiple messages are available with the same collapse_key when a device comes back online, it will display only the most recent message and discard previous messages using the same collapse_key.

  • delay_while_idle booleanDEPRECATED

    After November 15, 2016, this was still accepted by GCM, but ignored. When set to true, it indicates that the message should not be sent until the device becomes active. The default value is false.

  • deliver_to string

    Filters out Android channels that are not able to receive notifications. If the value is opted_in, the payload is only sent to opted-in devices. If the value is all, the payload is sent to opted-in and background enabled devices. Defaults to all if not provided.

    Possible values: all, opted_in

  • delivery_priority string

    Sets the FCM/GCM priority of the message. Defaults to normal if not provided.

    Possible values: high, normal

  • extra object

    A JSON dictionary of string-to-string key-value pairs. The keys from, message_type, data and keys that start with google or gcm are disallowed.

  • An interactive notification.

    Attempting to specify an interactive payload for an unsupported device type will result in an HTTP 400 response.

  • local_only boolean

    If true, the notification is only shown on wearable devices.

  • notification_channel string

    A string representing a notification channel. Used to group notifications with similar behavior.

  • notification_tag string

    A string representing a notification tag. If a message is currently displaying and has a tag set, sending another message with the same tag will replace the posted notification. Similar to the iOS collapse_id.

  • priority integer

    An integer in the range from -2 to 2 inclusive. Used to help determine notification sort order. 2 is the highest priority, -2 is the lowest, and 0 is the default priority.

  • public_notification object

    An optional notification to show on lock screen instead of the redacted one. This is only useful with visibility set to -1 (private). The object may contain any of the following string fields title, alert, and summary.

    OBJECT PROPERTIES
    • alert string
    • summary string
    • title string
  • sound string

    A string representing a sound file name included in the application’s resources.

  • style object

    Advanced styles big text, big picture, and inbox are available on Android 4.3+ by adding the style to the platform specific notification payload on Android platforms. This object must contain a string field type which must be one of big_picture, big_text, or inbox. It may also contain title and summary override fields.

    OBJECT PROPERTIES
    • big_picture string

      If the type is set to big_picture, then there must also be a big_picture string field which contains the URL for an image.

    • big_text string

      If the type is set to big_text, then a big_text string field must be present with the text to be shown in big text style.

    • lines array[string]

      An array of strings if the type field is set to inbox.

    • summary string

      A string field which will override the summary of the notification.

    • title string

      A string field which will override the title of the notification.

    • type stringREQUIRED

      Possible values: big_picture, big_text, inbox

  • template object
    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object

        Items in the field object are personalizable with handlebars.

        OBJECT PROPERTIES
        • alert string

          A string that override the alert value provided at the top level, if any.

        • icon string

          A string representing an image file included in the application’s resources.

        • icon_color string

          A string representing the icon color in API Color Format. i.e., #rrggbb

        • summary string

          A string representing a summary/subtitle of the notification.

        • title string

          A string representing the title of the notification. The default value is the name of the app.

  • time_to_live object

    Delivery expiration, as either absolute ISO UTC timestamp, or number of seconds from now.

    One of
  • visibility integer

    An integer in the range from -1 to 1 inclusive. 1 = public (default), 0 = private, -1 = secret. Secret does not show any notifications. Private shows a redacted version of the notification.

    Possible values: -1, 0, 1

  • wearable object

    Provides options for messages displayed on wearable Android devices.

    OBJECT PROPERTIES
    • background_image string

      The URL to a background image to display on the wearable device.

    • extra_pages array[object]

      An array of objects, each with a title and alert string attributes specifying extra pages of text to appear as pages after the notification alert on the wearable device.

    • An interactive notification.

      Attempting to specify an interactive payload for an unsupported device type will result in an HTTP 400 response.

Used in:

Examples

Android override with a template

{
   "android": {
      "title": "Shoe sale on {{level}} floor!",
      "alert": "All the shoes are on sale {{name}}!",
      "summary": "Don't miss out!",
      "icon": "shoes",
      "icon_color": "{{iconColor}}",
      "extra": {
            "url": "http://example.com",
            "story_id": "1234",
            "moar": "{\"key\": \"value\"}"
      },
      "notification_channel": "promos"
   }
}

Android override with a template_id

{
   "android": {
      "template": {
            "template_id": "608f1f6c-8860-c617-a803-b187b491568e"
      },
      "extra": {
            "url": "http://example.com",
            "story_id": "1234",
            "moar": "{\"key\": \"value\"}"
      },
      "notification_channel": "promos"
   }
}

Email notification with template

Notification fields specific to email messages with an inline template for use in a Create and Send payload. Using a template enables you to provide and populate variables in your notification. You can also add conditional statements based on those variables, determining message text that to send to each member of your audience. Conditionals begin with {{#operator}} and end with {{/operator}}. For more information, see Handlebars.

Jump to examples ↓

OBJECT PROPERTIES
  • bcc array[string]

    An array of email addresses that you want to blind copy on this email. Contact your Account Manager to enable BCC addresses. Using addresses that your Airship Account Manager has not enabled for BCC will return a 400.

  • click_tracking boolean

    True by default. Set to false to prevent click tracking for GDPR compliance.

  • message_type stringREQUIRED

    The type of email you are sending, transactional or commercial.

    Possible values: transactional, commercial

  • open_tracking boolean

    True by default. Set to false to prevent open tracking for GDPR compliance.

  • reply_to stringREQUIRED

    The reply-to address. The username portion of the reply-to address can be set dynamically using Handlebars. The domain portion of the reply-to address can be any correctly formatted domain.

  • sender_address stringREQUIRED

    The email address of the sender. The domain of the email must be enabled in the email provider at the delivery tier (ie: SparkPost). The username portion of the sender address can be set dynamically using Handlebars. The domain portion of the sender address must match one of your project’s configured email sending domains.

  • sender_name stringREQUIRED

    The common name for the sender, visible to email recipients. The sender name can be set dynamically using Handlebars.

  • template objectREQUIRED

    Specify a template_id created in the Airship UI or use an inline template.

    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields objectREQUIRED

        The template you want to construct for the message. Provide variables in the template in double curly brackets — {{variable_name}}. The variable name must be a case-sensitive match of a key in your create_and_send objects to be replaced as a part of the template.

        OBJECT PROPERTIES
        • html_body string

          The rich-text HTML body of the email, no larger than 100 KB.

          • When "message_type": "commercial", the body must contain an unsubscribe link in the format <a data-ua-unsubscribe=“1” title=“unsubscribe”>Unsubscribe</a>. You can send the user to a custom “goodbye” page by providing an href attribute in the link: <a data-ua-unsubscribe=“1” title=“unsubscribe” href=“YOUR_URL”>Unsubscribe</a>. If your unsubscribe link includes an href, Airship unsubscribes the user before redirecting to your page. Additionally, <a data-ua-opt-in=“1” title=“subscribe”>Subscribe and <a data-ua-opt-in=“1” title subscribe" href=“YOUR_URL_HERE”>Subscribe will be replaced by a link that will opt the user in to both commercial and transactional messaging and optionally redirect the user to a customer-supplied landing page.
          • See Email image recommendations.

        • plaintext_body stringREQUIRED

          The plain text body of the email, no larger than 100 KB.

          When "message_type": "commercial", the body must contain a [[ua_unsubscribe]] link, which will be replaced by the unsubscribe link in Airship. You can send the user to a custom “goodbye” page by providing an href in the format [[ua-unsubscribe href=“your url here”]]. If you include an href, Airship unsubscribes the user before redirecting to your page. Additionally, [[ua-opt-in]] and [[ua-opt-in href=“YOUR_URL_HERE”]] will be replaced by a link that will opt the user in to both commercial and transactional messaging and optionally redirect the user to a customer-supplied landing page.

        • subject stringREQUIRED

          The subject line of the email you want to send.

  • url_parameters object

    A JSON dictionary of string-to-string key-value pairs as UTM or custom parameters. Each key and value will become a query parameter key and URL-encoded value that are automatically appended to all link URLs in an email. These parameters are used for tracking campaign performance.

    If a query parameter defined in this object already exists in a link, it will not be overwritten in the link. Dynamic values are supported using Handlebars, with limitations. See URL parameters in the Email content guide for more information.

Used in:

Examples

Example with inline template

{
  "audience": {
    "create_and_send" : [
      {
        "ua_address": "new@example.com",
        "ua_commercial_opted_in": "2020-11-29T10:34:22",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "cart" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "email" ],
  "notification" : {
    "email": {
      "message_type": "commercial",
      "sender_name": "Airship",
      "sender_address": "team@airship.com",
      "reply_to": "no-reply@airship.com",
      "template": {
        "fields": {
          "subject": "Hi {{customer.first_name}}, your products are ready!",
          "plaintext_body": "Hi {{customer.first_name}},/n Your order is ready for pickup at our {{customer.location}} store!/n Your order:/n {{#each cart}}{{this.qty}}x {{this.name}}/n{{/each}} Thanks,/n Your local AwesomeStore."
        }
      },
      "url_parameters": {
        "utm_source": "airship",
        "utm_channel": "email"
      }
    }
  }
}

Example with template_id

{
  "audience": {
    "create_and_send" : [
      {
        "ua_address": "new@example.com",
        "ua_commercial_opted_in": "2020-11-29T10:34:22",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "cart" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "email" ],
  "notification" : {
    "email": {
      "message_type": "commercial",
      "sender_name": "Airship",
      "sender_address": "team@airship.com",
      "reply_to": "no-reply@airship.com",
      "template": {
        "template_id": "9335bb2a-2a45-456c-8b53-42af7898236a"
      },
      "url_parameters": {
        "utm_source": "airship",
        "utm_channel": "email"
      }
    }
  }
}

Fire OS overrides with template

Use a template with a Fire OS-specific message. You can reference a template by ID, or use {{handlebars}} directly in your message.

Jump to examples ↓

OBJECT PROPERTIES
  • actions object<Actions>

    Describes Actions to be performed by the SDK when a user interacts with the notification. You can personalize message actions using Handlebars.

  • consolidation_key string

    A string representing a key to suppress previous messages sent with the same key.

  • expires_after object

    Delivery expiration, as either absolute ISO UTC timestamp, or number of seconds from now.

    One of
  • extra object

    A JSON dictionary of string-to-string key-value pairs. If you wish to pass structured data in an extra key, it must be JSON-encoded as a string.

  • An interactive notification.

    Attempting to specify an interactive payload for an unsupported device type will result in an HTTP 400 response.

  • notification_channel string

    A string representing a notification channel. Used to group notifications with similar behavior.

  • notification_tag string

    A string representing a notification tag. If a message is currently displaying and has a tag set, sending another message with the same tag will replace the posted notification.

  • sound string

    A string representing a sound file name included in the application’s resources.

  • style object

    Advanced styles big text, big picture, and inbox are available on Android 4.3+ by adding the style to the platform specific notification payload on Android platforms. This object must contain a string field type which must be one of big_picture, big_text, or inbox. It may also contain title and summary override fields.

    OBJECT PROPERTIES
    • big_picture string

      If the type is set to big_picture, then there must also be a big_picture string field which contains the URL for an image.

    • big_text string

      If the type is set to big_text, then a big_text string field must be present with the text to be shown in big text style.

    • lines array[string]

      An array of strings if the type field is set to inbox.

    • summary string

      A string field which will override the summary of the notification.

    • title string

      A string field which will override the title of the notification.

    • type stringREQUIRED

      Possible values: big_picture, big_text, inbox

  • template object
    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object

        Items in the field object are personalizable with handlebars.

        OBJECT PROPERTIES
        • alert string

          A string that override the alert value provided at the top level, if any.

        • icon string

          A string representing an image file included in the application’s resources.

        • icon_color string

          A string representing the icon color in API Color Format. i.e., #rrggbb

        • summary string

          A string representing a summary/subtitle of the notification.

        • title string

          A string representing the title of the notification. The default value is the name of the app.

Used in:

Examples

Fire OS override with a template

{
   "amazon": {
      "title": "Shoe sale on {{level}} floor!",
      "alert": "All the shoes are on sale {{name}}!",
      "summary": "Don't miss out!",
      "icon": "shoes",
      "icon_color": "{{iconColor}}"
   }
}

Fire OS override with a template_id

{
   "amazon": {
       "template": {
           "template_id": "608f1f6c-8860-c617-a803-b187b491568e"
       }
   }
}

iOS overrides with template

Use a template with iOS-specific message. You can reference a template by ID, or use {{handlebars}} directly in your message.

Jump to examples ↓

OBJECT PROPERTIES
  • actions object<Actions>

    Describes Actions to be performed by the SDK when a user interacts with the notification. You can personalize message actions using Handlebars.

  • badge integer

    May be an integer, the value auto, or an increment value. Increments are expressed by integers formatted as strings, and prefixed with either + (U+002B) or - (U+002D). The numeric portion may be an integer value.

  • category string

    Sets the APNs category for the push. This maps directly to the category field in the aps section of the APNs payload. Any interactive notification specified for the IOS platform will take precedence and this value will be ignored (the interactive notification type will be used for the category).

  • collapse_id string

    When there is a newer message that renders an older, related message irrelevant to the client app, the new message replaces the older message with the same collapse_id. Similar to the Android notification_tag. The value of this key must not exceed 64 bytes. iOS 10 or above.

  • content_available boolean

    If true, the payload is delivered to your app in the background.

    This flag is automatically set to true if there is an In-App Message in the payload. Attempting to override this value to false when there is an in-app message will result in a 400 Bad Request response from the API.

  • expiry object

    Delivery expiration, as either absolute ISO UTC timestamp, or number of seconds from now.

    One of
  • extra object

    A dictionary of string keys to arbitrary JSON values. The key aps would conflict with the generated APNs payload and is disallowed.

  • An interactive notification.

    Attempting to specify an interactive payload for an unsupported device type will result in an HTTP 400 response.

  • media_attachment object

    The media_attachment key on the iOS override is a JSON object that describes a media attachment to be handled by the Airship Media Attachment extension in iOS 10.

    OBJECT PROPERTIES
    • content object

      A JSON object that describes portions of the notification that should be modified if the media attachment succeeds, with any of the following fields.

      OBJECT PROPERTIES
      • body string
      • subtitle string
      • title string
    • options object

      A JSON object that describes how to display the resource at the URL specified above, with any of the following fields.

      OBJECT PROPERTIES
      • crop object

        A JSON object that describes the crop parameters to be used in the thumbnail. Each field is a decimal, normalized from 0 to 1. Before displaying the thumbnail, iOS additionally crops the thumbnail down to a square. See: Media guidelines.

        OBJECT PROPERTIES
        • height number

          The height of the final crop.

        • width number

          The width of the final crop.

        • x number

          The X offset where the crop begins.

        • y number

          The Y offset where the crop begins.

      • hidden boolean

        A boolean, when true, the thumbnail will be hidden.

      • time integer

        A decimal, the frame of the animated resource that should be used in the thumbnail. For GIFs, this value should be the frame number (an integer, with the first frame being frame 1) to show in the thumbnail. For video, the value should be the time (in seconds) into the video from which to grab the thumbnail. This value should not be set for static resources like JPGs. If the time does not exist in the resource, either because it is out of bounds or because the resource is static, the thumbnail will not show.

    • url stringREQUIRED

      The URL to be downloaded by the Airship Media Attachment extension. The media file should be one of the following types, and not exceed the maximum file size. Image (5 MB): JPEG, GIF, PNG. Audio (10 MB): AIFF, WAV, MP3, M4A. Video (50 MB): MPEG, MPEG2, MP4, AVI. Although these are the theoretical file size maximums, for performance the actual resources should be much smaller. See Media Guidelines.

  • mutable_content boolean

    When set to true, content may be modified by an extension. This flag will be automatically set to true if there is a media_attachment in the payload. iOS 10 or above. Defaults to false.

  • priority integer

    Sets the APNs priority of the delivery. Valid values are 10 (immediate delivery) and 5 (conserve battery). The default value will be 10 if the notification is user-visible (In-App Message payload does not count towards visibility) which means there is either an alert, badge, or sound. If the notification is not user-visible, the priority will default to 5 and it is not legal to override this value to 10. Attempts to do so will cause the API respond with a 400 Bad Request response. enum: [5, 10]

  • sound string

    The name of the sound file in your app’s bundle that you want to play for the alert. If the notification is critical, the dictionary has a key for "name" (equivalent to the current sound string), "volume" (a number between 0 and 1 indicating the volume), and "critical" (a boolean indicating if the alert should override local device settings and still notify).

  • template object
    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object

        Items in the field object are personalizable with handlebars.

        OBJECT PROPERTIES
        • alert string

          Alert override text for iOS devices.

        • subtitle string

          A string that will display below the title of the notification. This is provided as a convenience for setting the subtitle in the alert JSON object. If a subtitle is also defined in the alert JSON object, this value is ignored. iOS 10.

        • title string

          A short string describing the purpose of the notification. This is provided as a convenience for setting the title in the alert JSON object. If a title is also defined in the alert JSON object, this value is ignored.

  • thread_id string

    A unique identifier used to group notifications into separate threads in the Notification Center and on the lock screen. Grouped notifications are available beginning with iOS 12.

Used in:

Examples

iOS override with a template

{
   "ios": {
      "thread_id": "sfGiants_news",
      "title": "{{NAME}} Throws a Perfect Game",
      "body": "{{NAME}} stymies the {{OTHER_TEAM}} for San Francisco's first perfect game in franchise history.",
      "subtitle": "San Francisco Giants {{DATE}}",
      "sound": "strike-call",
      "media_attachment": {
         "content": {
            "title": "Kevin Gausman",
            "body": "Gausman strikes out Justin Turner"
         },
         "options": {
            "crop": {
               "height": 0.5,
               "width": 0.5,
               "x": 0.25,
               "y": 0.25
            },
            "time": 15
         },
         "url": "https://media.example.com/media/6nJmrhlu4aL1m/giphy.gif"
      },
      "mutable_content": 1
   }
}

iOS override with a template_id

{
   "ios": {
      "template": {
            "template_id": "608f1f6c-8860-c617-a803-b187b491568e"
      }
   }
}

Message Center with template

Use a template with a message center message. You can reference a template by ID, or use {{handlebars}} directly in your message.

Jump to examples ↓

OBJECT PROPERTIES
  • content_encoding string

    A string denoting encoding type of the data in body. Defaults to utf-8. base64 encoding can be used in cases which would be complex to escape properly, just as HTML containing embedded javascript code, which itself may contain embedded JSON data.

  • content_type string

    A string denoting the MIME type of the data in body. Defaults to text/html.

  • expiry object

    Delivery expiration, as either absolute ISO UTC timestamp, or number of seconds from now.

    One of
  • extra object

    A JSON dictionary of string-to-string key-value pairs. If you wish to pass structured data in an extra key, it must be JSON-encoded as a string.

  • icons object

    A JSON dictionary of string key and value pairs representing icons. At this time, only the list_icon key is supported. Values must be URI/URLs to icon resources. For resources hosted by UA, use the following URI format ua:<resource_id>.

    OBJECT PROPERTIES
    • list_icon string
  • template object
    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object

        Items in the field object are personalizable with handlebars.

        OBJECT PROPERTIES
        • html_body string

          The body of the message. This can be a full HTML message.

        • title string

          The title of the message.

Used in:

Examples

Message Center with template using handlebars example

{
   "message": {
      "title": "Save on {{product}} through {{end_date}}!",
      "body": "<html><body><h1>here's a cool {{offer}}</h1> etc...</html>",
      "content_type": "text/html",
      "expiry": "2020-04-01T12:00:00",
      "extra": {
         "offer_id": "608f1f6c-8860-c617-a803-b187b491568e"
      },
      "icons": {
         "list_icon": "http://cdn.example.com/message.png"
      }
   }
}

Message Center with template by ID example

{
   "message": {
      "template": {
         "template_id": "my_template_id"
      }
   }
}

MMS notification with inline template

Template and notification overrides for a Create and Send payload with device_types set to mms. With a template, you can provide and populate variables and conditional statements based on those variables. Conditionals begin with {{#operator}} and end with {{/operator}}. For more information, see Handlebars.

Jump to examples ↓

OBJECT PROPERTIES
  • slides array[object]

    An array containing a single slide object. A slide is a multimedia object.

  • template object

    Specify a template_id created in the Airship UI or use an inline template.

    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object
        OBJECT PROPERTIES
        • fallback_text stringREQUIRED

          If a member of your audience cannot receive MMS messages, they will receive your fallback text with a link to the original content.

        • subject string

          The subject for the MMS message, normally displayed in bold. The subject might not appear for recipients if the Sender is a Toll-Free number. An empty string is valid.

        • text object

          Text that you want to display along with the media attachment. The order of media and text in the message is not guaranteed.

Used in:

Examples

Example object with merge fields in audience object

{
  "audience": {
    "create_and_send" : [
      {
        "ua_sender" : "12345",
        "ua_msisdn" : "15558675309",
        "ua_opted_in" : "2020-08-30T22:35:00",
        "delivery_image": "url",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "order" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "mms" ],
  "notification" : {
    "mms" : {
      "subject" : "Your order is on the way!",
      "fallback_text": "Hi, {{customer.first_name}}, your {{#each order}}{{order.name}}{{/each}} just shipped",
      "slides": [
        {
          "media": {
            "url": "https://www.example.com/order12345.jpg",
            "content_type": "image/jpeg",
            "content_length": 123100
          },
          "text": "Hi, {{customer.first_name}}, your {{#each order}}{{order.name}}{{/each}} just shipped."
        }
      ]
    }
  }
}

Example with inline template

{
  "audience": {
    "create_and_send" : [
      {
        "ua_sender" : "12345",
        "ua_msisdn" : "15558675309",
        "ua_opted_in" : "2020-08-30T22:35:00",
        "delivery_image": "https://www.example.com/order12345.jpg",
        "content-length": "1234567",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "order" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "mms" ],
  "notification" : {
    "mms" : {
      "subject": "Your order is on the way!",
      "fallback_text": "Hi, {{customer.first_name}}, your {{#each order}}{{order.name}}{{/each}} was delivered!",
      "slides": [
        {
          "media": {
            "url": "https://www.example.com/order12345.jpg",
            "content_type": "image/jpeg",
            "content_length": 123100
          },
          "text" : "Hi, {{customer.first_name}}, your {{#each order}}{{order.name}}{{/each}} was delivered!"
        }
      ]
    }
  }
}

Example with template_id

{
  "audience": {
    "create_and_send" : [
      {
        "ua_sender" : "12345",
        "ua_msisdn" : "15558675309",
        "ua_opted_in" : "2020-08-30T22:35:00",
        "delivery_image": "https://www.example.com/order12345.jpg",
        "content-length": "1234567",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "order" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "mms" ],
  "notification" : {
    "mms" : {
      "template" : {
        "template_id" : "9335bb2a-2a45-456c-8b53-42af7898236a"
      },
      "slides": [
        {
          "media": {
            "url": "https://cdn.example.com/coolImage.jpg",
            "content_type": "image/jpeg",
            "content_length": 123100
          }
        }
      ]
    }
  }
}

Open channel overrides with template

Use a template with an open channel-specific message. You can reference a template by ID, or use {{handlebars}} directly in your message.

OBJECT PROPERTIES
  • extra object

    A JSON dictionary of string-to-string key-value pairs. If you wish to pass structured data in an extra key, it must be JSON-encoded as a string.

  • An interactive notification.

    Attempting to specify an interactive payload for an unsupported device type will result in an HTTP 400 response.

  • template objectREQUIRED
    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object
        OBJECT PROPERTIES
        • alert string

          Override the alert value provided at the top level, if any.

        • media_attachment string

          A URI for an image or video somewhere on the internet.

        • summary string

          A string value for providing a content summary.

        • title string

          A string representing the title of the notification.

Used in:

SMS notification with template

Notification fields specific to SMS messages with an inline template for use in a Create and Send payload. Using a template enables you to provide and populate variables in your notification. You can also add conditional statements based on those variables, determining message text that to send to each member of your audience. Conditionals begin with {{#operator}} and end with {{/operator}}. For more information, see Handlebars.

Jump to examples ↓

OBJECT PROPERTIES
  • expiry object

    Delivery expiration, as either absolute ISO UTC timestamp, or number of seconds from now.

    One of
  • template objectREQUIRED

    Specify a template_id created in the Airship UI or use an inline template.

    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object

        The template you want to construct for the message. Provide variables in the template in double curly brackets — {{variable_name}}. The variable name must be a case-sensitive match of a key in your create_and_send objects to be replaced as a part of the template.

        OBJECT PROPERTIES
        • alert stringREQUIRED

          The notification you want to send to an SMS audience.

Used in:

Examples

Example object with merge fields in audience object

{
  "audience": {
    "create_and_send" : [
      {
        "ua_sender" : "12345",
        "ua_msisdn" : "15558675309",
        "ua_opted_in" : "2020-08-30T22:35:00",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "cart" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "sms" ],
  "notification" : {
    "sms" : {
      "alert" : "Hi, {{customer.first_name}}, your {{#each cart}}{{this.name}}{{/each}} are ready to pickup at our {{customer.location}} location!"
    }
  },
  "campaigns" : {
    "categories" : [ "order-pickup" ]
  }
}

Example object with template_id

{
  "audience": {
    "create_and_send" : [
      {
        "ua_sender" : "12345",
        "ua_msisdn" : "15558675309",
        "ua_opted_in" : "2020-08-30T22:35:00",
        "customer": {
            "first_name": "Jenny",
            "last_name": "Smith",
            "location": "Vancouver"
        },
        "cart" : [
          {
            "name" : "Rubber Gloves",
            "code" : "abaccgdsagsde",
            "qty": 1
          },
          {
            "name" : "Bleach Alternative",
            "code" : "cacadgdesgaga",
            "qty": 1
          }
        ]
      }
    ]
  },
  "device_types" : [ "sms" ],
  "notification" : {
    "sms" : {
      "template" : {
        "template_id": "9335bb2a-2a45-456c-8b53-42af7898236a"
      }
    }
  }
}

Web overrides with template

Use a template with a Web-specific message. You can reference a template by ID, or use {{handlebars}} directly in your message.

Safari behaves differently from other browsers and supports only the alert and title overrides. It ignores all other web overrides.

Jump to examples ↓

OBJECT PROPERTIES
  • actions object<Actions>

    Describes Actions to be performed by the SDK when a user interacts with the notification. You can personalize message actions using Handlebars.

  • buttons array[object]

    Contains one or two buttons that perform actions for the web notification. If you do not specify actions for a button, the button closes the notification without performing an action.

  • extra object

    A JSON dictionary of string-to-string key-value pairs. If you wish to pass structured data in an extra key, it must be JSON-encoded as a string.

  • icon object

    A JSON object that describes an icon to be used with the notification.

    OBJECT PROPERTIES
    • url stringREQUIRED

      The URL to be used for the icon.

  • image object

    A JSON object that describes an image to be used with the web alert.

    OBJECT PROPERTIES
    • url stringREQUIRED

      The URL to be used for the image.

  • require_interaction boolean

    If true, a feature that requires a user to interact with the notification in order to remove it from their computer screen.

  • template object
    One of
    • OBJECT PROPERTIES
    • OBJECT PROPERTIES
      • fields object

        Items in the field object are personalizable with handlebars.

        OBJECT PROPERTIES
        • alert string

          Override the alert value provided at the top level, if any.

        • icon object

          A JSON object that describes a icon to be used with the web alert.

          OBJECT PROPERTIES
          • url stringREQUIRED

            The URL to be used for the icon.

        • title string

          A string representing the title of the notification.

  • time_to_live object

    Delivery expiration, as either absolute ISO UTC timestamp, or number of seconds from now.

    One of

Used in:

Examples

Web override with a template

{
   "web": {
      "alert": "Vote now, {{name}}!",
      "title": "Geese? Or ducks!",
      "icon": "{{icon}}",
      "require_interaction": true,
      "buttons": [
         {
            "id": "yes",
            "label": "Yes",
            "actions": {
               "open": {
                  "type": "home"
               },
               "add_tag": ["new_tag"]
            }
         },
         {
         "id": "no",
         "label": "No"
         }
      ],
      "extra": {
         "story_id": "1234",
         "moar": "{\"key\": \"value\"}"
      }
   }
}

Web override with a template_id

{
   "web": {
      "template": {
         "template_id": "1ad69081-c196-af21-41dc-53bc89a2edc5"
      },
      "require_interaction": true,
      "extra": {
         "story_id": "1234",
         "moar": "{\"key\": \"value\"}"
      }
   }
}