Send Slack Webhook Message

Action ID: slack:sendMessage:webhook
NPM Package:

@mdude2314/backstage-plugin-scaffolder-backend-module-slack

Description

Sends a Slack message via a webhook

Input Schema

PropertyTypeDescriptionRequired
messagestringThe message to send via webhook
webhookUrlstringThe webhook URL to send the request to. The URL must either be specified here or in the Backstage config

Output Schema

No output schema defined for this action.

Usage Examples

Notify Slack when a new repository is created via webhook

Sends a simple text message to a Slack channel using an incoming webhook after the repository is published. Use this when you want a lightweight notification after fetch:template and publish:github complete.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: publish
    action: publish:github
    input:
      repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.name }}
      defaultBranch: main
      description: ${{ parameters.description }}

  - id: notify-slack
    action: slack:sendMessage:webhook
    input:
      webhookUrl: ${{ parameters.slackWebhookUrl }}
      text: "Repository created for ${{ parameters.name }} at ${{ steps['publish'].output.remoteUrl }} by ${{ user.entity.metadata.name }}"

Send a rich Slack message with Block Kit using a webhook

Posts a structured message with fields and an action button via an incoming webhook. Use this to provide more context about the generated service after fetch:template and publish:github.

Copy
steps:
  - id: fetch
    action: fetch:template
    input:
      url: ./skeleton
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}
        description: ${{ parameters.description }}

  - id: publish
    action: publish:github
    input:
      repoUrl: github.com?owner=${{ parameters.owner }}&repo=${{ parameters.name }}
      defaultBranch: main
      description: ${{ parameters.description }}

  - id: slack-rich
    action: slack:sendMessage:webhook
    input:
      webhookUrl: ${{ parameters.slackWebhookUrl }}
      text: "Service scaffolded successfully"
      blocks:
        - type: section
          text:
            type: mrkdwn
            text: ":white_check_mark: Service *${{ parameters.name }}* scaffolded by ${{ user.entity.metadata.name }}"
        - type: section
          fields:
            - type: mrkdwn
              text: "*Owner*\n${{ parameters.owner }}"
            - type: mrkdwn
              text: "*Repository*\n<${{ steps['publish'].output.remoteUrl }}|${{ parameters.name }}>"
            - type: mrkdwn
              text: "*Description*\n${{ parameters.description }}"
        - type: actions
          elements:
            - type: button
              text:
                type: plain_text
                text: "Open repository"
              url: ${{ steps['publish'].output.remoteUrl }}