Slack Scaffolder Actions logo

Backstage Slack Scaffolder Actions Plugin

Created by Drew Hill

Slack Scaffolder Actions adds Slack messaging to your Backstage templates. It is a small backend module that exposes actions you can call from a template step. You can send a simple message with a webhook. You can post using the Slack API with a bot token. You can target a channel by id or by name. You pick what fits your setup.

Use it to keep folks updated while scaffolding runs. Post that a new service was created. Share links to the repo or docs. Signal success or failure at the end of a run. Nudge a channel when reviews are needed. These messages land where your team already works, so people see changes fast.

For an engineer with a self hosted Backstage app, the draw is simplicity. You avoid custom scripts. You keep notifications close to the template. The plugin appears in the Backstage plugin directory and is maintained on GitHub. If you want Slack updates from your templates, this gives you a direct and low effort path.

Installation Instructions

These instructions apply to self-hosted Backstage only.

Install the backend module in the new backend system

  1. Add the package to your backend workspace
Copy
yarn add --cwd packages/backend @mdude2314/backstage-plugin-scaffolder-backend-module-slack
  1. Register the module in your backend

Edit packages/backend/src/index.ts

Copy
// packages/backend/src/index.ts
import { createBackend } from '@backstage/backend-defaults';
import { sendSlackMessageModule } from '@mdude2314/backstage-plugin-scaffolder-backend-module-slack';

const backend = createBackend();

// Register other modules here

backend.add(sendSlackMessageModule());

backend.start();
  1. Add Slack settings

You can use a webhook URL. Or you can use a bot token with conversation settings. At least one source must be present. Either in app config or as action inputs in your template.

Edit app-config.yaml

Copy
# app-config.yaml
slack:
  # Use this for webhook based messages if you do not pass webhookUrl in the action input
  webhookUrl: "https://example.com"

  # Use these for Slack API based messages if you do not pass them in the action input
  token: ${SLACK_TOKEN}
  conversationId: ABC123
  conversationName: general

You need these OAuth scopes when you use a bot token channels.join chat.write chat.write.public im.write channels.read

Add a Scaffolder template that uses the actions

Create a template file in a location that your Catalog reads. One simple option is a local folder in your repo. For example catalog-templates/slack-message-demo/template.yaml

Copy
# catalog-templates/slack-message-demo/template.yaml
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
metadata:
  name: slack-message-demo
  title: My Slack message demo
  description: Send a message via Slack
spec:
  owner: your-owner
  type: service

  steps:
    # Webhook example
    - id: send-slack-message-webhook
      name: Send slack message via Slack webhook
      action: slack:sendMessage:webhook
      input:
        message: "Hello, world!"
        # Optional if provided in app-config.yaml under slack.webhookUrl
        webhookUrl: "https://example.com"

    # Slack API example
    - id: send-slack-message-api
      name: Send slack message via Slack API
      action: slack:sendMessage:conversation
      input:
        message: "Hello, world!"
        # Optional if provided in app-config.yaml
        conversationId: "abc123"
        conversationName: "general"

If your Catalog does not already load that folder, add a file location in app-config.yaml

Copy
# app-config.yaml
catalog:
  locations:
    - type: file
      target: ./catalog-templates/slack-message-demo/template.yaml
      rules:
        - allow: [Template]

You will see the template in the Scaffolder page once the Catalog picks it up.

Configure secrets for the backend

Set the Slack token in the backend process environment if you use the API based action. One simple option is a backend env file.

Create packages/backend/.env

Copy
SLACK_TOKEN=xoxb-your-bot-token

Load it with your usual process manager or dotenv setup for the backend. Or set SLACK_TOKEN in your deployment env.

Old backend system

This package exposes a backend module for the new backend system. The package does not document a legacy registration path. Use the new backend system to use this module.

Changelog

The Slack Scaffolder Actions plugin has not seen any significant changes since a year ago.

Set up Backstage in minutes with Roadie