Account Package Push

Last updated: 2021-05-28 14:33:57

    Use Cases

    After you get a batch of user accounts from a third-party data platform or business backend, when launching a marketing campaign for such users, you don't need to call the single account push API separately; instead, you can directly use the batch account push feature to push messages to accounts in batches.

    Note:

    The abovementioned accounts must be bound to a TPNS token. For detailed directions, please see Binding an account (Android) or Adding account (iOS).

    Directions

    Console

    1. Log in to the TPNS console.
    2. Find the application for which to configure batch push and select Create Push in its Operation column to enter the Create Push page.
    3. In the Push Target configuration item, select Batch accounts, upload an account package file, and choose to push to the recent or all devices bound to each account as shown below:
      Note:

      Requirements for the uploaded account package:

      • Account package file name: [1, 100] characters
      • Account package format and size: .zip, .txt, or .csv file within 100 MB
      • .zip file requirements: can contain a single .txt or .csv file but not folders
      • .txt file requirements: encoded in UTF-8; one account ([2, 100] characters) per row
      • .csv file requirements: one column only; one account ([2, 100] characters) per row
    4. Click Preview. After confirming that the push configuration is correct, click Confirm to complete the account package push task.

    RESTful API

    Step 1. Call the account package upload API

    Upload your account package file as instructed in Account Package Upload API. After the call succeeds, an upload_id will be returned, such as 11231.

    Step 2. Call the push API

    When you call the push API, set audience_type (push target) to package_account_push (account package push), enter the upload_id (such as 11231) obtained in Step 1, and choose to push to the recent or all devices bound to each account by setting the account_push_type field.

    Sample push

    The following sample pushes a message to users who have won prizes in a marketing campaign:

    
    {
      "audience_type": "package_account_push",
      "upload_id": 11231,
    "account_push_type":0,
      "message_type": "notify",
      "message": {
          "title": "Congrats on winning in the campaign",
          "content":"Get online to claim your prize!"        
      },
      "platform": "android"
    }