Push to device

To send notifications to a specific subset of devices using the Push to Device API, you must filter devices by Mobile User ID, Channel ID, and App Key per contact. In Push to Device, sending is limited to a subset of devices.

The only difference between the Push to Device API and the Push to Contact API is how the recipient is looked up. In Push to Contact, specifying one contact_ID may retrieve multiple consent records which are different devices.

Functionalities available

The Push to Device API call has POST functionality.

POST: This call creates a push notification.
POST /channels/push/sends

Scenarios that can be accomplished using this API

  • Send to one or more contact IDs using existing content in Acoustic Campaign (using default or custom actions in Acoustic Campaign)
  • Send to one or more contact IDs using content defined in the API payload (using default or custom actions in the API payload).
  • Use personalization in the content from either an external system or a Campaign​
  • Send to all devices for a given contact
  • Send to a specific device for a given contact

Path Parameters

Not applicable

Request Body

pushTo Contact

AttributeRequiredDescriptionData type
channelQualifiersYesList of App keysArray[String]
content(PushContent)YesContent for push notificationmodel
contactsYesList of contactsArray[PushContact]

Array[pushContact]

AttributeRequiredDescriptionData type
personalizationDefaultsNoMap of key-value pairs for personalizationMap
campaignNameNoCampaign namemodel

PushContent

AttributeRequiredDescriptionData type
contentIDNoUUID – representing delivery draft to load contents for push notificationString
simple(SimplePushContent)NoContents for push notificationmodel

SimplePushContent

AttributeRequiredDescriptionData type
apns(IosPushPayload)NoPush content for iOS devicesmodel
fcm(AndroidPushPayload)NoPush content for Android devicesmodel

iOSPushPayload

AttributeRequiredDescriptionData type
aps (APS)NoAPSmodel
notification-action (Action)NoAction to perform when notification is pressedmodel

APS

AttributeRequiredDescriptionData type
alertNoMessage to show on notificationString
badgeNoNumber to show on AppInteger
interruption-levelNoValue to determine the priority and timing of of when the user receives the notification.
The following values are available:
passive - does not interrupt the user. Available from the iOS 15 version.
active (default) - wakes the phone and does not interrupt focus mode.
time-sensitive - wakes the phone and interrupts the focus mode. Available from the iOS 15 version.
critical - requires permission from Apple.
relevance-scoreNoA number value between 0 and 1 to determine how the notification is featured when grouped.
content-availableNoIf content-available, "1"String
mutable-contentNoIf mutable-content, "1"String

Note :APNS APS level key: values can be added here and will be passed through to the device.

Action

AttributeRequiredDescriptionData type
typeYesType of action to performString
nameNoName of action to display on notificationString
valueYesParameters of actionJSONnode

AndroidPushPayload

AttributeRequiredDescriptionData type
alert (AndroidAlertNode)NoAndroid push contentsmodel

AndroidAlertNode

AttributeRequiredDescriptionData type
subjectNoSubject of notificationString
messageNoMessage of notificationString
notification-action (Action)NoAction to perform when notification is pressedmodel

Note: Android alert level key:values can be added here and will be passed through to the device.

AttributeRequiredDescriptionData type
highPriorityNoIf true, the system attempts to wake the sleeping device and delivers immediately.Boolean
iconNoIf the image URL is provided, the large icon will be rendered on the right side of the notification.String
sensitiveNoIf true, the notification text will not be displayed on the lock screen.Boolean
expandable (ExpandableAndroidNode)NoFCM supports text and image expandable content.Model

ExpandableAndroidNode

AttributeRequiredDescriptionData type
typeNoEither text or imageString
valueNoAdditional text to displayString

PushContact

AttributeRequiredDescriptionData type
content (PushContent)NoOptional content to override base push content. Note: ContentID is not allowed when overriding content for contact.model
contactIDNoAcoustic Campaign recipientID takes precedence over LookUpKeyFieldsLong
LookUpKeyFieldsNoList of lookup key fields to find contact. For Push, the Mobile user ID can be specified without specifying the column name.Array [LookUpkeyField]
channel (DeviceLookup)NoLookup key fields to find a specific device.model
personalizationNoMap of key-value pairs for personalization.Map

LookupKeyField

AttributeRequiredDescriptionData type
channelYesChannel nameString
nameYesColumn nameString
valueYesColumn valueString

DeviceLookup

AttributeRequiredDescriptionData type
qualifierYesAppKeyString
destinationYesMobile UserID|Mobile Channel IDString
appKeyNoAppKey, used in place of qualifierString
userIDNoMobile user ID, used in place of destination along with channelIDString
channelIDNoMobile Channel ID, used in place of destination along with userIDString

Swagger URL

https://api-campaign-[data center]-[pod#].goacoustic.com/restdoc/#!/channels/

Request Content Type

application/json

Sample JSON Request Body

