You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `@cap-js/notifications` package is a [CDS plugin](https://cap.cloud.sap/docs/node.js/cds-plugins#cds-plugin-packages) providing out-of-the box support for publishing business notifications.
3
+
# Notifications Plugin
4
+
5
+
The `@cap-js/notifications` package is a [CDS plugin](https://cap.cloud.sap/docs/node.js/cds-plugins#cds-plugin-packages) that provides support for publishing business notifications.
As a pre-requisite to publish the notification, you need to have a [destination](https://help.sap.com/docs/build-work-zone-standard-edition/sap-build-work-zone-standard-edition/enabling-notifications-for-custom-apps-on-sap-btp-cloud-foundry#configure-the-destination-to-the-notifications-service) configured to publish the notification. In the `package.json` by default destination name `SAP_Notification` is added, you can modify the destination name that you are configuring.
47
-
48
-
#### **Notification Types Path**
48
+
#### Notification Types Path
49
49
50
50
When you run `cds add notifications`, it will add `notificationstype.json` file with template for a notification type in the project root folder. You can add the notification types in the `notificationtype.json` file for sending the custom notification types.
51
51
52
-
#### **Notification Type Prefix**
52
+
#### Notification Type Prefix
53
53
54
54
To make notification types unique to the application, prefix is added to the type key. By default, `application name` is added as the prefix. You can update the `prefix` if required.
55
55
@@ -78,34 +78,35 @@ Sample: If you want to send the notification when the new incident is reported,
78
78
]
79
79
```
80
80
81
-
### Update handlers to publish notification
81
+
### Add code to send notifications
82
82
83
83
In the handler files, connect to the notifications plugin by:
84
84
85
85
```js
86
86
constalert=awaitcds.connect.to('notifications');
87
87
```
88
88
89
-
#### **Simple Notificaiton with title**
89
+
#### Simple Notification with title
90
90
You can use the following signature to send the simple notification with title
In local environment, when you publish notification, it is mocked to publish the nofication to the console.
197
198
198
199
<imgwidth="1300"alt="Notify to console"style="border-radius:0.5rem;padding:1rem;background:rgb(242424)"src="_assets/notifyToConsole.png">
199
200
200
-
#### **In Production Environment**
201
+
#### In Production Environment
202
+
203
+
##### Notification Destination
204
+
205
+
As a pre-requisite to publish the notification, you need to have a [destination](https://help.sap.com/docs/build-work-zone-standard-edition/sap-build-work-zone-standard-edition/enabling-notifications-for-custom-apps-on-sap-btp-cloud-foundry#configure-the-destination-to-the-notifications-service) configured to publish the notification. In the `package.json` by default destination name `SAP_Notification` is added, you can modify the destination name that you are configuring.
206
+
207
+
##### Integrate with SAP Build Work Zone
201
208
202
-
Once application is deployed and integrated with SAP Build Work Zone, you can see the notification under fiori notifications icon!
209
+
Once application is deployed and [integrated with SAP Build Work Zone](https://github.com/cap-js/calesi/tree/main/samples/notifications), you can see the notification under fiori notifications icon!
0 commit comments