如何使用CleverTap API发送推送python?

时间:2016-01-31 20:23:30

标签: python api push-notification clevertap

我正在将Parse推送通知数据迁移到CleverTap。我遇到的问题是documentation对它不是很好,而他们提供的examples不包括推送通知。

任何人都有一个如何使用Python发送推送CleverTap API的示例,或者至少证明这是可能的?

1 个答案:

答案 0 :(得分:-2)

文档现在介绍了如何将Parse安装迁移到CleverTap。例如,假设我们正在创建推送通知,以便发送给订阅“yankees”和“mets”频道的用户。

curl -H "Content-Type:application/json"
 -H "X-CleverTap-Account-ID: Your CleverTap Account ID"
 -H "X-CleverTap-Passcode: Your CleverTap Account Passcode"
 --data "@payload"
 "https://api.clevertap.com/1/targets/create.json"

有效载荷

"name": "My API Campaign",
"where": {
    "common_profile_prop": {
        "profile_fields": [
            {
                "name": "channels",
                "value": ["yankees", "mets"]
            }
        ]
    }
},
"content":{
    "title": "Breaking News",
    "body": "Yankees Win 5-4",
    "platform_specific": {
        "ios": {
            "deep_link": "example.com",
            "sound_file": "example.caf",
            "category": "reactive",
            "badge_count": 1,
            "key": "value_ios"
        },
        "android": {
            "background_image": "http://example.jpg",
            "default_sound": true,
            "deep_link": "example.com",
            "key": "value_android"
        }
    }
},
"devices": [
    "android",
    "ios",
],
"when": "now"
}

响应

{
"status": "success",
"id": 1457433898,
"estimates": {
    "android": 90,
    "ios": 300
}
}

希望这会有所帮助。可在此处找到更多文档 - https://github.com/CleverTap/parse-migrate