API parameters to configure Desktop Assistant notifications
Summarize
Summary of API parameters to configure Desktop Assistant notifications
This document details the parameters for thesendDANotification()method in theDesktopAppNotificationUtilsscript include, which ServiceNow customers use to configure notifications in the Desktop Assistant. Understanding and correctly setting these parameters allows you to send targeted, well-formed notifications to users via the Desktop Assistant interface.
Show less
Key Parameters and Their Use
- notificationmessage: The main body text on the notification card. It must be a non-empty string up to 1000 characters. Invalid values cause a 400 error, so ensure this is always populated correctly.
- notificationtitle: The title shown at the top of the notification card. This is optional; if omitted or invalid, the notification shows an empty title without error.
- recipientlist: A comma-separated string of sysid values from the User (sysuser) table representing the notification recipients. This enables precise targeting of notifications.
- referrerid and referrertable: Together, these link the notification to a specific record (e.g., incident or screquest). Both must be provided for reliable linking; providing only one results in unpredictable behavior in the notification's link.
- source: Identifies the application triggering the notification. Acceptable values are mim (Major Incident Management) and pe (Proactive Engagement), case-insensitive. Other values produce a 400 error. The source must be defined as a choice in the sndexdesktopassistantnotification table for Desktop Assistant to recognize and track it.
Parameter Validation and Behavior
- If notificationmessage is missing, empty, or not a string, the API returns a 400 error.
- If notificationtitle is missing or invalid, the notification displays without a title, but no error occurs.
- If source is invalid (not "mim" or "pe"), a 400 error is returned indicating a missing source record.
- When enablepushnotification is false, the API returns a 400 error immediately with no notification created.
- notificationtimetolive defaults to seven days and is capped at a maximum of seven days if set higher.
- Providing only one of referrerid or referrertable does not cause an error but may result in incorrect notification linking.
Notification Display Elements
- Notification title on the card derives from notificationtitle.
- Notification body text on the card comes from notificationmessage.
- Timestamp is automatically derived from the syscreatedon field of the notification queue record and is not set via the API.
- System tray notification appears when notification status is "Pending" at the time the Desktop Assistant client checks for new notifications; this is also not an API parameter.
Practical Considerations for ServiceNow Customers
When configuring Desktop Assistant notifications via the API, ensure all required fields meet validation rules to avoid errors. Use the recipientlist to target specific users accurately. Always provide both referrerid and referrertable together to maintain proper link behavior in notifications. Confirm that the source value is registered in the Desktop Assistant notification source table to enable recognition and tracking.
These guidelines help you deliver clear, actionable notifications that integrate seamlessly with Desktop Assistant, improving user engagement and response times.
sendDANotification() method parameters in the DesktopAppNotificationUtils script include for configuring Desktop Assistant notifications.
| Parameter | Description |
|---|---|
| notification_message |
Body text displayed on the notification card. The value must be a non-empty string and not exceed 1000 characters. If this condition is not met, the API returns a 400 error. |
| notification_title |
Title text displayed at the top of the Desktop Assistant notification card. If omitted, the notification card displays an empty title without raising an error. |
| recipient_list |
The |
| referrer_id |
The sys_id of the record that the notification links to. This parameter works in combination with referrer_table. If only one of these two parameters is provided, the link behavior is unpredictable. |
| referrer_table |
The name of the table containing the record that the notification links to. For example, incident or sc_request. This parameter works in combination with referrer_id. If only one of these two parameters is provided, the link behavior is unpredictable. |
| source | The source application that triggered the notification. Accepted values are mim (Major Incident Management) and pe (Proactive Engagement). The value is case-insensitive. Any other value causes the API to return a 400 error. Note: Desktop Assistant sends notifications for a new source only if the source is added as a choice value in the Notification source field of the Desktop Assistant notification (sn_dex_desktop_assistant_notification) table. This enables Desktop Assistant to recognize and track the source. |
Parameter interactions and precedence
| Scenario | Behavior |
|---|---|
| notification_message is empty, missing, or not a string value. | Returns a 400 error. |
| notification_title is missing or not a string value. | The Desktop Assistant client displays an empty title. No error is raised. |
| source is not mim or pe | Returns a 400 error: Source record missing in Desktop Assistant Notification Source table |
| enable_push_notification is false | Returns a 400 error immediately. No record is created and no flow runs. |
| notification_time_to_live is set to more than 7 days | The value is capped at seven days. |
| notification_time_to_live property is not set | Defaults to seven days. |
| Only one of referrer_table or referrer_id is provided | No error is raised and both fields are stored, but the notification on the Desktop Assistant client may not link to the correct record. |
Desktop Assistant notification card element‑to‑source mapping
| Desktop Assistant client UI element | Source parameter or field |
|---|---|
| Notification title (card header) | notification_title |
| Notification body text | notification_message |
| Timestamp | Derived from the sys_created_on field on the Desktop Assistant Notification Queue (sn_dex_desktop_notify_queue) record. Not an API parameter. |
| System tray notification | Displayed when the notification status is Pending at the time the Desktop Assistant client checks for new notifications. Not an API parameter. |