OneSignal API properties specific to the push notification channel.

Push Notification Content

If you are sending push notifications, use the following parameters. Read more in supported languages.

ParameterTypePlatformDescription
contentsobjectAll - PushRequired unless content_available=true or template_id is set.

The notification's content (excluding the title), a map of language codes to text for each language.

Each hash must have a language code string for a key, mapped to the localized text you would like users to receive for that language.

Any language codes used must also be used within headings property.

This field supports Message Personalization.

English must be included in the hash.

Example: {"en": "English Message", "es": "Spanish Message"}
headingsobjectAll - PushRequired for Huawei
Web Push requires a heading but can be omitted from request since defaults to the Site Name set in OneSignal Settings.

The notification's title, a map of language codes to text for each language. Each hash you wish to include must have a language code string for a key mapped to the localized text you would like users to receive for that language.

Any language codes used must also be used within contents property.

This field supports tag substitutions.

Example: {"en": "English Title", "es": "Spanish Title"}
subtitleobjectiOS 10+

The notification's subtitle, a map of language codes to text for each language. Each hash must have a language code string for a key, mapped to the localized text you would like users to receive for that language.
This field supports tag substitutions.


Example: {"en": "English Subtitle", "es": "Spanish Subtitle"}

template_idstringAllUse a template you setup on our dashboard. The template_id is the UUID found in the URL when viewing a template on our dashboard.

Example: be4a8044-bbd6-11e4-a581-000c2940e62c
content_availablebooleaniOSSending true wakes your app from background to run custom native code (Apple interprets this as content-available=1). Note: Not applicable if the app is in the "force-quit" state (i.e app was swiped away). Omit the contents field to prevent displaying a visible notification.
mutable_contentbooleaniOS 10+Always defaults to true and cannot be turned off. Allows tracking of notification receives and changing of the notification content in your app before it is displayed. Triggers didReceive(_:withContentHandler:) on your UNNotificationServiceExtension.
target_content_identifierstringiOS 13+Use to target a specific experience in your App Clip, or to target your notification to a specific window in a multi-scene App.

Attachments

These are additional content attached to push notifications, primarily images.

ParameterTypePlatformDescription
dataobjectAllA custom map of data that is passed back to your app. Same as using Additional Data within the dashboard. Can use up to 2048 bytes of data.

Example: {"abc": 123, "foo": "bar", "event_performed": true, "amount": 12.1}
huawei_msg_typestringHuaweiUse "data" or "message" depending on the type of notification you are sending. More details in Data & Background Notifications.
huawei_categorystringHuaweiMessaging self-classification categories for sending to users in China (which requires an approved self-classification application). Default category is set to MARKETING, which are subject to limitations of 2-5 daily sends, depending on which third-level classifications they fall in. More details in our Huawei Setup Guide

- IM
- VOIP
- SUBSCRIPTION
- TRAVEL
- HEALTH
- WORK
- ACCOUNT
- EXPRESS
- FINANCE
- DEVICE_REMINDER
- MAIL
- MARKETING
urlstringAllThe URL to open in the browser when a user clicks on the notification.

Example: https://onesignal.com

Note: iOS needs https or updated NSAppTransportSecurity in plist

This field supports tag substitutions.

Omit if including web_url or app_url
web_urlstringPush - All BrowsersSame as url but only sent to web push platforms.
Including Chrome, Firefox, Safari, Opera, etc.
app_urlstringPush - Mobile AppsSame as url but only sent to app platforms.
Including iOS, Android, macOS, Windows, ChromeApps, etc.
ios_attachmentsobjectiOS 10+Adds media attachments to notifications. Set as JSON object, key as a media id of your choice and the value as a valid local filename or URL. User must press and hold on the notification to view.

Do not set mutable_content to download attachments. The OneSignal SDK does this automatically.

Example: {"id1": "https://domain.com/image.jpg"}
big_picturestringAndroidPicture to display in the expanded view. Can be a drawable resource name or a URL.
huawei_big_picturestringHuaweiPicture to display in the expanded view. Can be a drawable resource name or a URL.
chrome_web_imagestringChrome 56+Sets the web push notification's large image to be shown below the notification's title and text. Please see Web Push Notification Icons.

