Push Templates

Overview of push notification templates

Templates allow you to reuse your push notifications. The following tables give details about all of the available template fields as there are quite a few of them.

Field descriptions

Some of the fields are platform-specific, as such the following fields are divided into any platform and platform-specific fields.

Any platform fields

Field

Type

Description

Providers

ID

string

The ID of a template that is used for API requests.

All

Template

string

Name of a template used for display purposes.

All

Code

string

Razor syntax code block to process tokens. Attached to other fields: title, body, data, subtitle.

All

Title

string

Title displayed in a notification above the message body.

All

Body

string

Message body displayed in the notification.

All

Priority

string

Message delivery priority. The default priority translates to "High" on IOS and "Normal" on Android.

All

Ttl

integer

Time to live in seconds. The notification will be expired if the device does not come back online within this time.

All

Data

object

JSON object of <string, string> pairs delivered with notification.

All

Meta

object

This is not delivered with push notification. Key-value pairs that can be received when getting already pushed notifications.

All

Url

string

Url to open when the user clicks on the notification. Example: https://codemash.io.

OneSignal, Firebase

Image

string

URL to an image to display in the notification.

OneSignal, Firebase

Collapse ID

string

Only one notification with the same id will be shown on the device in case the user gets more than one notification of the same collapse ID.

OneSignal, Firebase

Buttons

object

Buttons to show below notification. Icons only work on Android.

OneSignal

Android fields

Field

Type

Description

Providers

Group ID

string

Notifications with the same group id will be stacked together (different from collapse as collapse shows the last notification and group shows them grouped).

OneSignal, Firebase

Group message

string

A message displayed if at least 2 notifications are grouped together. Default is "$[notif_count] new messages". Parameter $[notif_count] will be replaced with total grouped notifications. Example: "You have $[notif_count] new messages".

OneSignal

Channel ID

string

The Android Oreo Notification Category to send the notification under.

All

Restricted package name

string

The package name of the application where the registration token must match in order to receive the message.

Firebase

Sound

string

A filename of sound played when a notification arrives. Specify "default" to play default sound.

OneSignal, Firebase

Visibility

string

Visibility of the notification.

  1. Private (Default) - hides message content on the clock screen if the user has set to hide sensitive notification content in system settings.

  2. Public - Shows full notification on the lock screen.

  3. Secret - Doesn't reveal any message content on the lock screen.

OneSignal, Firebase

Default vibration settings

bool

If true, uses default Android's vibrate pattern.

Firebase

Vibration timings

string

String separated by comma (,) of vibration times in seconds. First value - time to wait, second - time to vibrate (keep repeating these values for on/off effects). Example: "2s,1.5s,2s,1s" (wait for 2s, vibrate for 1.5s, then wait for 2s and finally vibrate for 1s).

Firebase

Default light settings

bool

If true, uses default LED light settings from configuration.

Firebase

Led color

string

Device LED notification light. ARGB Hex format. Example(Blue): "FF0000FF".

OneSignal, Firebase

Light on duration

string

Along with "Light off duration", define the blink rate of LED flashes. Duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Firebase

Light off duration

string

Along with "Light on duration", define the blink rate of LED flashes. Duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Firebase

Accent color

string

The background color of the notification circle to the left of the notification text. Example(Blue): "FF0000FF".

OneSignal, Firebase

Small icon

string

The notification's icon. If not set, sets the default app icon from app settings.

OneSignal, Firebase

Large icon

string

Shows instead of a small icon. Can be a drawable resource name or a URL.

OneSignal

Background Layer

object

Background image for notification.

OneSignal

Sticky

bool

If true, notification persists even when the user clicks it.

Firebase

iOS fields

Field

Type

Description

Providers

Push type

string

Must reflect the content of the notification. Valid values are "alert", "background", "voip". The default is "alert".

OneSignal, Firebase

App's bundle ID

string

The topic for the notification. In general, the topic is your app’s bundle ID, but it may have a suffix based on the push notification type (only voip type requires a suffix).

Firebase

Group ID

string

Notifications with the same group id will be stacked together (different from collapse as collapse shows the last notification and group shows them grouped).

OneSignal, Firebase

Subtitle

string

Message subtitle displayed below the title.

All

Content available

bool

If true, wakes an app from the background to run custom native code.

All

Category

string

Category APS payload. Example: calendar the category which contains actions like accept and decline .

All

Bade count

string

Amount to set for notification count. If not specified, displays an incremented amount. (Should be omitted as CodeMash implementation does not support this correctly).

All

Sound

string

A filename of sound played when a notification arrives. Specify "default" to play default sound.

All

External references

As CodeMash is using other notification providers internally, the following resources give more details about each of the field.

Last updated