1a38100a8e
Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
1.1 KiB
1.1 KiB
notifications
Welcome to the notifications backend plugin!
Getting started
First you have to install the @backstage/plugin-notifications-node package.
Then create a new file to packages/backend/src/plugins/notifications.ts:
import { createRouter } from '@backstage/plugin-notifications-backend';
import { Router } from 'express';
import { PluginEnvironment } from '../types';
export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
return await createRouter({
logger: env.logger,
identity: env.identity,
tokenManager: env.tokenManager,
database: env.database,
discovery: env.discovery,
});
}
and add it to packages/backend/src/index.ts:
async function main() {
//...
const notificationsEnv = useHotMemoize(module, () =>
createEnv('notifications'),
);
// ...
apiRouter.use('/notifications', await notifications(notificationsEnv));
}
Extending Notifications
The notifications can be extended with NotificationProcessor. These processors allow to decorate notifications
before they are sent or/and send the notifications to external services.