It's not recommended to use token to send transactional push notificaiton, as it might change, please use Pushbots ObjectId instead.


When your user opens your app for the first time we communicates with Google servers in case of Android, and Apple servers in case of iOS to generate a unique ID for this device. This registration ID is important in case you wanted to re-target this device again in the future. 

To get the registration ID via PushBots you can use the following method: 

For iOS
objective-c

 [Pushbots getDevice:^(NSDictionary *device, NSError *error) {
    if(device != nil){
        NSLog(@"Token: %d", [device valueForKey:@"token"]);
    }
}];

swift

Pushbots.getDevice { (device, error) in
    if(device != nil){
        let device_token = device?["token"]
        print(device_token! as! NSString)
    }
}


For Android 

//Register custom fields after user registered on PushBots
Pushbots.sharedInstance().idsCallback(new Pushbots.idHandler() {
    @Override
    public void userIDs(String userId, String registrationId) {
        if (registrationId != null && userId != null){
            Log.d("PB3", "Registration ID:" + registrationId );
        }
    }
});


For Phonegap/Cordova


//Get user registrationId/token and userId on PushBots, with evey launch of the app even launching with notification
window.plugins.PushbotsPlugin.on("user:ids", function(data){
console.log("token" + data.token);
});


For web:

PB.events.push(["onRegisteredOnPushBots", function(data){
console.log("Token:", data.subscriptionId);
}]);

Did this answer your question?