Works for Chrome for Windows & Android only. Chrome for macOS uses the same image set for the chrome_web_icon.
adm_big_picturestringAmazonPicture to display in the expanded view. Can be a drawable resource name or a URL.
chrome_big_picturestringChromeAppLarge picture to display below the notification text. Must be a local URL.
huawei_bi_tagstringHuaweiTag on a message in a batch delivery task used for confirmed delivery stats. The tag is returned to your server when Push Kit sends the message receipt, which can then be used for numerical analysis.

Action Buttons

These add buttons to push notifications, allowing the user to take more than one action on a notification. Learn more about Action Buttons.

ParameterTypePlatformDescription
buttonsarray_objectiOS 8.0+, Android 4.1+, and derivatives like Amazon

Buttons to add to the notification. Icon only works for Android.
Buttons show in order of array position.
"id", "text", and "icon" must all be of type String.


Example: [{"id": "id1", "text": "first button", "icon": "ic_menu_share"}, {"id": "id2", "text": "second button", "icon": "ic_menu_send"}]

web_buttonsarray_objectChrome 48+Add action buttons to the notification. The id field is required.



Example: [{"id": "like-button", "text": "Like", "icon": "http://i.imgur.com/N8SN8ZS.png", "url": "https://yoursite.com"}, {"id": "read-more-button", "text": "Read more", "icon": "http://i.imgur.com/MIxJp1L.png", "url": "https://yoursite.com"}]

ios_categorystringiOSCategory APS payload, use with registerUserNotificationSettings:categories in your Objective-C / Swift code.



Example: calendar category which contains actions like accept and decline



iOS 10+ This will trigger your UNNotificationContentExtension whose ID matches this category.

icon_typestringiOS

In iOS you can specify the type of icon to be used in an Action button as being either ['system', 'custom']

Appearance

These parameters let you adjust icons, badges, and other appearance changes to your push notifications.

Android & Huawei Notification Categories / Channels

  • Allows customizing Importance, Sound, Vibration, LED Color, Badges, and Lockscreen Visibility.
  • Required to customize these options on Android 8 (Oreo) based devices.
    • OneSignal SDK handles fallback to Android 7 and older, no need to set field level values if android_channel_id is set.
  • See the Category documentation on more details on creating and using them.

Icons - Different platforms handle icons differently.

Badges - Useful to indicate to the user the number of notifications outstanding.

  • iOS - Can customize the number badge number on the app icon.
  • Android - Always reflects the number of notifications in the shade.
    • The OneSignal SDK automatically handles this behavior.
ParameterTypePlatformDescription
android_channel_idUUIDAndroidThe Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id.
huawei_channel_idUUIDHuaweiThe Android Oreo Notification Category to send the notification under. See the Category documentation on creating one and getting it's id.
existing_android_channel_idstringAndroidUse this if you have client side Android Oreo Channels you have already defined in your app with code.
huawei_existing_channel_idstringHuaweiUse this if you have client side Android Oreo Channels you have already defined in your app with code.
android_background_layoutobjectAndroid⚠Deprecated, this field doesn't work on Android 12+

Allowing setting a background image for the notification. This is a JSON object containing the following keys. See our Background Image documentation for image sizes.



image - Asset file, android resource name, or URL to remote image.



headings_color - Title text color ARGB Hex format. Example(Blue): "FF0000FF".



contents_color - Body text color ARGB Hex format. Example(Red): "FFFF0000"



Example: {"image": "https://domain.com/background_image.jpg", "headings_color": "FFFF0000", "contents_color": "FF00FF00"}

small_iconstringAndroidIcon shown in the status bar and on the top left of the notification. Set the icon name without the file extension.
If not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name.
See: How to create small icons
huawei_small_iconstringHuaweiIcon shown in the status bar and on the top left of the notification.
Use an Android resource path (E.g. /drawable/small_icon).
Defaults to your app icon if not set.
large_iconstringAndroidCan be a drawable resource name (exclude file extension) or a URL.
See: How to create large icons
huawei_large_iconstringHuaweiCan be a drawable resource name or a URL.
See: How to create large icons
adm_small_iconstringAmazonIf not set a bell icon will be used or ic_stat_onesignal_default if you have set this resource name.
See: How to create small icons
adm_large_iconstringAmazonIf blank the small_icon is used. Can be a drawable resource name or a URL.
See: How to create large icons
chrome_web_iconstringChromeSets the web push notification's icon. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices.
chrome_web_imagestringChromeSets the web push notification's large image to be shown below the notification's title and text. Please see Web Push Notification Icons.

