Microsoft Teams Scaffolder Actions logo

Backstage Microsoft Teams Scaffolder Actions Plugin

Created by Gaurav Pandey

Microsoft Teams Scaffolder Actions is a backend module for Backstage that lets your software templates send messages to Microsoft Teams. It fits into the Scaffolder so you can post updates while a template runs. You can notify a channel when a new service is created. You can share links to the repo or docs that the template just produced. You can surface failures so a human can jump in fast.

The plugin works by calling a Teams webhook. Your template provides the message content during execution. This keeps communication close to the work. Developers do not need to switch tools to see what happened. Messages land in the same place your team already watches.

Common use cases include new service creation alerts. Ownership handoff notes to the right channel. Status pings during multi step templates. Signals to on call after a failed publish step. You can add one message or several across a longer workflow. It is simple to adopt in an existing self hosted Backstage instance.

Installation Instructions

These instructions apply to self-hosted Backstage only.

You will add Microsoft Teams actions to the Scaffolder backend. There is no frontend view. You use the action in templates that your users can run.

Install for the new backend system

Add the package to the backend

Copy
yarn add --cwd packages/backend @grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams

Register the module in the backend

Edit packages/backend/src/index.ts and add the module.

Copy
// packages/backend/src/index.ts

// other imports

// inside your backend setup
// make sure this runs before backend.start()
backend.add(import('@grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams'));

// rest of your file

Configure the Teams webhook

Add a section to your app config. You can also pass the webhook in a template step input instead.

Copy
# app-config.yaml

ms-teams:
  webhookUrl: "https://your-url.com"

Use the action in a template

Create a template so users can trigger the action from the Create page. Place the file in a location your catalog loads. One simple way is a folder inside your repo, then a matching catalog locations rule in your app config.

Example template file

Copy
# templates/ms-teams-demo.yaml
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: ms-teams-demo
  title: Microsoft Teams message demo
  description: Send a message via MS Teams
spec:
  owner: user:grvpandey11
  type: service

  steps:
    - id: send-ms-teams-message
      name: Send message
      action: ms-teams:sendMessage
      input:
        message: "Hello, world!"
        webhookUrl: "https://your-url.com" # optional if set in app-config.yaml

Tell the catalog where to find the template file

Copy
# app-config.yaml

catalog:
  locations:
    - type: file
      target: templates/ms-teams-demo.yaml
      rules:
        - allow: [Template]

Now restart your backend. Open the Create page and pick the template to send a Teams message.

Install for the legacy backend system

This package documents the new backend module path. For legacy backend apps the module style load with backend.add is not available.

If you are still on the legacy backend, do one of the following

  1. Migrate your backend to the new system, then use the steps above
  2. If the package exposes an action factory, register it in your scaffolder plugin file

The second option follows the common legacy pattern. Here is the shape to use. You need to replace the import name with the actual export from the package if it exists.

Copy
// packages/backend/src/plugins/scaffolder.ts

import { Router } from 'express';
import { CatalogClient } from '@backstage/catalog-client';
import { ScmIntegrations } from '@backstage/integration';
import { createRouter, createBuiltinActions } from '@backstage/plugin-scaffolder-backend';
import type { PluginEnvironment } from '../types';

// replace the import below with the actual export if provided by the package
// for example it might export a function that returns one or more actions
// such as createMsTeamsActions or similar
import { /* createMsTeamsActions */ } from '@grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams';

export default async function createPlugin(env: PluginEnvironment): Promise<Router> {
  const integrations = ScmIntegrations.fromConfig(env.config);
  const catalogClient = new CatalogClient({ discoveryApi: env.discovery });

  const builtin = createBuiltinActions({
    catalogClient,
    integrations,
    config: env.config,
    reader: env.reader,
  });

  // create the Teams actions from the package export if available
  // const msTeamsActions = createMsTeamsActions({ config: env.config });

  const actions = [
    ...builtin,
    // ...msTeamsActions,
  ];

  return await createRouter({
    logger: env.logger,
    config: env.config,
    database: env.database,
    reader: env.reader,
    catalogClient,
    actions,
    identity: env.identity,
    permissions: env.permissions,
    taskBroker: env.taskBroker,
  });
}

Keep the same ms teams config in your app config

Copy
# app-config.yaml

ms-teams:
  webhookUrl: "https://your-url.com"

Use the same template step shown earlier.

Changelog

This changelog is produced from commits made to the Microsoft Teams Scaffolder Actions plugin since a year ago, and based on the code located here. It may not contain information about all commits. Releases and version bumps are intentionally omitted. This changelog is generated by AI.

Breaking changes

  • Drop legacy support for the old schema #11 merged 3 months ago Update any templates that use the old schema to the new Zod schema

Features

Maintenance

  • Fix npm publish issue #8 merged 9 months ago
  • Upgrade actions in the workflow #7 merged 9 months ago

Set up Backstage in minutes with Roadie