Importing historical push tokens

Leanplum automatically captures the push tokens of your existing users the first time they open the app version that is live with the Leanplum SDK.

However, you may want to start sending push notifications to existing users before they come back to the app, especially to re-engage lapsed users or reach users who have yet to upgrade to the latest version.

To reach these existing users, you can upload any pre-existing iOS push tokens or Android GCM registration IDs using Leanplum’s REST API, specifically the setDeviceAttributes API call.

You’ll need the following data to upload your users' push tokens:

  • Device ID
  • iOS Push token or GCM registration ID
  • User ID (Optional but highly recommended if you will be setting your own user ID)

🚧

You must use the same format of device ID with the Leanplum SDK and your historical token data. Learn more about which device ID format to use .

Device attributes

Prepare your csv file

First, prepare your CSV with your device attributes

FieldData typeRequired?Description
userIdStringYES (if you set User IDs in Leanplum)The user id. It must be the first column of the CSV file.
deviceIdStringYESThe device id. A single user may have multiple device ids.
iosPushTokenStringNOUse this to set the iOS push token of the device. Push tokens are device specific, so in the CSV file, you must specify which deviceId this token belongs to. This is done by having the device ID and the push token on the same row.
systemNameStringNoThe value should be either iOS or Android OS. This must match the push token type you are uploading.
gcmRegistrationIdStringNOUse this to set the Android push token of the device. Push tokens are device specific, so in the CSV file you must specify which deviceId this token belongs to. This is done by having the deviceId and the push token on the same row.

Sample file:

userIddeviceIdsystemNameiosPushTokengcmRegistrationId
sample_user1ABC-123iOS1234567
sample_user2ABC-456Android OS7654321

Copy your API keys

3144