Skip to content

Commit 3665349

Browse files
authored
Merge pull request #30 from cap-js/Readme_updates
updating the readme file
2 parents f26d2e0 + 03a6718 commit 3665349

File tree

2 files changed

+38
-40
lines changed

2 files changed

+38
-40
lines changed

.reuse/dep5

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2-
Upstream-Name: <YOUR-REPO-NAME>
3-
Upstream-Contact: <YOUR-CONTACT (MAIL ADDRESS ETC.)>
4-
Source: <https://github.com/cap-js-community/YOUR-REPO-NAME>
2+
Upstream-Name: notifications
3+
Upstream-Contact: The CAP team <[email protected]>
4+
Source: https://github.com/cap-js/notifications
55
Disclaimer: The code in this project may include calls to APIs ("API Calls") of
66
SAP or third-party products or services developed outside of this project
77
("External Products").
@@ -24,14 +24,6 @@ Disclaimer: The code in this project may include calls to APIs ("API Calls") of
2424
you any rights to use or access any SAP External Product, or provide any third
2525
parties the right to use of access any SAP External Product, through API Calls.
2626

27-
Files: <YOUR-FILE-OR-FOLDER-LIST>
28-
Copyright: <YEARS-RELEVANT-FOR-YOUR-PROJECT> SAP SE or an SAP affiliate company and <YOUR-PROJECT-NAME> contributors
27+
Files: *
28+
Copyright: 2023 SAP SE or an SAP affiliate company and audit-logging contributors.
2929
License: Apache-2.0
30-
31-
Files: <THIRD-PARTY-FILE-OR-FOLDER-LIST>
32-
Copyright: <COPYRIGHT-OF-THIRD-PARTY-CODE>
33-
License: <LICENSE-OF-THIRD-PARTY-CODE>
34-
35-
Files: <ANOTHER-THIRD-PARTY-FILE-OR-FOLDER-LIST>
36-
Copyright: <COPYRIGHT-OF-ANOTHER-THIRD-PARTY-CODE>
37-
License: <LICENSE-OF-ANOTHER- THIRD-PARTY-CODE>

README.md

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1+
[![REUSE status](https://api.reuse.software/badge/github.com/cap-js/notifications)](https://api.reuse.software/info/github.com/cap-js/notifications)
12

2-
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.
36

47
### Table of Contents
58

69
- [Setup](#setup)
710
- [Usage](#usage)
811
- [Update Notification Configuration](#update-notification-configuration)
9-
- [Notification Destination](#notification-destination)
1012
- [Notification Types Path](#notification-types-path)
1113
- [Notification Type Prefix](#notification-type-prefix)
1214
- [Add Notification Types](#add-notification-types)
13-
- [Update handlers to publish notification](#update-handlers-to-publish-notification)
14-
- [Simple Notificaiton with title](#simple-notificaiton-with-title)
15-
- [Simple Notificaiton with title & description](#simple-notificaiton-with-title)
16-
- [Custom Notifications with notification types](#simple-notificaiton-with-title)
15+
- [Add code to send notifications](#add-code-to-send-notifications)
16+
- [Simple Notification with title](#simple-notification-with-title)
17+
- [Simple Notification with title and description](#simple-notification-with-title-and-description)
18+
- [Custom Notifications](#custom-notifications)
1719
- [Sample Application with notifications](#sample-application-with-notifications)
1820
- [In Local Environment](#in-local-environment)
1921
- [In Production Environment](#in-production-environment)
22+
- [Notification Destination](#notification-destination)
23+
- [Integrate with SAP Build Work Zone](#integrate-with-sap-build-work-zone)
2024
- [Contributing](#contributing)
2125
- [Code of Conduct](#code-of-conduct)
2226
- [Licensing](#licensing)
@@ -41,15 +45,11 @@ In this guide, we use the [Incidents Management reference sample app](https://gi
4145

4246
<img width="1300" alt="Default Notification config" style="border-radius:0.5rem" src="_assets/packageJsonConfig.gif">
4347

44-
#### **Notification Destination**
45-
46-
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
4949

5050
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.
5151

52-
#### **Notification Type Prefix**
52+
#### Notification Type Prefix
5353

5454
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.
5555

@@ -78,34 +78,34 @@ Sample: If you want to send the notification when the new incident is reported,
7878
]
7979
```
8080

81-
### Update handlers to publish notification
81+
### Add code to send notifications
8282

8383
In the handler files, connect to the notifications plugin by:
8484

8585
```js
8686
const alert = await cds.connect.to('notifications');
8787
```
8888

89-
#### **Simple Notificaiton with title**
89+
#### Simple Notification with title
9090
You can use the following signature to send the simple notification with title
9191
```js
9292
alert.notify({
93-
recipients: recipients,
94-
priority: priority,
95-
title: title
93+
94+
priority: "HIGH",
95+
title: "New incident is reported!"
9696
});
9797
```
98-
#### **Simple Notificaiton with title & description**
98+
#### Simple Notification with title and description
9999
You can use the following signature to send the simple notification with title and description
100100
```js
101101
alert.notify({
102-
recipients: recipients,
103-
priority: priority,
104-
title: title,
105-
description: description
102+
recipients: ["[email protected]"],
103+
priority: "HIGH",
104+
title: "New high priority incident is assigned to you!",
105+
description: "Incident titled 'Engine overheating' created by 'customer X' with priority high is assigned to you!"
106106
});
107107
```
108-
#### **Custom Notifications with notification types**
108+
#### Custom Notifications
109109
You can use the following signature to send the custom notification with pre-defined notification types.
110110
```js
111111
alert.notify({
@@ -128,20 +128,26 @@ alert.notify({
128128
Type: 'String'
129129
}
130130
],
131-
Recipients: recipients
131+
132132
});
133133
```
134134

135135
### Sample Application with notifications
136136

137-
#### **In Local Environment**
137+
#### In Local Environment
138138
In local environment, when you publish notification, it is mocked to publish the nofication to the console.
139139

140140
<img width="1300" alt="Notify to console" style="border-radius:0.5rem;padding:1rem;background:rgb(24 24 24)" src="_assets/notifyToConsole.png">
141141

142-
#### **In Production Environment**
142+
#### In Production Environment
143+
144+
##### Notification Destination
145+
146+
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.
147+
148+
##### Integrate with SAP Build Work Zone
143149

144-
Once application is deployed and integrated with SAP Build Work Zone, you can see the notification under fiori notifications icon!
150+
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!
145151

146152
<img width="1300" alt="Sample Application Demo" style="border-radius:0.5rem;" src="_assets/incidentsNotificationDemo.gif">
147153

0 commit comments

Comments
 (0)