Tencent Push Notification Service 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. This makes the push more attractive, so users are more likely to click on it.
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 using either of the following methods:
For the iOS SDK, see here.
For the Android SDK, see here.
To bind user attributes via the RESTful API, see here.
Note:One push supports adding up to 5 attributes at a time.
To enable the custom notification via the API, set ntf_wt_attrs
to true
and add the following fields to message
.
Parameter | 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 about other message fields, see the “message: message body” section in Push API.
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"
],
"ntf_wt_attrs":true
}
Was this page helpful?