The error "Please select at least one platform" from the /createMessage
API means that your API request doesn't correctly specify which platform(s) (e.g., iOS, Android) the notification should be sent to. It can also occur if your application in the Pushwoosh Control Panel isn't configured for any platforms, though this is less common if you've set up your app.
To resolve this, ensure your API request payload correctly specifies the target platform(s):
Check Application Configuration: First, verify in the Pushwoosh Control Panel that your application is configured for the platform you are targeting (e.g., iOS is enabled with a valid certificate).
Specify Platform in API Request: There are a few ways to specify platforms in your
/createMessage
request. The most straightforward is often by ensuring your notification content is structured correctly for the intended platform.For iOS, you would typically include iOS-specific parameters within your
notifications
array object. If you are sending a simple cross-platform message, you might also use theplatforms
parameter.Example for iOS using iOS-specific parameters:
{ "request": { "application": "YOUR_APPLICATION_CODE", "auth": "YOUR_API_ACCESS_TOKEN", "notifications": [{ "send_date": "now", "content": "Your message content for iOS", "ios_badges": "+1", // iOS-specific parameter "ios_sound": "default", // iOS-specific parameter // You can add other iOS specific parameters like ios_title, ios_subtitle, etc. "devices": ["DEVICE_HWID_1", "DEVICE_HWID_2"] // Optional: target specific devices }] } }
Example using the
platforms
parameter (less common if also using platform-specific content blocks): If you are sending a very generic message and want to explicitly define platforms at the root of the notification object (though typically platform-specific keys likeios_badges
imply the platform):{ "request": { "application": "YOUR_APPLICATION_CODE", "auth": "YOUR_API_ACCESS_TOKEN", "notifications": [{ "send_date": "now", "content": "Your generic message content", "platforms": [1] // 1 for iOS, 3 for Android, etc. // "devices": ["DEVICE_HWID_1"] // Optional }] } }
Platform codes for the
platforms
array:1
(iOS),3
(Android),5
(Windows Phone), etc. Refer to the Pushwoosh API documentation for the complete list and detailed payload structures.Ensure your payload is well-formed JSON and that the platform targeting is unambiguous. Using platform-specific keys (like
ios_xxx
,android_xxx
) within the notification object is often the clearest way to target platforms when providing rich content.
Comments
0 comments
Please sign in to leave a comment.