Push Token Import

The Vibes Platform supports migrating push tokens that have already been collected by marketers to target their customer. Performing this migration makes the customer's devices immediately addressable for push notifications via the Vibes platform.

Creating an Import Batch

The push token import is processed in batches. Each batch can contain up to and including 1000 push devices. The batch is processed asynchronously, so an immediate response is returned which includes a batch_id for checking on results of import later.

Below is the API for submitting a batch of tokens for migration.

POST /mobile_apps/:app_id/migrations/import_batches

Note:

  • A 413 error is thrown if there are more than 1000 entries in the batch being imported.
  • A 404 error is thrown if the batch_id or app_id is invalid.

Request Body

{
  devices: [  
        {  
          platform: "IOS",  
          token: "APNSToken",  
          external_person_id: "ABC123"  
        },  
        {  
          platform: "ANDROID",  
          token: "FCMToken"  
        }  
    ]
}

Response Body

{
    "batch_id": "abcd-12343",
    "received_on": "2021-02-04T11:09:22:386Z ",
    "success_count": 0,
    "failure_count": 0,
    "pending_count": 2,
    "pending": [  
        {  
            "token": "APNSToken",  
            "status": "PENDING"  
        },  
        {  
            "token": "FCMToken",  
            "status": "PENDING"  
        }  
    ]
}

Fetching an Import Batch

Using the batch_id in the above response, the API can be used to fetch results of devices being imported within the batch.

Below is the API for fetching the status of one batch of device imports. It is recommended that a fetch operation is performed at least 15 minutes after the initial import of a batch of devices.

GET /mobile_apps/:app_id/migrations/import_batches/:batch_id

Note: a 404 error is thrown if the batch_id or app_id is invalid.

Response Body

{  
    "batch_id": "abcd-12343",  
    "received_on": "2021-02-04T11:09:22:386Z ",  
    "success_count": 1,  
    "failure_count": 1,  
    "pending_count": 0,  
    "success": [  
        {  
            "token": "APNSToken",  
            "status": "SUCCESS",  
            "platform_status": "200",  
            "platform_message": "Success"  
        }  
    ],  
    "failure": [  
        {  
            "token": "FCMToken",  
            "status": "FAILURE",  
            "platform_status": "failure",  
            "platform_message": "Invalid token"  
        }  
    ]  
}\

Fetching a Summary of Imports

A summary of imports can be fetched, which can help in knowing the status of multiple previously submitted import batches at once.

Below is how to fetch that summary.

GET /mobile_apps/:app_id/migrations/import_batches

Note: a 404 error is thrown if the app_id is invalid.

Response Body

[  
    {  
        "batch_id": "abcd-12343",  
        "received_on": "2021-02-04T11:09:22:386Z ",  
        "success_count": 0,  
        "failure_count": 0,  
        "pending_count": 2  
    },  
    {  
        "batch_id": "uvwxyz-678910",  
        "received_on": "2021-04-19T15:47:57:498Z ",  
        "success_count": 0,  
        "failure_count": 0,  
        "pending_count": 5  
    }  
]\

Fetching Status of a Single Device

It is possible to find the status of import of a single device. This involves the use of the push token submitted for import into the Vibes Platform as a key to find the relevant record.

Below is how to fetch the status for a single device.

GET /mobile_apps/:app_id/migrations/device_migrations/:token

Note: a 404 is returned if no push token matches the supplied token or the app_id is not valid

Response Body

[  
    {  
        "batch_id": "abcd-12343",  
        "received_on": "2021-02-04T11:09:22:386Z ",  
        "status": "SUCCESS",  
        "platform_status": "Success",  
        "platform_message": "Success"  
    }  
]

Note: As a single device could be submitted as more than one import, the result set is formatted as an array.