Tips and Tricks for the Airship + Movable Ink Integration

  1. Send the personalization information along with the API call that triggers the message
  2. Get the personalization information at load time, from the device or an API
  • Lock-Screen notifications (Rich Media displayed on Lock Screen has some limitations.)
  • Rich Message Center messages
  • Rich Message Center messages
  • Landing Pages
  • In-App Automations
{     “occurred”: “2020–07–20T06:00:00”,     “user”: {         “named_user_id”: “jg”     },     “body”: {         “name”: “golly”,         “interaction_type”: “crm”,         “value”: 1000,         “properties”: {             “first_name”: “John”,             “named_user”: “jg”,             “email_address”: “”          },          “session_id”: “cd1d893b-cafa-4636–9dac-d83138bef8bf”      }}

Personalization from a Broadcast Message

Sending a message to a segment in Airship is a pretty common workflow; for example, it’s easy to define an audience and compose a message, and Airship handles making sure it gets to the right devices. However, this is typically a uniform message for the entire segment. We’ve made some significant changes recently to make it possible to personalize these types of messages, but assuming that the necessary attributes have not been associated with the users or devices in Airship, it’s still possible to get a key to pass to Movable Ink in order to render a personalized image, even in an In-App Automation.

  1. Execute some custom code when the UAirship interface and page content are fully loaded
if(typeof UAirship === ‘object’ && UAirship.runAction) {onload()} else {document.addEventListener(‘ualibraryready’, onUAReady, false)}
  1. Grab the Named User and assign it to a variable
var named = UAirship.getNamedUser()
  1. Create an <img> element and insert it into the DOM
if(named !== null && named !== “”) {var replaceElement = document.getElementById(“banner_image”);var newImageElement = document.createElement(“img”);newImageElement.src = movable_ink_image + “?mi_u=” + encodeURI(named);replaceElement.firstChild.replaceWith(newImageElement);
var xhr = new XMLHttpRequest();‘GET’, url, true);xhr.setRequestHeader(“Accept”, “application/json”);xhr.send();xhr.onload = function() {    if (xhr.status != 200) {        console.log(`Error ${xhr.status}: ${xhr.statusText}`);    } else {        var json_response = JSON.parse(xhr.responseText);        var deep_link = json_response[‘location’];        var action = “^d”;        if (deep_link.startsWith(“http”)) {           action = “^u”;        }        UAirship.runAction(           action,           deep_link,           function() {               return true           }         )     }  }
function capture() {    // This creates a Custom Event object and sets it in the SDK    console.log(‘running custom event’)    var custom_event_object = {};        custom_event_object.event_name = “open_movable”;    custom_event_object.event_value = 1; = {}; = “” + UAirship.getNamedUser();    UAirship.runAction(“add_custom_event_action”, custom_event_object, true);    return;}



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Urban Airship is now Airship! Leading brands trust us to help them achieve digital growth. We make mobile moments magic.