fix(notifications): add documentation for external services
Signed-off-by: Marek Libra <marek.libra@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-notifications-backend': patch
|
||||
---
|
||||
|
||||
Updated documentation for sending messages by external services.
|
||||
@@ -71,7 +71,19 @@ export const myPlugin = createBackendPlugin({
|
||||
});
|
||||
```
|
||||
|
||||
## Sending notifications
|
||||
## Sending Notifications By Backend Plugins
|
||||
|
||||
To be able to send notifications to users, you have to integrate the `@backstage/plugin-notifications-node`
|
||||
to your application and plugins.
|
||||
To be able to send notifications to users by other plugins, you have to integrate the `@backstage/plugin-notifications-node`
|
||||
to your application and plugins. For the API, please refer documentation there.
|
||||
|
||||
## Sending Notifications By External Services
|
||||
|
||||
External services can create new messages by sending POST request to the REST API.
|
||||
|
||||
To be able to do so, `external access` needs to be enabled as described in the [documentation](https://backstage.io/docs/auth/service-to-service-auth), e.g. via the `static tokens`.
|
||||
|
||||
Once the API can be accessed, the request can look like:
|
||||
|
||||
```
|
||||
curl -X POST [YOUR_SERVER_URL]/api/notifications -H "Content-Type: application/json" -H "Authorization: Bearer [BASE64_ENCODED_ACCESS_TOKEN]" -d '{"recipients":{"type":"entity","entityRef":"user:development/guest"},"payload": {"title": "Title of user-targeted external message","description": "The description","link": "http://foo.com/bar","severity": "high","topic": "The topic"}}'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user