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
Field | Data type | Required? | Description |
---|---|---|---|
userId | String | YES (if you set User IDs in Leanplum) | The user id. It must be the first column of the CSV file. |
deviceId | String | YES | The device id. A single user may have multiple device ids. |
iosPushToken | String | NO | Use 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. |
systemName | String | No | The value should be either iOS or Android OS. This must match the push token type you are uploading. |
gcmRegistrationId | String | NO | Use 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:
userId | deviceId | systemName | iosPushToken | gcmRegistrationId |
---|---|---|---|---|
sample_user1 | ABC-123 | iOS | 1234567 | |
sample_user2 | ABC-456 | Android OS | 7654321 |
Copy your API keys
Updated over 3 years ago