# Analytics Notification

Get information about (`GET`), save changes to (`PUT`) or delete (`DELETE`) a specific analytics notification.

## Syntax

**URI:** `/services/data/vXX.X/`analytics/notifications/*analytics notification ID*

**Formats:** JSON

**HTTP methods**

| Method   | Description                                                                  |
| -------- | ---------------------------------------------------------------------------- |
| `GET`    | Returns information about a specific notification.                           |
| `PUT`    | Save changes to the analytics notification as specified in the request body. |
| `DELETE` | Delete the analytics notification. Deleted notifications can't be recovered. |

**Parameters**

| Parameter  | Description                                                                                                                                                                                                                                                                                  |
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `source`   | Required for `GET` calls. Specifies what type of analytics notification to return. Valid values are:<ul><li>`lightningDashboardSubscribe` — dashboard subscriptions</li><li>`lightningReportSubscribe` — report subscriptions</li><li>`waveNotification` — Analytics notifications</li></ul> |
| `ownerId`  | Optional for `GET` calls. Allows users with Manage Analytics Notifications permission to get notifications for another user with the specified `ownerId`.                                                                                                                                    |
| `recordId` | Optional. Return notifications for a single record. Valid values are:<ul><li>`reportId`— Unique report ID</li><li>`lensId`— Unique Analytics lens ID</li></ul>                                                                                                                               |

## GET Response Body

| Property              | Type                                                                                                                                                   | Description                                                                                                                                                                                                                                                                                          |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `active`              | Boolean                                                                                                                                                | Indicates whether the notification is being sent (`true`) or not (`false`).                                                                                                                                                                                                                          |
| `configuration`       | [WaveConfiguration\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list) | Describes details of a Analytics notification. Only applicable when `source` is `waveNotification`.                                                                                                                                                                                                  |
| `createdDate`         | DateTime                                                                                                                                               | Date and time when the notification was created (in ISO 8601 format).                                                                                                                                                                                                                                |
| `deactivateOnTrigger` | Boolean                                                                                                                                                | Indicates whether the notification is deactivated after it's sent (`true`) or not (`false`). Deactivation doesn't delete the notification. The default value is `false`.                                                                                                                             |
| `id`                  | String                                                                                                                                                 | Unique notification ID.                                                                                                                                                                                                                                                                              |
| `lastModifiedDate`    | DateTime                                                                                                                                               | Date and time when the notification was last modified (in ISO 8601 format).                                                                                                                                                                                                                          |
| `name`                | String                                                                                                                                                 | Display name of the notification.                                                                                                                                                                                                                                                                    |
| `recordId`            | String                                                                                                                                                 | Unique ID of the record that the notification describes. Valid values are:<ul><li>`reportId`</li><li>`lensId`</li></ul>                                                                                                                                                                              |
| `runAs`               | [runAs](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md)                                             | The person who runs the report in a report subscription. Report recipients see data in the emailed report that this person has access to in Salesforce. Available in API version 40.0 and later. Only appears if you have the “Subscribe to Reports: Add Recipients” user perm.                      |
| `schedule`            | [Schedule](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md)                                          | Details about the notification's schedule.                                                                                                                                                                                                                                                           |
| `source`              | String                                                                                                                                                 | Indicates the type of notification. Possible values are:<ul><li>`lightningSubscribe` — report subscriptions</li><li>`lightningDashboardSubscribe` — dashboard subscriptions</li><li>`lightningReportSubscribe` — report subscriptions</li><li>`waveNotification` — Analytics notifications</li></ul> |
| `thresholds`          | [Threshold\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list)         | Specifies what happens when the notification runs. For example, sending an email with report results.                                                                                                                                                                                                |

**runAs**

| Property | Type   | Description                             |
| -------- | ------ | --------------------------------------- |
| `id`     | String | The person’s unique Salesforce user ID. |
| `name`   | String | The person’s first and last name.       |

**Schedule**

| Property        | Type                                                                                                                                                | Description                                                                                                                                                                                                                            |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `frequency`     | String                                                                                                                                              | How frequently the notification is invoked. Possible values are:<ul><li>`daily` — Every day</li><li>`weekly` — One or more days each week</li><li>`monthly` — One or more days each month</li></ul>                                    |
| `frequencyType` | String                                                                                                                                              | Only necessary when `frequency` is `monthly`. Possible values are:<ul><li>`relative` — Days which can change month-to-month, as described by `details`.</li><li>`specific` — Fixed monthly dates, as described by `details`.</li></ul> |
| `details`       | [ScheduleDetail\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list) | Describes the notification schedule. Varies depending on whether `frequency` is `daily`, `weekly`, or `monthly`.                                                                                                                       |

**ScheduleDetail (`frequency` is `daily`)**

| Property | Type    | Description                                                                                          |
| -------- | ------- | ---------------------------------------------------------------------------------------------------- |
| `time`   | Integer | The hour of the day at which the notification is invoked. Possible values are integers from 0 to 23. |

**ScheduleDetail (`frequency` is `weekly`)**

| Property     | Type     | Description                                                                                                                                                                                                                                                       |
| ------------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `time`       | Integer  | The hour of the day at which the notification is invoked. Possible values are integers from 0 to 23.                                                                                                                                                              |
| `daysOfWeek` | String[] | The days of the week on which the notification is invoked. Possible values are:<ul><li>`mon` — Monday</li><li>`tue` — Tuesday</li><li>`wed` — Wednesday</li><li>`thu` — Thursday</li><li>`fri` — Friday</li><li>`sat` — Saturday</li><li>`sun` — Sunday</li></ul> |

**ScheduleDetail (`frequency` is `monthly`, `frequencyType` is `relative`)**

| Property      | Type    | Description                                                                                                                                                                                                                                                                                                                  |
| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `time`        | Integer | The hour of the day at which the notification is invoked. Possible values are integers from 0 to 23.                                                                                                                                                                                                                         |
| `weekInMonth` | String  | The week in the month during which the notification is invoked. Possible values are:<ul><li>`first` — First week</li><li>`second` — Second week</li><li>`third` — Third week</li><li>`fourth` — Fourth week</li></ul>                                                                                                        |
| `dayInWeek`   | String  | The day of the week on which the notification is invoked. Possible values are:<ul><li>`mon` — Monday</li><li>`tue` — Tuesday</li><li>`wed` — Wednesday</li><li>`thu` — Thursday</li><li>`fri` — Friday</li><li>`sat` — Saturday</li><li>`sun` — Sunday</li><li>`weekday` — Weekday</li><li>`weekend` — Weekend day</li></ul> |

**ScheduleDetail (`frequency` is `monthly`, `frequencyType` is `specific`)**

| Property      | Type      | Description                                                                                                                                                 |
| ------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `time`        | Integer   | The hour of the day at which the notification is invoked. Possible values are integers from 0 to 23.                                                        |
| `daysOfMonth` | Integer[] | The days of the month on which the notification is invoked. Possible values are integers from 1 to 31, and -1 (which represents the last day of the month). |

**Threshold**

| Property     | Type                                                                                                                                           | Description                                                                                                                                                                                                                                                                                                                  |
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `actions`    | [Action\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list)    | Specifies what action is taken when the notification is invoked.                                                                                                                                                                                                                                                             |
| `conditions` | [Condition\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list) | Describes conditions that govern when the notification is invoked.                                                                                                                                                                                                                                                           |
| `type`       | String                                                                                                                                         | Specifies when the notification is invoked (other than date and time criteria). Possible values are:<ul><li>`always` — Always invoke the notification</li><li>`onError` — Invoke the notification when there is an error</li><li>`condition` — Invoke the notification based on criteria described by `conditions`</li></ul> |

**Condition**

| Property    | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `colName`   | String | The data field which is operated on.                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `value`     | String | The comparison value which is used by the operation.                                                                                                                                                                                                                                                                                                                                                                                                          |
| `operation` | String | The operation which is used to evaluate the condition. Possible values are:<ul><li>`equal` — `colName` and `value` are equal</li><li>`notEqual` — `colName` and `value` are not equal</li><li>`greaterThan` — `colName` is greater than `value`</li><li>`lessThan` — `colName` is less than `value`</li><li>`greaterThanEqual` — `colName` is greater than or equal to `value`</li><li>`lessThanEqual` — `colName` is less than or equal to `value`</li></ul> |

**Action**

| Property        | Type                                                                                                                                               | Description                                                                                                                                                                                       |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `type`          | String                                                                                                                                             | The type of action to perform when the notification is invoked. Possible values are:<ul><li>`postToSlack` — Post to a Slack channel</li><li>`sendEmail` — Send an email to `recipients`</li></ul> |
| `configuration` | [Configuration\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list) | Specifies important attributes for resources related to the notification.                                                                                                                         |

**Configuration**

| Property      | Type                                                                                                                                           | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `attachment`  | String                                                                                                                                         | Specifies whether a Lightning Experience report subscription includes an attachment. If it includes an attachment, also specifies the file attachment. There is only one valid value:<ul><li>`excel` — Attach report results to the email as a spreadsheet formatted as a `.XLSX` file. Do not include record-level details in the subscription email.</li></ul>If the Lightning report subscription does not include an attachment, then the `attachment` property is not returned. When the `attachment` property is not returned, HTML-formatted report results are included directly in the subscription email body. |
| `recipients`  | [Recipient\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list) | A list of users, roles, and groups who receive the notification.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `summaryOnly` | Boolean                                                                                                                                        | Applies when threshold type is `condition` and `source=LightningReportSubscribe`. If `true`, emails the notification summary without the report table. If `false` or `null`, emails the summary and report table.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `team`        | [Team](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list)          | The team of notification recipients.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

**Recipient**

| Property      | Type   | Description                                                                                                                              |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `id`          | String | Specifies who receives the notification. Valid values are the unique id of a user, role, or group.                                       |
| `displayName` | String | The `displayName` of the user, role, or group.                                                                                           |
| `type`        | String | Type of recipient. Possible values are:<ul><li>`collaborationRoom` — A collaboration room.</li><li>`user` — A individual user.</li></ul> |

**Team**

| Property     | Type   | Description                             |
| ------------ | ------ | --------------------------------------- |
| `platformId` | String | Specifies the id of the Slack platform. |

**WaveConfiguration**

| Property   | Type                                                                                                                                             | Description                                                                               |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
| `anchor`   | String                                                                                                                                           | Optional. The Id of the Analytics dashboard widget to which the notification is anchored. |
| `filter`   | String                                                                                                                                           | Optional. Description of selected filters at the time of notification creation.           |
| `query`    | String                                                                                                                                           | Required. SAQL query which is run when the notification is invoked.                       |
| `datasets` | [WaveDataset\[\]](/docs/analytics/salesforce-analytics-rest-api/guide/analytics-api-notifications-reference-list.md#analytics-notification-list) | Required. Collection of Analytics datasets referenced by the notification.                |

**WaveDataset**

| Property    | Type   | Description                                        |
| ----------- | ------ | -------------------------------------------------- |
| `id`        | String | Required. Id of the Analytics dataset.             |
| `name`      | String | Optional. Developer name of the Analytics dataset. |
| `namespace` | String | Optional. Namespace of the Analytics dataset.      |

## PUT Request Body

A notification object with desired changes.

Uses the same format as the GET response body.

## PUT Response Body

An analytics notification object reflecting saved changes.

Uses the same format as the GET response body.

## DELETE Response Body

The analytics notification is deleted, and can't be recovered.

Returns an empty response body.