Works for Chrome for Windows & Android only. Chrome for macOS uses the same image set for the chrome_web_icon.
chrome_web_badgestringChromeSets the web push notification icon for Android devices in the notification shade. Please see Web Push Notification Badge.
firefox_iconstringFirefoxSets the web push notification's icon for Firefox. An image URL linking to a valid image. Common image types are supported; GIF will not animate. We recommend 256x256 (at least 80x80) to display well on high DPI devices.
chrome_iconstringChromeApp

This flag is not used for web push For web push, please see chrome_web_icon instead.


The local URL to an icon to use. If blank, the app icon will be used.

ios_soundstringiOS

Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable vibration and sound for the notification.


Example: "notification.wav"

android_soundstringAndroid⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices!
Please use Notification Categories / Channels noted above instead to support ALL versions of Android.


Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification.

NOTE: Leave off file extension for Android.


Example: "notification"

huawei_soundstringHuawei⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices.
Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices.


Sound file that is included in your app to play instead of the default device notification sound. NOTE: Leave off file extension for and include the full path.


Example: "/res/raw/notification"

adm_soundstringAmazon⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices!
Please use Notification Categories / Channels noted above instead to support ALL versions of Android.


Sound file that is included in your app to play instead of the default device notification sound. Pass nil to disable sound for the notification.

NOTE: Leave off file extension for Android.


Example: "notification"

wp_wns_soundstringWindows

Sound file that is included in your app to play instead of the default device notification sound.

Example: "notification.wav"

android_led_colorstringAndroid⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices!
Please use Notification Categories / Channels noted above instead to support ALL versions of Android.


Sets the devices LED notification light if the device has one. ARGB Hex format.

Example(Blue): "FF0000FF"

huawei_led_colorstringHuawei⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices.
Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices.


Sets the devices LED notification light if the device has one. RGB Hex format.

Example(Blue): "0000FF"

android_accent_colorstringAndroid

Sets the background color of the notification circle to the left of the notification text. Only applies to apps targeting Android API level 21+ on Android 5.0+ devices.

Example(Red): "FFFF0000"

huawei_accent_colorstringHuaweiAccent Color used on Action Buttons and Group overflow count.
Uses RGB Hex value (E.g. #9900FF).
Defaults to device’s theme color if not set.
android_visibilityintAndroid 5.0+⚠Deprecated, this field doesn't work on Android 8 (Oreo) and newer devices!
Please use Notification Categories / Channels noted above instead to support ALL versions of Android.


1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.)

0 = Private (Hides message contents on lock screen if the user set "Hide sensitive notification content" in the system settings)

-1 = Secret (Notification does not show on the lock screen at all)
huawei_visibilityintHuawei⚠Deprecated, this field ONLY works on EMUI 5 (Android 7 based) and older devices.
Please also set Notification Categories / Channels noted above to support EMUI 8 (Android 8 based) devices.


1 = Public (default) (Shows the full message on the lock screen unless the user has disabled all notifications from showing on the lock screen. Please consider the user and mark private if the contents are.)

0 = Private (Hides message contents on lock screen if the user set "Hide sensitive notification content" in the system settings).

-1 = Secret (Notification does not show on the lock screen at all).
ios_badgeTypestringiOSDescribes whether to set or increase/decrease your app's iOS badge count by the ios_badgeCount specified count. Can specify None, SetTo, or Increase.

None leaves the count unaffected.

SetTo directly sets the badge count to the number specified in ios_badgeCount.

Increase adds the number specified in ios_badgeCount to the total. Use a negative number to decrease the badge count.
ios_badgeCountintegeriOSUsed with ios_badgeType, describes the value to set or amount to increase/decrease your app's iOS badge count by.

You can use a negative number to decrease the badge count when used with an ios_badgeType of Increase.
apns_alertobjectiOS 10+iOS can localize push notification messages on the client using special parameters such as loc-key. When using the Create Notification endpoint, you must include these parameters inside of a field called apns_alert. Please see Apple's guide on localizing push notifications to learn more.

