Push Templates

Overview of push notification templates

Templates allows 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

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.

Translatable.

All

Body

string

Message body displayed in notification.

Translatable.

All

Priority

string

Message delivery priority. 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 user click on the notification. Example: https://codemash.io.

OneSignal, Firebase

Image

string

URL to an image to display in notification.

OneSignal, Firebase

Collapse ID

string

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

OneSignal, Firebase

Buttons

object

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

Translatable.

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 last notification and group shows them grouped).

OneSignal, Firebase

Group message

string

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".

Translatable.

OneSignal

Channel ID

string

The Android Oreo Notification Category to send the notification under.

All

Restricted package name

string

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

Firebase

Sound

string

File name of sound played when notification arrives. Specify "default" to play default sound.

OneSignal, Firebase

Visibility

string

Visibility of the notification.

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

  2. Public - Shows full notification on lock screen.

  3. Secret - Doesn't reveal any message content on 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 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. A 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. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

Firebase

Accent color

string

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 default app icon from app settings.

OneSignal, Firebase

Large icon

string

Shows instead of 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 notification. Valid values are "alert", "background", "voip". 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’s 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 last notification and group shows them grouped).

OneSignal, Firebase

Subtitle

string

Message subtitle displayed below title.

Translatable.

All

Content available

bool

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

All

Category

string

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

All

Bade count

string

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

All

Sound

string

File name of sound played when notification arrives. Specify "default" to play default sound.

All

External references

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