Use of label function

Last updated: 2020-04-23 19:03:21

PDF

TPNS currently provides two main types of tag functions, including user-defined tags and preset tags maintained on the TPNS platform side.

Overview of label setting

Custom label binding

Custom tag refers to the way that users can define the name of Device tag by themselves.

Binding of custom tags and Unbind

See API Documentation for details: Label binding with Unbind .

All Device under a custom tag of Unbind

See API Documentation for details: Delete all Device under the tag .

Preset label binding

  • Preset tags refer to the tags maintained on the TPNS platform, that is, the tag information automatically collected by SDK when user Device registers or connects to the TPNS server. At present, the preset tags maintained by the TPNS platform include: App version, system version, province, active information, system language, SDK version, country & region, mobile phone brand, mobile phone Model.
  • Each Device will only bind the latest preset tags and automatically mutually exclusive. For example, a Device's App version is currently 1.0.1, and when this Device's App version is upgraded to 1.0.2, the Device and 1.0.1 version tags will be automatically Unbind, and the Device and 1.0.2 version tags will be re-bound.

Device bind tag query

You can query specific preset tags and custom tags according to Device token in the toolbox of Tencent Cloud Management desk.

Custom label Use Cases and keywords

Tag push is suitable for scenarios where there are more than 10 tag-bound Device (generally, the number of Device bound is more than 10) and the push frequency is less (generally, the daily push number of this tag is not more than 10). For tag push scenarios where the number of tags bound to Device is small and the push frequency is high, it is recommended to use account push, that is, to bind multiple Device through the account and use the account instead of the tag for push.

Keywords

Colon ":" is the keyword when the tag is bound, and the key-value segmentation of the user tag. For example, if a user tags a Device token with the tag "level:3", then TPNS Backend Background will use "level" as the key, "3" of this tag as the value, that does not affect the actual push of the user, or press the "level:3" tag to push. Key-value storage is mainly to facilitate the coverage of subsequent similar tags. For example, this Device token is also bound with other tags, such as "male", that is, it is time for Device to have two tags, "male" and "level:3". If the membership level corresponding to this Device is upgraded to level 4, users want to overwrite the "level:3" tag with the "level:4" tag without affecting the "male" tag. At this time, you can directly call the kv overlay API to set the "level:4" tag for this Device. The tags bound to the Device token are changed to "male" and "level:4".

Bind / Unbind tag scene

TPNS provides single tag binding / unbinding single Device, single tag binding / Unbind multi-Device, multi-tag binding / unbinding single Device, multi-tag binding / Unbind multi-Device interface.

Single label Device

  1. Call the terminal SDK API, for example, automatically obtain the user subscription channel in App, bind the channel tag to Device token, and vice versa.
  2. Call rest API infrequently, such as when accessing the test.

Label binding usage

{
    "operator_type": 1,
    "platform": "android",
    "tag_list": ["tag"],
    "token_list": ["token"]
}

Unbind usage of label

{
    "operator_type": 2,
    "platform": "android",
    "tag_list": ["tag"],
    "token_list": ["token"]
}

Use Limits

  • A maximum of 50 bytes per label
  • The interface call logic is synchronous.

Multi-label single Device

  1. Call the terminal SDK API, such as App to automatically obtain user characteristic information, such as age, province, gender and other tag information, and bind these tags to user Device token. Otherwise, batch Unbind
  2. Call rest API, for example, App operators get Device's subscription information from other channels in the company, such as being single, like football, watching movies, etc., and bind these tags to the user Device token, otherwise carry out batch Unbind.

Label binding usage

{
    "operator_type": 3,
    "platform": "android",
    "tag_list": ["tag1","tag2"],
    "token_list": ["token"]
}

Unbind usage of label

{
    "operator_type": 4,
    "platform": "android",
    "tag_list": ["tag1","tag2"],
    "token_list": ["token"]
}