Grouping & Collapsing

Grouping lets you combine multiple notifications into a single notification to improve the user experience. Collapsing lets you dismiss old notifications in favor of newer ones.

ParameterTypePlatformDescription
android_groupstringAndroidNotifications with the same group will be stacked together using Android's Notification Grouping feature.
android_group_messageobjectAndroidNote: This only works for Android 6 and older. Android 7+ allows full expansion of all message.

Summary message to display when 2+ notifications are stacked together. Default is "# new messages". Include $[notif_count] in your message and it will be replaced with the current number.


Languages - The value of each key is the message that will be sent to users for that language. "en" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. Read more: supported languages.


Example: {"en": "You have $[notif_count] new messages"}

adm_groupstringAmazonNotifications with the same group will be stacked together using Android's Notification Grouping feature.
adm_group_messageobjectAmazon

Summary message to display when 2+ notifications are stacked together. Default is "# new messages". Include $[notif_count] in your message and it will be replaced with the current number. "en" (English) is required. The key of each hash is either a a 2 character language code or one of zh-Hans/zh-Hant for Simplified or Traditional Chinese. The value of each key is the message that will be sent to users for that language.


Example: {"en": "You have $[notif_count] new messages"}

collapse_idstringiOS 10+, AndroidOnly one notification with the same id will be shown on the device. Use the same id to update an existing notification instead of showing a new one. Limit of 64 characters.
web_push_topicstringPush - All BrowsersDisplay multiple notifications at once with different topics.
thread_idstringiOS 12+This parameter is supported in iOS 12 and above. It allows you to group related notifications together.

If two notifications have the same thread-id, they will both be added to the same group.
summary_argstringiOS 12+When using thread_id to create grouped notifications in iOS 12+, you can also control the summary. For example, a grouped notification can say "12 more notifications from John Doe".

The summary_arg lets you set the name of the person/thing the notifications are coming from, and will show up as "X more notifications from summary_arg"
summary_arg_countnumberiOS 12+When using thread_id, you can also control the count of the number of notifications in the group. For example, if the group already has 12 notifications, and you send a new notification with summary_arg_count = 2, the new total will be 14 and the summary will be "14 more notifications from summary_arg"
ios_relevance_scorefloat between 0-1iOS 15+A iOS: Relevance Score is a score to be set per notification to indicate how it should be displayed when grouped.
ios_interruption_levelstringiOS 15+iOS: Focus Modes and Interruption Levels indicate the priority and delivery timing of a notification, to ‘interrupt’ the user. Up until iOS 15, Apple primarily focused on Critical notifications.

Can choose from options: ['active', 'passive', 'time_sensitive', 'critical']

Default is active.

Delivery

ParameterTypePlatformDescription
ttlintegeriOS, Android, Huawei, Amazon, Chrome, Firefox, Safari, ChromeWebTime To Live - In seconds. The notification will be expired if the device does not come back online within this time. The default is 259,200 seconds (3 days).

Max value to set is 2419200 seconds (28 days).
priorityintegerAndroid, Chrome, ChromeWebDelivery priority through the push server (example GCM/FCM). Pass 10 for high priority or any other integer for normal priority. Defaults to normal priority for Android and high for iOS. For Android 6.0+ devices setting priority to high will wake the device out of doze mode.
enable_frequency_capbooleanAll - PushWhen Frequency Capping is enabled for the app, sending "true" will apply the frequency capping to the notification.
If the parameter is not included, the default behavior is to apply frequency capping if the setting is enabled for the app.
Setting the parameter to "false" will override the frequency capping, meaning that the notification will be sent without considering frequency capping.
apns_push_type_override stringiOSvalid values: voip
Set the value to voip for sending VoIP Notifications

This field maps to the APNS header apns-push-type.
Note: alert and background are automatically set by OneSignal

Examples Sending Notifications

See our Backend SDKs for faster development.

Send to a specific segment or all subscribers

See our Backend SDKs for faster development.

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --header "Authorization: Basic YOUR_REST_API_KEY" \
     --data-binary "{\"app_id\": \"YOUR_APP_ID\",
