# Push 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  | <p>Title displayed in a notification above the message body.</p><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span> <strong>Translatable.</strong></p>       |         All         |
| Body        | string  | <p>Message body displayed in the notification.</p><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span> <strong>Translatable</strong>.</p>                     |         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  | <p>Buttons to show below notification. Icons only work on Android.</p><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span> <strong>Translatable.</strong></p> |      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 | <p>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".</p><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span> <strong>Translatable.</strong></p> |      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 | <p>Visibility of the notification.</p><ol><li>Private (Default) - hides message content on the clock screen if the user has set to hide sensitive notification content in system settings.</li><li>Public - Shows full notification on the lock screen.</li><li>Secret - Doesn't reveal any message content on the lock screen.</li></ol>                             | 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 | <p>Message subtitle displayed below the title.</p><p><span data-gb-custom-inline data-tag="emoji" data-code="2705">✅</span> <strong>Translatable.</strong></p>                  |         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.

* [Firebase Cloud Messaging notification fields](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#Message)
* APNS notification fields
* [One Signal notification fields](https://documentation.onesignal.com/reference#create-notification)
* [Expo notification fields](https://docs.expo.io/guides/push-notifications)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.codemash.io/dashboard/notifications/push/push-templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