{
  "channelQualifiers": [
    "appkey1",
    "appkey2"
  ],
  "content": {
    "contentId": null,
    "simple": {
      "apns": {
        "aps": {
          "content-available": 1
        },
        "dynamic-aps": {
          "alert": "Hello %first_name%, welcome to our holiday sale!",
          "badge": 1
        },
        "notification-action": {
          "name": "phone",
          "value": "1234567890",
          "type": "dial"
        },
        "category-actions": [
          {
            "name": "phone",
            "value": "1234567890",
            "type": "dial"
          },
          {
            "name": "Open URL",
            "value": "http://www.acoustic.com",
            "type": "url"
          }
        ]
      },
      "gcm": {
        "alert": {
          "subject": "my subject",
          "message": "Hello world!",
          "expandable": {
            "type": "text",
            "value": "This is a very long text that I used for demonstrating Android's BigText style.,
            "expandable-actions": [
              {
                "type": "url",
                "name": "url",
                "value": "http://www.google.com"
              },
              {
                "type": "dial",
                "name": "phone",
                "value": "1234567890"
              }
            ]
          "icon": "https:some.icon.location.com/image.png"
          "highPriority": true
          },
          "notification-action": {
            "type": "sendEmail",
            "value": {
              "recipient": "[email protected]",
              "subject": "Check out this deal!",
              "body": "Great Sale"
            }
          }
        }
      }
    }
  },
  "contacts": [
    {
      "contactId": "1234567890"
    },
    {
      "contactId": "2345678901"
    }
  ],
  "personalizationDefaults": {
    "first_name": "John",
    "last_name": "Doe"
  },
  "campaignName": "push to contact campaign name"
}

Sample JSON Request Body (with extra parameters)

{  
   "channelQualifiers":[  
      "appkey1",
      "appkey2"
   ],
   "content":{  
      "contentId":null,
      "simple":{  
         "apns":{  
            "aps":{  
               "content-available":1,
               "watch-dynamic":{  
                  "title":{  
                     "text":"The M Hotel NYC",
                     "align":"center",
                     "color":"ffffff"
                  },
                  "body":{  
                     "text":"Luxurious pampering awaits you at Mspa, enjoy 20% off.",
                     "color":"ffffff"
                  },
                  "background":"http://i.imgur.com/n0w2cH7.png",
                  "header":"http://i.imgur.com/lKHAWtI.png"
               }
            },
            "watch-dynamic":{  
               "title":{  
                  "text":"The M Hotel NYC",
                  "align":"center",
                  "color":"ffffff"
               },
               "body":{  
                  "text":"Luxurious pampering awaits you at Mspa, enjoy 20% off.",
                  "color":"ffffff"
               },
               "background":"http://i.imgur.com/n0w2cH7.png",
               "header":"http://i.imgur.com/lKHAWtI.png"
            },
            "dynamic-aps":{  
               "alert":"Hello %%first_name%% %%last_name%%, welcome to Test iPad sale!",
               "badge":1,
               "watch-dynamic":{  
                  "title":{  
                     "text":"The M Hotel NYC",
                     "align":"center",
                     "color":"ffffff"
                  },
                  "body":{  
                     "text":"Luxurious pampering awaits you at Mspa, enjoy 20% off.",
                     "color":"ffffff"
                  },
                  "background":"http://i.imgur.com/n0w2cH7.png",
                  "header":"http://i.imgur.com/lKHAWtI.png"
               }
            },
            "notification-action":{  
               "name":"Visit Acoustic site",
               "value":"http://www.acoustic.com",
               "type":"url",
               "extra":{  
                  "watch-dynamic":{  
                     "title":{  
                        "text":"The M Hotel NYC",
                        "align":"center",
                        "color":"ffffff"
                     },
                     "body":{  
                        "text":"Luxurious pampering awaits you at Mspa, enjoy 20% off.",
                        "color":"ffffff"
                     },
                     "background":"http://i.imgur.com/n0w2cH7.png",
                     "header":"http://i.imgur.com/lKHAWtI.png"
                  }
               }
            },
            "category-actions":[  
               {  
                  "name":"Visit Apple Store",
                  "value":"http://store.apple.com",
                  "type":"url"
               },
               {  
                  "name":"Visit Acoustic site",
                  "value":"http://www.acoustic.com",
                  "type":"url"
               }
            ]
         },
         "gcm":{  
            "alert":{  
               "subject":"my subject",
               "message":"Hello %%first_name%% %%last_name%% welcome to Test iPad app!",
               "expandable":{  
                  "type":"text",
                  "value":"This is a very long text that I used for demonstrating Android's BigText.",
                  "expandable-actions":[  
                     {  
                        "type":"url",
                        "name":"url",
                        "value":"http://www.google.com"
                     },
                     {  
                        "type":"custom",
                        "name":"custom",
                        "value":"myintent"
                     },
                     {  
                        "type":"dial",
                        "name":"phone",
                        "value":"0509473828"
                     }
                  ]
               },
               "notification-action":{  
                  "type":"sendEmail",
                  "value":{  
                     "recipient":"[email protected]",
                     "subject":"Check out this deal!",
                     "body":"Test iPad sale!"
                  }
               }
            }
         }
      }
   },
   "contacts":[  
      {  
         "lookupKeyFields":[  
            {  
               "name":"Mobile User Id",
               "value":"Mobile User Id1"
            }
         ],
         "personalization":{  
            "first_name":"Jason",
            "last_name":"Bourne"
         }
      }
   ],
   "campaignName":"campaign name here"
}