\"contents\": {\"en\": \"English Message\"},
\"headings\": {\"en\": \"English Title\"},
\"included_segments\": [\"Subscribed Users\"]}" \
     https://onesignal.com/api/v1/notifications
{
  "app_id": "5eb5a37e-b458-11e3-ac11-000c2940e62c",
  "included_segments": ["Subscribed Users"],
  "data": {"foo": "bar"},
  "contents": {"en": "English Message"}
}

Send based on filters

See our Backend SDKs for faster development.

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --header "Authorization: Basic YOUR_REST_API_KEY" \
     --data-binary "{\"app_id\": \"YOUR_APP_ID\",
\"contents\": {\"en\": \"English Message\"},
\"headings\": {\"en\": \"English Title\"},
\"filters\": [{\"field\": \"tag\", \"key\": \"level\", \"relation\": \">\", \"value\": \"10\"},{\"operator\": \"OR\"},{\"field\": \"amount_spent\", \"relation\": \">\",\"value\": \"0\"}]}" \
     https://onesignal.com/api/v1/notifications
{
  "app_id": "5eb5a37e-b458-11e3-ac11-000c2940e62c",
  "filters": [
  	{"field": "tag", "key": "level", "relation": "=", "value": "10"}, 
  	{"operator": "OR"}, {"field": "amount_spent", "relation": ">", "value": "0"}
  ],
  "data": {"foo": "bar"},
  "contents": {"en": "English Message"}
}

Send based on External IDs

See our Backend SDKs for faster development.

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --header "Authorization: Basic YOUR_REST_API_KEY" \
     --data-binary "{\"app_id\": \"5eb5a37e-b458-11e3-ac11-000c2940e62c\",
\"contents\": {\"en\": \"English Message\"},
\"headings\": {\"en\": \"English Title\"},
\"target_channel\": \"push\",
\"include_aliases\": { \"external_id\": [\"custom-external_id-assigned-by-api-1\", \"custom-external_id-assigned-by-api-2\", \"custom-external_id-assigned-by-api-3\"]}}" \
     https://onesignal.com/api/v1/notifications
{
  "app_id": "5eb5a37e-b458-11e3-ac11-000c2940e62c",
  "include_aliases": { "external_id": ["custom-external_id-assigned-by-api-1","custom-external_id-assigned-by-api-2","custom-external_id-assigned-by-api-3"]},
  "target_channel": "push",
  "data": {"foo": "bar"},
  "contents": {"en": "English Message"}
}

Send based on Subscription IDs

See our Backend SDKs for faster development.

curl --include \
     --request POST \
     --header "Content-Type: application/json; charset=utf-8" \
     --data-binary "{\"app_id\": \"5eb5a37e-b458-11e3-ac11-000c2940e62c\",
\"name\": {\"en\": \"My notification Name\"},     
\"contents\": {\"en\": \"English Message\"},
\"headings\": {\"en\": \"English Title\"},
\"include_subscription_ids\": [\"6392d91a-b206-4b7b-a620-cd68e32c3a76\",\"76ece62b-bcfe-468c-8a78-839aeaa8c5fa\",\"8e0f21fa-9a5a-4ae7-a9a6-ca1f24294b86\"]}" \
     https://onesignal.com/api/v1/notifications
{
  "app_id": "5eb5a37e-b458-11e3-ac11-000c2940e62c",
  "include_subscription_ids": ["6392d91a-b206-4b7b-a620-cd68e32c3a76","76ece62b-bcfe-468c-8a78-839aeaa8c5fa","8e0f21fa-9a5a-4ae7-a9a6-ca1f24294b86"],
  "data": {"foo": "bar"},
  "contents": {"en": "English Message"}
}
<cfset stFields = {
"app_id": "YOUR_APP_ID",
"include_subscription_ids": ["6392d91a-b206-4b7b-a620-cd68e32c3a76","0969472e-3298-4d7a-82e2-8fa127141892","c98fcb48-98e2-4302-8eab-b36eb891b10c"],
"data": {"foo": "bar"},
"contents": {"en": "English Message"}
}>


<cfhttp url="https://onesignal.com/api/v1/notifications" method="post" result="result">
<cfhttpparam type="header" name="Content-Type" value="application/json; charset=utf-8" />
<cfhttpparam type="body" value="#serializeJSON(stFields)#" />
</cfhttp>