Send Teams Message

Action ID: ms-teams:sendMessage
NPM Package:

@grvpandey11/backstage-plugin-scaffolder-backend-module-ms-teams

Description

Sends a Microsoft Teams message via a webhook

Input Schema

PropertyTypeDescriptionRequired
messagestringThe message to send via webhook
webhookUrlstringThe Microsoft Teams 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 Teams when a new service repository is published

Posts a simple message to a Teams channel using an incoming webhook after the repository is created and pushed. Use this to alert the team that a new service has been scaffolded after fetch:template and publish:github.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: https://github.com/acme/templates/service-template
      targetPath: .
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

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

  - id: notify-teams
    action: ms-teams:sendMessage
    input:
      webhookUrl: ${{ parameters.teamsWebhookUrl }}
      text: >
        Service ${{ parameters.name }} was scaffolded and published to
        ${{ steps['publish-repo'].output.remoteUrl }} by
        ${{ user.entity.metadata.name }}.

Sends a richer card with details and quick links after the component is registered in the catalog. Use this to provide structured context following fetch:template, publish:github, and catalog:register.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: https://github.com/acme/templates/service-template
      targetPath: .
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}
        environment: ${{ parameters.environment }}

  - id: publish-repo
    action: publish:github
    input:
      repoUrl: github.com?owner=acme&repo=${{ parameters.name }}
      description: Initial scaffold for ${{ parameters.name }}

  - id: register
    action: catalog:register
    input:
      repoContentsUrl: ${{ steps['publish-repo'].output.repoContentsUrl }}
      catalogInfoPath: /catalog-info.yaml

  - id: notify-teams
    action: ms-teams:sendMessage
    input:
      webhookUrl: ${{ parameters.teamsWebhookUrl }}
      summary: New service provisioned
      title: New service created ${{ parameters.name }}
      text: The service is registered in Backstage and initial CI has started.
      themeColor: "0078D7"
      sections:
        - activityTitle: ${{ parameters.owner }} created ${{ parameters.name }}
          activitySubtitle: Environment ${{ parameters.environment }}
          facts:
            - name: Repository
              value: ${{ steps['publish-repo'].output.remoteUrl }}
            - name: Owner
              value: ${{ parameters.owner }}
            - name: Template
              value: service-template
          markdown: true
      potentialAction:
        - "@type": OpenUri
          name: Open Repository
          targets:
            - os: default
              uri: ${{ steps['publish-repo'].output.remoteUrl }}
        - "@type": OpenUri
          name: View CI
          targets:
            - os: default
              uri: ${{ steps['publish-repo'].output.remoteUrl }}/actions