Contact lookup

There are four approaches to target an API push:

  • recipientID – RecipientID is the most basic, where you can simply identify one contact, and we fetch all the consent records for that contact and send messages to them.
  • lookUpKey – lookupKeyFields takes the name of the column and finds it in lm_contact_lookup_key and then searches the lm_contact_lookup table for the value to get the recipientID.
  • Channel – The Channel first finds the lookupKeyFields for the channel and then uses the value to search the same lm_channel_lookup table. Channel is only usable when you are targeting the lookup key used for the Mobile User ID, and more specifically, since it is already a lookup key, you can omit Channel and just use lookupKey instead (see the previous example).
  • device – Push to device is “basically” push to consent where we just look at the consent record for qualifier and destination to fetch the recipientID.

Personalization

Personalization is very unique in Push to contact. We have three levels of personalization based on five priorities:

  1. Inline Personalization – When personalization is provided with every contact
  2. Contact Lookup Personalization – First and last name is provided in Engage
  3. Default Personalization – Greeting such as ‘Dear Valued Customer’ is used if Inline Personalization or Contact Lookup Personalization is not used

First we fetch the personalization provided for the contact. If the fields that were provided match all the personalization fields in the content then we do not have to look any further. If all fields are not provided, then we look at the actually contact and fetch the columns and personalize using that. If that is not enough then the default personalization is used. In the code we merge the maps and apply personalization in one go.

Flexible payload is also supported

Example 1

{
   "aps": {
       "alert": "Bob wants to play poker",
       "badge": 5,
       "flexible properties here": {}
   },
   "notification-action": {
       "type": "mytype",
       "value": "myvalue",
       "flexible properties here": {}
   },
   "flexible properties here": {}
}

Example (watch-dynamic could include more items like map and logo): 
{
aps:{}
 
"watch-dynamic":{
        "title": {"text": "The M Hotel NYC" ,
                      "align":"center",
                       "color" : "ffffff"},
        "body": {"text": "Luxurious pampering awaits you at Mspa, enjoy 20% off.",
                        "color" : "ffffff"},
        "background":"http://i.imgur.com/n0w2cH7.png",
        "header": "http://i.imgur.com/lKHAWtI.png"
    }
}

Example 2

{
"channelQualifiers": [
  "appkey1",
],
"content": {
  "simple": {
    "gcm": {
      "alert": {
        "subject": "Don't miss this sale!",
        "message": "Dear %%first_name%% %%last_name%%!  Welcome to our annual sale at %%event_description%%!  Don't forget to tell all your friends about this deal!",
        "notification-action": {
          "name": "Open URL",
          "value": "https://store.google.com/category/phones",
          "type": "url"
        }
      }
    }
  }
},
"personalizationDefaults": {
  "first_name": "Valued",
  "last_name": "Customer",
  "event_description": "Some event"
},
"contacts": [
  {
    "contactId": 1,
    "personalization": {
      "first_name": "Mary",
      "last_name": "Jane",
      "event_description": "Google store online"
    }
  },
  {
    "contactId": 10,
    "personalization": {
      "event_description": "Amazon.com"
    }
  }
  {
    "contactId": 20
  },
],
"campaignName": "Notification with personalization"
}

Assuming contacts have the following information in the Acoustic Campaign

  • ContactID = 1 – first_name: Evelyn, last_name: Jones
  • ContactID = 20 – first_name: Michael, last_name: Smith
  • ContactID = 30 – first_name: , last_name: – no first_name and last name recorded****

The following personalized messages display

  • ContactID = 1: Dear Mary Jane! Welcome to our annual sale at the Google store online! Don’t forget to tell all your friends about this deal! (Note: Even though the contact has last and first name, the information provided in the personalization map at the contact level would be used.)
  • ContactID = 10: Dear Michael Smith! Welcome to our annual sale at Amazon.com! Don’t forget to tell all your friends about this deal! (Note: First_name, last_name from the contact information in the Acoustic Campaign will be used, but event_description would come from the personalization map at the contact level.)
  • ContactID = 20: Dear Valued Customer! Welcome to our annual sale at Some event! Don’t forget to tell all your friends about this deal! (Note: Since there is no personalization map at the contact level and there is no information in the Acoustic Campaign, personalization defaults will be used)