Use Limits

  • Each label has a maximum of 50 bytes.
  • The maximum number of tags per call is 500.
  • The interface call logic is synchronous.

There are many Device with a single label.

(1) at this time, only rest API can be called. If App operators want to tag all football-loving users, they can use this API to bind them in batches, and vice versa, to batch Unbind.

Label binding usage

{
    "operator_type": 7,
    "platform": "android",
    "tag_list": ["tag"],
    "token_list": ["token1","token2"]
}

Unbind usage of label
{
    "operator_type": 8,
    "platform": "android",
    "tag_list": ["tag"],
    "token_list": ["token1","token2"]
}

Use Limits

  • Each label has a maximum of 50 bytes.
  • The maximum number of calls to Device token is 500.
  • The interface call logic is synchronous.

Multi-tag and multi-Device

(1) at this time, only rest API can be called. If App operators want to label football users who like football and basketball users who like basketball, they can use this API for batch binding and otherwise batch Unbind.

Label binding usage
{
    "operator_type": 9,
    "platform": "android",
    "tag_token_list": [{"tag":"tag1","token":"token1"},{"tag":"tag2","token":"token2"}]
}

Unbind usage of label
{
    "operator_type": 10,
    "platform": "android",
    "tag_token_list": [{"tag":"tag1","token":"token1"},{"tag":"tag2","token":"token2"}]
}

Use Limits

  • Each label has a maximum of 50 bytes.
  • The maximum number of calls to Device token is 500.
  • The interface call logic is synchronous.

Label overrides the scene

TPNS provides two kinds of label coverage, one is ordinary coverage, but by label category coverage, also known as kv coverage, when the ":" sign is the keyword, as the delimiter of the key-value value.

General coverage

  1. Call the terminal SDK interface. If all the channel information subscribed by Device has become invalid, you need to Unbind these channel tags and Device one by one, but it will be very inconvenient to put these channel tags traversal out one by one Unbind, so you can call this API to override them at this time.
  2. Call rest API. If the App operator wants to re-tag Device, he does not want this Device to be disturbed by the previous tag, so he can call this API to override it.

Label coverage usage

{
    "operator_type": 6,
    "platform": "android",
    "tag_list": ["test", "level:1",, "level:2"], 
    "token_list": ["token"]
}

Use Limits

  • Each label has a maximum of 50 bytes.
  • The API call logic is asynchronous, and it is recommended that the frequency interval of the call is more than 1 second.

Kv coverage

(1) call the terminal sdk interface
(2) call rest API
** Instructions for use: ** Divide the tag with ":", "before" as the tag category, ":" as the specific value of this tag, for example, level:2 indicates that the level of Device is level 2. If the level corresponding to Device is upgraded to level 3, you need to delete the level:2 tag first and add the level:3 tag. If the customer clearly knows that Device has only the level:2 tag, you can call the ordinary override API to override it. However, often a Device corresponds to multiple tags. For example, the Device also corresponds to a test tag. To accurately delete the level:2 tag, you need to maintain all the tags corresponding to the Device, or call the XGPush tpns API to find and delete the historical tag corresponding to the Device. This brings a lot of inconvenience, so you can call this API to cover only the level tags.

Label coverage usage

{
    "operator_type": 6,
    "platform": "android",
    "tag_list": ["test:2", "level:3"], 
    "token_list": ["token"]
}

** API description: ** Kv overwriting occurs when and only if all tags in the tag_list are marked with ":". For example, the token already has a test,level:1 tag, and when the secondary API is called, the tag list of the token becomes test, test:2, level:3.

Use Limits

  • A maximum of 50 bytes per label
  • The maximum number of tags per call is 500.
  • The API call logic is asynchronous, and it is recommended that the frequency interval of the call is more than 1 second.

Delete tag scen

TPNS provides two ways to delete tags, one is to delete all tags corresponding to a single Device, and the other is to delete a tag corresponding to an application.

