How to send pushes with python using CleverTap API?

1k Views Asked by At

I am in the process of migrating my Parse push notification data to CleverTap. The problem that I am having is that the documentation is not very good about it and the examples that they give don't cover push notifications.

Anyone have an example of how to send pushes with CleverTap API using Python or at least evidence that this is possible?

1

There are 1 best solutions below

2
On

The documentation now covers how to migrate your Parse installations to CleverTap. For example, say we are creating a push notification to be sent to users subscribed to the "yankees" and "mets" channels.

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"

Payload

"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"
}

Response

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

Hope this helps. More documentation can be found here - https://github.com/CleverTap/parse-migrate