Skip to content

Commit ad48792

Browse files
authored
Merge pull request #33 from cap-js/update-docu
Update Readme
2 parents 4c131b2 + 129d354 commit ad48792

File tree

1 file changed

+64
-1
lines changed

1 file changed

+64
-1
lines changed

README.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ The `@cap-js/notifications` package is a [CDS plugin](https://cap.cloud.sap/docs
1616
- [Simple Notification with title](#simple-notification-with-title)
1717
- [Simple Notification with title and description](#simple-notification-with-title-and-description)
1818
- [Custom Notifications](#custom-notifications)
19+
- [With standard parameters](#with-standard-parameters)
20+
- [Passing the whole notification object](#passing-the-whole-notification-object)
1921
- [Sample Application with notifications](#sample-application-with-notifications)
2022
- [In Local Environment](#in-local-environment)
2123
- [In Production Environment](#in-production-environment)
@@ -105,8 +107,69 @@ alert.notify({
105107
description: "Incident titled 'Engine overheating' created by 'customer X' with priority high is assigned to you!"
106108
});
107109
```
110+
108111
#### Custom Notifications
109-
You can use the following signature to send the custom notification with pre-defined notification types.
112+
You can use these two signature to send the custom notification with pre-defined notification types.
113+
114+
##### With standard parameters
115+
116+
By using this approach you can post a notification by providing different parts of the notification object grouped in related units
117+
```js
118+
alert.notify({
119+
120+
type: "IncidentCreated"
121+
priority: 'NEUTRAL',
122+
properties: [
123+
{
124+
Key: 'name',
125+
IsSensitive: false,
126+
Language: 'en',
127+
Value: 'Engine overheating',
128+
Type: 'String'
129+
},
130+
{
131+
Key: 'customer',
132+
IsSensitive: false,
133+
Language: 'en',
134+
Value: 'John',
135+
Type: 'String'
136+
}
137+
],
138+
navigation: {
139+
NavigationTargetAction: "displayInbox",
140+
NavigationTargetObject: "WorkflowTask",
141+
}
142+
payload: {
143+
Id: "01234567-89ab-cdef-0123-456789abcdef",
144+
OriginId: "Example Origin Id",
145+
NotificationTypeId: "01234567-89ab-cdef-0123-456789abcdef",
146+
NotificationTypeVersion: "1",
147+
ProviderId: "/SAMPLEPROVIDER",
148+
ActorId: "BACKENDACTORID",
149+
ActorDisplayText: "ActorName",
150+
ActorImageURL: "https://some-url",
151+
NotificationTypeTimestamp: "2022-03-15T09:58:42.807Z",
152+
TargetParameters: [
153+
{
154+
"Key": "string",
155+
"Value": "string"
156+
}
157+
]
158+
}
159+
});
160+
```
161+
162+
Possible parameters:
163+
* **recipients** - List of the recipients, this argument is mandatory
164+
* **type** - Notification type key, this argument is mandatory
165+
* **priority** - Priority of the notification, this argument is optional, it defaults to NEUTRAL
166+
* **properties** - A key-value pair that is used to fill a placeholder of the notification type template, this argument is optional
167+
* **navigation** - All navigation related parameters, this argument is optional
168+
* **payload** - The rest parameters that can be passed, this argument is optional
169+
170+
##### Passing the whole notification object
171+
172+
By using this approach you need to pass the whole notification object as described in the API documentation
110173
```js
111174
alert.notify({
112175
NotificationTypeKey: 'IncidentCreated',

0 commit comments

Comments
 (0)