post https://cp.pushwoosh.com/json/1.3/createPreset
Creates a new push preset
Creates a new push preset.
Platform-specific parameters:
{
"auth": "yxoPUlwqm…………pIyEX4H", // required, string. API access token from Pushwoosh Control Panel.
"name": "PRESET_NAME", // required, string.
"applicationCode": "XXXXX-XXXXX", // optional, string. Your Pushwoosh application code, can't be used with applicationGroupCode. ApplicationCode or applicationGroupCode is required.
"applicationGroupCode": "AAAAA-BBBBB", // optional, string. Application group code, can't be used with applicationCode. ApplicationCode or applicationGroupCode is required.
"campaignCode": "CCCCC-DDDDD", // optional, string. Campaign code.
"content": { // required, array. Contains message data.
"platforms": { // required, array. Specific content for different platforms.
// Android related
"android": {
"badge": 12, // optional, integer. Android application icon badge number. Use "+n" or "-n" to increment/decrement the badge value by n.
"header": "push header", // optional, string. Android notification header.
"soundOff": false, // optional, boolean. The device will produce no sound upon receiving a push.
"sound": "soundfile", // optional, string. No file extension. If left empty, the device will produce no sound upon receiving a push.
"led": "#18e08e", // optional, string. LED hex color, device will do its best approximation.
"ibc": "#7e9e12", // optional, string. Icon background color on Lollipop, #RRGGBB, #AARRGGBB, "red", "black", "yellow", etc.
"vibration": true, // optional, boolean. Android force-vibration for high-priority pushes.
"customIcon": "some_icon", // optional, string. Full path URL to the image file.
"banner": "some_banner", // optional, string. Full path URL to the image file.
"lockScreen": 0, // optional. (0|1) Show push notification on lock-screen
"rootParams": { // optional. Custom key-value object. Root level parameters for the android payload recipients.
"param1": "value1",
"param2": "value2"
},
"silent": true, // optional. Enables silent notifications (ignore "sound" and "content").
"deliveryPriority": "normal", // optional, string. Valid values are "normal" or "high". Enables notification’s delivery when the device is in the power saving mode.
"priority": 1, // Sets the “importance” parameter for devices with Android 8.0 and higher, as well as the “priority” parameter for devices with Android 7.1 and lower. Establishes the interruption level of a notification channel or a particular notification. Valid values are -2, -1, 0, 1, 2.
"ttl": 172800 // optional, integer. Time to live parameter — maximum message lifespan in seconds.
},
// iOS related
"ios": {
"badge": 12, // optional, integer. iOS application badge number. Use "+n" or "-n" to increment/decrement the badge value by n.
"title": "push title", // optional, string. Adds Title for push notification.
"subtitle": "test subtitle", // optional, string. Adds sub-title for push notification.
"sound": "sound", // optional, string. Sound file name in the main bundle of application. If left empty, the device will produce no sound upon receiving a push.
"customIcon": "some_icon", // optional, string. Adds icon for push notification.
"trimContent": true, // optional, boolean (true|false). Trims the exceeding content strings with ellipsis.
"rootParams": { // optional. Root level parameters to the aps dictionary.
"aps": {
"content-available": "1",
"mutable-content": 1 // required for iOS 10 Media attachments.
},
"attachment": "YOUR_ATTACHMENT_URL", // iOS 10 media attachment URL.
"data": << User supplied data, max of 4KB>>
},
"silent": true, // optional, boolean. Enables silent notifications (ignore "sound" and "content").
"categoryId": 123, // optional, integer. iOS8 category ID from Pushwoosh.
"ttl": 172800 // optional, integer. Time to live parameter — maximum message lifespan in seconds.
},
// Amazon related
"amazon": {
"header": "push header", // optional, string. Amazon notification header.
"sound": "sound", // optional, string. Sound file name in the main bundle of application. If left empty, the device will produce no sound upon receiving a push.
"customIcon": "http://example.com/image.png", // optional, string. Adds icon for push notification.
"icon": "some_icon",
"rootParams": { // optional. Custom key-value object.
"param1": "value1",
"param2": "value2"
},
"banner": "http://example.com/banner.png",
"priority": 2, // priority of the push in Amazon push drawer, valid values are -2, -1, 0, 1 and 2.
"ttl": 172800 // optional, integer. Time to live parameter — maximum message lifespan in seconds.
},
// Windows Phone related
"wphone": {
"type": "Tile", // Windows Phone notification type. 'Tile' or 'Toast'. Raw notifications are not supported. 'Tile' is default.
"frontBackground": "/Resources/Red.jpg", // optional, string. Tile image.
"backBackground": "/Resources/Green.jpg", // optional, string. Back tile image.
"backContent": "content", // optional, string. Back tile content.
"backTitle": "title", // optional, string. Back tile title.
"count": 2 // optional, integer. Badge for Windows Phone notification.
},
// Mac OS X related
"osx": {
"title": "push title", // optional, string. Adds Title for push notification.
"subtitle": "push subtitle", // optional, string. Adds subtitle for push notification.
"badge": 11, // optional, integer. OSX application badge number. Use "+n" or "-n" to increment/decrement the badge value by n.
"sound": "sound", // optional, string. Sound file name in the main bundle of application. If left empty, the device will produce no sound upon receiving a push.
"ttl": 3600, // optional, integer. Time to live parameter — maximum message lifespan in seconds.
"rootParams": {
"content-available": true
}
},
// Windows related
"windows": {
"message": {
"en": {
"headLineText": "english head line text",
"bodyText1": "english body text1",
"bodyText2": "english body text2"
},
"ja": {
"headLineText": "japan head line text",
"bodyText1": "japan body text1",
"bodyText2": "japan body text2"
}
},
"template": "someTemplate",
"image": "image.jpg",
"type": "Badge", // 'Tile' | 'Toast' | 'Badge' | 'Raw'
"tag": "tag", // optional, string. Used in Tile replacement policy. An alphanumeric string of no more than 16 characters.
"cache": 1, // optional. (1|0) Translates into X-WNS-Cache-Policy value.
"ttl": 3600 // optional, integer. Time to live parameter — maximum message lifespan in seconds.
},
// Chrome related
"chrome": {
"title": "push title", // optional, string. Adds Title for push notification.
"icon": "some_icon.ico", // optional, string. Full path URL to the icon or extension resources file path.
"image": "image.jpg", // optional, string. URL to large image.
"rootParams": { // optional, key-value object. Set parameters specific to messages sent to Chrome.
"param1": "value1",
"param2": "value2"
},
"duration": 30, // optional, integer. Changes chrome push display time. Set to 0 to display push until user interacts with it.
"ttl": 172800, // optional, integer. Time to live parameter — maximum message lifespan in seconds.
"button1": { // optional
"text": "button1 text", // optional
"url": "http://button1.url" // optional. Ignored if chrome_button_text1 is not set.
},
"button2": { // optional
"text": "button2 text", // optional
"url": "http://button2.url" // optional. Ignored if chrome_button_text2 is not set.
}
},
// Firefox related
"firefox": {
"title": "push title", // optional. Adds Title for push notification.
"icon": "some_icon.ico", // full path URL to the icon or path to the file in extension resources.
"rootParams": { // optional. Set parameters specific to messages sent to Firefox.
"param1": "value1",
"param2": "value2"
}
},
// Safari related
"safari": {
"title": "push title", // required, string. Title of the notification.
"action": "Click here", // optional. Action button content.
"urlArgs": [ // optional
"firstArgument",
"secondArgument"
],
"ttl": 3600 // optional, integer. Time to live parameter — the maximum lifespan of a message in seconds.
}
}
}
}
Response:
HTTP Status code | status_code | Description |
---|---|---|
200 | 200 | Preset successfully created |
200 | 210 | Argument error. See status_message for more info |
400 | N/A | Malformed request string |
500 | 500 | Internal error |