diff --git a/.changeset/unlucky-rivers-collect.md b/.changeset/unlucky-rivers-collect.md new file mode 100644 index 0000000000..c5ec865658 --- /dev/null +++ b/.changeset/unlucky-rivers-collect.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-notifications-backend': patch +--- + +Updated documentation for sending messages by external services. diff --git a/plugins/notifications-backend/README.md b/plugins/notifications-backend/README.md index 233d0e5e21..60c9a4e078 100644 --- a/plugins/notifications-backend/README.md +++ b/plugins/notifications-backend/README.md @@ -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"}}' +```