极光消息推送如何实现个性化文案推送?

极光消息推送如何实现个性化文案推送?

  • 极光推送提供个性化文案推送服务,用户可以通过绑定设备的用户属性值进行个性化参数下发,实现更高的用户点击率。
  • 用户属性:某一类用户信息的统一标识。如:用户昵称、喜好、所在省市等。

支持版本

  • Android SDK 4.8.0 及之后的版本。
  • iOS SDK 4.8.0 及之后的版本。

使用场景

商品促活场景:

          Hi @{{nickname}},你的会员还有{{days}}过期,现在充值可享3折优惠!

        

社交应用场景:

          Hi @{{nickname}},你的评论有{{answer_num}}位好友回复,快来看看吧>>>

        

新增用户属性

支持通过控制台和服务端两种方式新增用户属性。

控制台设置

进入【配置管理】-【用户属性】页面,点击“新增用户属性”。  填写字段属性名称和属性描述,选择字段类型后点击“确定”即可完成用户属性创建。 

服务端设置

服务端调用参考 新增用户属性 API

设置设备的用户属性

支持通过客户端或服务端两种方式绑定设备的用户属性。

客户端设置

服务端设置

详情参考 新增/更新设备的用户属性 API

创建个性化推送文案

参数说明

需要在 options 字段下配置 alternate_set 参数,并在支持的消息类型、平台下配置 title、alternate_title、alert/content/msg_content、alternate_alert/alternate_content 等参数,参数详情详见下表。

若开启个性化文案功能时,无法获取用户属性值,也没有设置备用文案,则属性值会显示为空。如:“Hi @{{nickname}},现在充值会员可享3折优惠!”会显示为“Hi @ ,现在充值会员可享3折优惠!”。

关键字类型父项目含义说明
alertstringnotificationnotification.androidnotification.iosnotification.quick_app通知内容支持设置个性化文案,如:{{name}},name 为应用的用户属性,具体值为设备绑定的属性值。ios 支持 string 或 JSON Object 类型, alert 和 alternate_alert 必须使用同种数据类型。
alternate_alertstringmessagenotificationnotification.androidnotification.iosnotification.quick_appalert 的备用文案仅开启个性化文案功能时有效。当后台查询个性文案的属性值为空时,使用备用文案的值定义 alert。ios 支持 string 或 JSON Object 类型, alert 和 alternate_alert 必须使用同种数据类型。
titlestringmessagenotification.androidnotification.quick_appnotification_3rd通知标题支持设置个性化文案,如:{{name}},name 为应用的用户属性,具体值为设备绑定的属性值。
alternate_titlestringmessagenotification.androidnotification.quick_appnotification_3rdtitle 的备用文案仅开启个性化文案功能时有效。当后台查询个性文案的属性值为空时,使用备用文案的值定义 title。
contentstringnotification_3rd通知内容通知内容
msg_contentstringmessage通知内容通知内容
alternate_contentstringmessagenotification_3rdcontent 或 msg_content 的备用文案仅开启个性化文案功能时有效。当后台查询个性文案的属性值为空时,使用备用文案的值定义 content 或 msg_content。
alternate_setbooleanoptions个性化文案功能开关是否启用个性化文案功能,默认为 false。true: 启用个性化文案功能。false: 关闭个性化文案功能。

示例

          {
    "platform": "all",
    "audience": {
        "registration_id": [
            "160a3797c806b5dbb10"
        ]
    },
    "message": {
        "msg_content": "Hi,{{name}}",
        "alternate_content": "Hi, JPush",
        "title": "msg title {{title}}",
        "alternate_title": "default msg title"
    },
    "notification": {
        "alert": "notification {{content}}",
        "alternate_alert": "notification hello world",
        "android": {
            "alert": "android alert {{content}}",
            "alternate_alert": "android alert hello world",
            "title": "android title {{title}}",
            "alternate_title": "android title hello world"
        },
        "ios": {
            "alert": {
                "title": "ios alert title {{title}}",
                "subtitle": "ios alert subtitle {{subtitle}}",
                "body": "ios alert body {{content}}"
            },
            "alternate_alert": {
                "title": "ios alert title hello",
                "subtitle": "ios alert subtitle hello",
                "body": "ios alert body hello"
            }
        },
        "quickapp": {
            "alert": "quickapp alert {{content}}",
            "alternate_alert": "quickapp alert hello world",
            "title": "quickapp title {{title}}",
            "alternate_title": "quickapp title hello world"
        },
        "winphone": { // winphone不支持
            "alert": "winphone alert",
            "title": "winphone title"
        }
    },
    "notification_3rd": {
        "content": "notification_3rd content {{content}}",
        "alternate_content": "notification_3rd content hello world",
        "title": "notification_3rd title {{title}}",
        "alternate_title": "notification_3rd title hello world"
    },
    "options": {
        "alternate_set": true
    }
}