Delete all tags corresponding to single Device

  1. Call the terminal SDK interface.
  2. Call rest API.

** Instructions for use: ** You can use this API to delete all the historical tags corresponding to Device, generally aiming at the Expire tags corresponding to Device, or the scenes in which Device is tagged again due to operational errors made by the operator.

Usage of label deletion

{
    "operator_type": 5,
    "platform": "android", 
    "token_list": ["token"]
}

Use Limits

  • A maximum of 50 bytes per label
  • The API call logic is asynchronous, and it is recommended that the frequency interval of the call is more than 1 second.

Delete a tag corresponding to the application

(1) only rest API can be called at this time.
** Note: ** You can use this API to delete some tags corresponding to the application, that is, after all Unbind, these tags and the corresponding bound Device are removed from the list of applied tags, and are generally applied to some completely abandoned tags, such as some test tags introduced during testing. After Activate, these test tags are removed.

Usage of label deletion

{
    "tag_list": ["tag1", "tag2"]
}

Use Limits

  • Each label has a maximum of 50 bytes.
  • The maximum number of tags per call is 500.
  • The API call logic is asynchronous, and it is recommended that the frequency interval of the call is more than 1 second.

Label push

Tag push supports single-tag and multi-tag push, but currently only supports combined push (and or combination) of similar tags, that is, if it is a custom tag push, it can only be pushed with a custom tag, and if it is a preset tag push, it can only be pushed by a combination of similar preset tags, that is, it can be pushed to users in Guangdong Province and Hunan Province, but not to Guangdong Province. And it is a combined push by active users in the past 3 days.

Console label push

Tencent Cloud manages Taichung for label push.

  1. First select the tag type, optional custom tags, and certain types of preset tags;

  2. After the label type is selected, you can select the specific label you want to push.
    After the tag is selected, the number of bound Device corresponding to the selected tag is also displayed.

  3. After the label is selected, you can choose whether to push or push.
    Among them, "any one" means or pushes, that is, Device who has bound one of the selected tags is pushed, and "all" means and pushes, that is, Device who has bound all the selected tags is pushed.

Call API tag push

See synonyms at specific Push interface Document.

Example of the best push scenario for custom tags

Kv tag override (renewal notification)

App A wants to push the renewal notice for users whose members expire in 3 days, assuming that the tag bound to Device token is "football;". And "deadline:20200210", if you renew it for one month on February 9, 2020, you need to replace "deadline:20200210" with the tag "deadline:20200310", that is, the tag category deadline can only have one value (the latest value). In this case, you can call the kv override API provided by TPNS. Without affecting other tags, Unbind's "deadline:20200210" tag is then bound to the "deadline:20200310" tag for push (timing push can be set). Select the tag with the tag time of the day + 3 days. If the date of the day is 20200307, you can select the tag "deadline:20200310" to push the renewal notification.

Bind when the lecture is subscribed, Unbind at the end of the lecture

There are many famous lectures in Application B. it is hoped that when the lecture is about to begin, users who subscribe to this lecture will be notified that the lecture is about to start. This scenario can be done when users subscribe to a lecture, such as "how does novel coronavirus protect?" For the lecture, the topic of this lecture "how to protect novel coronavirus" is used as a tag to bind to this user Device token. When the lecture is about to start, select the tag "novel coronavirus how to protect" for the upcoming push of the lecture. When the lecture is over, call the Unbind tag interface of TPNS to Unbind the "novel coronavirus how to protect" tag and Device token.

FAQs

  1. Can you open up API who binds Device data according to the tag?
    This API is temporarily used internally. From the point of view of protecting the stability of the system, there is no plan to open it. You can check the number of Device bound to it after selecting the corresponding tag on the push page of the console.

  2. Can you open up API who is bound to the tag according to Device token?
    This API is temporarily used internally. From the point of view of protecting the stability of the system, there is no plan to open it. You can enter the tag bound to the token query in the console toolbox.