Send a mobile app message to multiple devices using a lookup key field

The Push to Contact API allows an API developer to send app messages to mobile devices, using various formats to address the devices in your mobile database. Here is an excerpt of the Push to Contact API showing the various addressing formats.

PushContact

Attribute

Required

Description

Data type

contactID

No

Acoustic Campaign recipientId takes precedence over LookUpKeyFields

Long

LookUpKeyFields

No

list 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)

No

Lookup key fields to find a specific device

model

personalization

No

Map of key value pairs for personalization

Map ad

One of the simplest means of addressing users is to use the lookup key fields used to in the setup of the mobile enabled database i.e. the mobile user id field. To do this we would use the following JSON within the request packet:

contacts": [
            {"lookupKeyFields" :
              [
                {
                  "name":"Mobile User Id",
                   "value":"1NNl617jvmZjmndI"
                 }
               ]
             }]

As stated in the able above we could also use the following format for the sends :

contacts": [
            {"lookupKeyFields" :
              [
                {
                  "channel":"PUSH",
                   "value":"E0DfBHIxMhXsezOx"
                 }
               ]
             }]

In this format the system will only search the mobile user id lookupkey field, so this could offer some performance improvements.

Now to send to multiple devices with one API call you would need to use the following format in your contacts section.

"contacts": [{
"lookupKeyFields": [{
"name": "Mobile User ID",
"value": "k1qxl1FI6mSKmA7U"
}]
},

{
"lookupKeyFields": [{
"name": "Mobile User ID",
"value": "sSj1DCwGhjeRWhI4"
}]
}
]

We could then also change the format of this call to use the ‘channel’:’PUSH’ variation instead of adding the name of the mobile user id field. You should now be able to address multiple devices using this format:

"contacts": [{
"lookupKeyFields": [{
"channel": "PUSH",
"value": "k1qxl1FI6mSKmA7U"
}]
},

{
"lookupKeyFields": [{
"channel": "PUSH",
"value": "sSj1DCwGhjeRWhI4"
}]
}
]

Did this page help you?