The method for sending push notifications with images using the Pushwoosh API depends on which API endpoint you are utilizing.
You can directly specify image URLs within your /createMessage API request payload using platform-specific parameters.
iOS
Use the ios_attachment
parameter. Provide the direct URL to your image.
Note, you have to integrate Notification Service Extension to support this feature for your app. How to do this: iOS rich notifications integration.
{
"request": {
"application": "YOUR_APPLICATION_CODE",
"auth": "YOUR_API_ACCESS_TOKEN",
"notifications": [
{
"send_date": "now",
"content": "Your message here",
"ios_attachment": "https://example.com/path/to/your/image.png"
// ... other parameters
}
]
}
}
Android
You can use several parameters for images, such as:
-
android_icon
: URL for a small notification icon. -
android_custom_icon
: URL for a larger custom icon. -
android_banner
: URL for a banner image that appears in the expanded notification.
{
"request": {
"application": "YOUR_APPLICATION_CODE",
"auth": "YOUR_API_ACCESS_TOKEN",
"notifications": [
{
"send_date": "now",
"content": "Your message here",
"android_banner": "https://example.com/path/to/your/banner_image.png"
// ... other parameters
}
]
}
}
For detailed information on these and other parameters, please refer to the official Pushwoosh /createMessage
API documentation.
Comments
0 comments
Article is closed for comments.