-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updating the readme file #30
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a6bf647
updating the readme file
RamIndia e506ee0
adding sample app link
RamIndia 039deca
minor change
72d9bc8
remove bold font for sub-item heading
9499c4c
remove bold font for sub-item heading
258d7da
adding recipients email list
0d2e33c
Merge branch 'main' into Readme_updates
AnmolBinani 4b7bf31
Update dep5
RamIndia 4d00715
Update README.md
RamIndia 03a6718
Update README.md
RamIndia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
Upstream-Name: <YOUR-REPO-NAME> | ||
Upstream-Contact: <YOUR-CONTACT (MAIL ADDRESS ETC.)> | ||
Source: <https://github.com/cap-js-community/YOUR-REPO-NAME> | ||
Upstream-Name: notifications | ||
Upstream-Contact: The CAP team <[email protected]> | ||
Source: https://github.com/cap-js/notifications | ||
Disclaimer: The code in this project may include calls to APIs ("API Calls") of | ||
SAP or third-party products or services developed outside of this project | ||
("External Products"). | ||
|
@@ -24,14 +24,6 @@ Disclaimer: The code in this project may include calls to APIs ("API Calls") of | |
you any rights to use or access any SAP External Product, or provide any third | ||
parties the right to use of access any SAP External Product, through API Calls. | ||
|
||
Files: <YOUR-FILE-OR-FOLDER-LIST> | ||
Copyright: <YEARS-RELEVANT-FOR-YOUR-PROJECT> SAP SE or an SAP affiliate company and <YOUR-PROJECT-NAME> contributors | ||
Files: * | ||
Copyright: 2023 SAP SE or an SAP affiliate company and audit-logging contributors. | ||
License: Apache-2.0 | ||
|
||
Files: <THIRD-PARTY-FILE-OR-FOLDER-LIST> | ||
Copyright: <COPYRIGHT-OF-THIRD-PARTY-CODE> | ||
License: <LICENSE-OF-THIRD-PARTY-CODE> | ||
|
||
Files: <ANOTHER-THIRD-PARTY-FILE-OR-FOLDER-LIST> | ||
Copyright: <COPYRIGHT-OF-ANOTHER-THIRD-PARTY-CODE> | ||
License: <LICENSE-OF-ANOTHER- THIRD-PARTY-CODE> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
[![REUSE status](https://api.reuse.software/badge/github.com/cap-js/notifications)](https://api.reuse.software/info/github.com/cap-js/notifications) | ||
|
||
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. | ||
# Notifications Plugin | ||
|
||
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. | ||
|
||
### Table of Contents | ||
|
||
- [Setup](#setup) | ||
- [Usage](#usage) | ||
- [Update Notification Configuration](#update-notification-configuration) | ||
- [Notification Destination](#notification-destination) | ||
- [Notification Types Path](#notification-types-path) | ||
- [Notification Type Prefix](#notification-type-prefix) | ||
- [Add Notification Types](#add-notification-types) | ||
- [Update handlers to publish notification](#update-handlers-to-publish-notification) | ||
- [Simple Notificaiton with title](#simple-notificaiton-with-title) | ||
- [Simple Notificaiton with title & description](#simple-notificaiton-with-title) | ||
- [Custom Notifications with notification types](#simple-notificaiton-with-title) | ||
- [Add code to send notifications](#add-code-to-send-notifications) | ||
- [Simple Notification with title](#simple-notification-with-title) | ||
- [Simple Notification with title and description](#simple-notification-with-title-and-description) | ||
- [Custom Notifications](#custom-notifications) | ||
- [Sample Application with notifications](#sample-application-with-notifications) | ||
- [In Local Environment](#in-local-environment) | ||
- [In Production Environment](#in-production-environment) | ||
- [Notification Destination](#notification-destination) | ||
- [Integrate with SAP Build Work Zone](#integrate-with-sap-build-work-zone) | ||
- [Contributing](#contributing) | ||
- [Code of Conduct](#code-of-conduct) | ||
- [Licensing](#licensing) | ||
|
@@ -41,15 +45,11 @@ In this guide, we use the [Incidents Management reference sample app](https://gi | |
|
||
<img width="1300" alt="Default Notification config" style="border-radius:0.5rem" src="_assets/packageJsonConfig.gif"> | ||
|
||
#### **Notification Destination** | ||
|
||
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. | ||
|
||
#### **Notification Types Path** | ||
#### Notification Types Path | ||
|
||
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. | ||
|
||
#### **Notification Type Prefix** | ||
#### Notification Type Prefix | ||
|
||
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. | ||
|
||
|
@@ -78,34 +78,34 @@ Sample: If you want to send the notification when the new incident is reported, | |
] | ||
``` | ||
|
||
### Update handlers to publish notification | ||
### Add code to send notifications | ||
|
||
In the handler files, connect to the notifications plugin by: | ||
|
||
```js | ||
const alert = await cds.connect.to('notifications'); | ||
``` | ||
|
||
#### **Simple Notificaiton with title** | ||
#### Simple Notification with title | ||
You can use the following signature to send the simple notification with title | ||
```js | ||
alert.notify({ | ||
recipients: recipients, | ||
priority: priority, | ||
title: title | ||
recipients: ["[email protected]","[email protected]"], | ||
priority: "HIGH", | ||
title: "New incident is reported!" | ||
}); | ||
``` | ||
#### **Simple Notificaiton with title & description** | ||
#### Simple Notification with title and description | ||
You can use the following signature to send the simple notification with title and description | ||
```js | ||
alert.notify({ | ||
recipients: recipients, | ||
priority: priority, | ||
title: title, | ||
description: description | ||
recipients: ["[email protected]"], | ||
priority: "HIGH", | ||
title: "New high priority incident is assigned to you!", | ||
description: "Incident titled 'Engine overheating' created by 'customer X' with priority high is assigned to you!" | ||
}); | ||
``` | ||
#### **Custom Notifications with notification types** | ||
#### Custom Notifications | ||
You can use the following signature to send the custom notification with pre-defined notification types. | ||
```js | ||
alert.notify({ | ||
|
@@ -128,20 +128,26 @@ alert.notify({ | |
Type: 'String' | ||
} | ||
], | ||
Recipients: recipients | ||
Recipients: ["[email protected]","[email protected]"] | ||
}); | ||
``` | ||
|
||
### Sample Application with notifications | ||
|
||
#### **In Local Environment** | ||
#### In Local Environment | ||
In local environment, when you publish notification, it is mocked to publish the nofication to the console. | ||
|
||
<img width="1300" alt="Notify to console" style="border-radius:0.5rem;padding:1rem;background:rgb(24 24 24)" src="_assets/notifyToConsole.png"> | ||
|
||
#### **In Production Environment** | ||
#### In Production Environment | ||
|
||
##### Notification Destination | ||
|
||
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. | ||
|
||
##### Integrate with SAP Build Work Zone | ||
|
||
Once application is deployed and integrated with SAP Build Work Zone, you can see the notification under fiori notifications icon! | ||
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! | ||
|
||
<img width="1300" alt="Sample Application Demo" style="border-radius:0.5rem;" src="_assets/incidentsNotificationDemo.gif"> | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot see the AFC way for posting notifications