The current Swrve SDKs can request push device tokens as soon as the app loads or at a later time, such as after a tutorial. For more information about integrating push notifications in Swrve, see the platform-specific integration guides.
Bulk push token upload
If you have already collected a set of push device tokens for the users of your app, you can upload these directly to Swrve. The Swrve service does not currently provide a tool to enable the bulk upload of push tokens from a CSV file; however, you can perform bulk uploads using the Swrve Events API.
Swrve stores the push device tokens as regular user properties. For iOS users (for APNS), set the user property swrve.ios_token to be the token data for the device formatted as a string as illustrated below:
NSData* deviceToken = ..... // your token
NSString* tokenString = [[[deviceToken description] stringByTrimmingCharactersInSet:
stringByReplacingOccurrencesOfString:@" " withString:@""];
For a Google Play-enabled Android app (using FCM), set the user property swrve.gcm_token to be the token data for your user.
To set the user property using the REST API, send a HTTP POST to the /user/ endpoint, setting the appropriate user property for APNS or FCM. For more information about the Swrve Events API, see Swrve Events API guide. As with any server-to-server calls to mass-update user properties, be sure to set the user_initiated flag to false so that Swrve does not count that event as activity for the user; you want to avoid triggering a spike in KPIs such as DAU and the re-engagement KPIs as a result of updating several thousand users.
Push token update period
Swrve performs several batch jobs throughout the day to find users with push device tokens registered and then loads any new device tokens into the push notification system. Therefore, it can take up to six hours to add non-QA users to the system, depending on when the batch job is run and your company’s time zone. The number of devices registered on the Push Notifications screen for your app is updated regularly to include new users, but they may not be immediately available to send push notifications to, depending on the timing of the batch run (this does not apply to testing push notifications on QA devices). For more information about this screen, see Intro to push notifications.