Files
backstage/plugins/notifications-backend/README.md
T
Heikki Hellgren 6a79f9f1ee feat: integrate notifications with signals
Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
2024-02-06 10:17:29 +02:00

1.2 KiB

notifications

Welcome to the notifications backend plugin!

Getting started

First you have to install @backstage/plugin-notifications-node and @backstage/plugin-signals-node packages.

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,
    signalService: env.signalService
  });
}

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.