TPNS supports adding custom parameters to the push text. After you bind custom parameters to the device and create a push, the device will display the message with custom parameters, which can increase the willingness of users to click the message compared to stereotype pushes.
To increase the payment rate for items in cart, you can use the following template:
Hi, @{{nickname}}. There are only {{productnum}} left in stock for the {{productname}} in your cart.
Wanna buy it now?
The push message Tommy receives is as follows:
Hi, @Tommy. There are only 6 left in stock for the penguin doll in your cart. Wanna buy it now?
To reactivate inactive gamers through push, you can use the following template:
Hi, @{{nickname}}, you have not logged in to the game for {{offline_days}} days. We have prepared {{gift_num}} gift packages for you.
Come claim them >>>
The push message Tommy (who has been inactive for 3 consecutive days) receives is as follows:
Hi, @Tommy, you have not logged in to the game for 3 days. We have prepared 6 gift packages for you. Come claim them >>>
To reactivate users who have not opened the application for 3 consecutive days through push, you can use the following template:
Hi, @{{nickname}}. {{friend_num}} friends of yours posted {{story_num}} updates while you were away.
Come check them out >>>
The push message Tommy receives is as follows:
Hi, @Tommy. 8 friends of yours posted 20 updates while you were away. Come check them out >>>
Before pushing a custom message, you need to bind the user attributes to devices in either of the following ways:
For more information on how to bind through APIs, please see User Attribute APIs.
Note:
One push message can contain up to 5 attributes.
To enable custom notification through the API, set ntf_wt_attrs
to true
and add the following fields to message
.
Parameter Name | Type | Required | Description |
---|---|---|---|
default_content | string | Yes | The default message content will be sent to devices if no user attribute is matched. |
default_title | string | Yes for Android, and no for iOS | The default message title will be sent to devices if no user attribute is matched. |
default_subtitle | string | No | The default message subtitle will be sent to devices if no user attribute is matched. |
For more information on other message fields, please see the "message: message body" section in Push API.
Below is a sample push:
{
"audience_type": "token",
"expire_time": 3600,
"message_type": "notify",
"environment":"dev",
"message": {
"title": "Hi, {{name}}",
"content":"You have earned {{score}} points",
"default_content": "Default content",
"default_title": "Default title",
"default_subtitle": "Default subtitle"
},
"token_list": [
"086f959c7aefc3****add2ccf0cd539c1edd"
],
"platform": "android",
"ntf_wt_attrs":true
}
Was this page helpful?