Skip to content
bell

GitHub Action

Simple MS Teams Webhook notifier

v1.2.0 Latest version

Simple MS Teams Webhook notifier

bell

Simple MS Teams Webhook notifier

simple typescript template for building GitHub Actions

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Simple MS Teams Webhook notifier

uses: LuisGhz/simple-ms-teams-webhook-notifier@v1.2.0

Learn more about this action in LuisGhz/simple-ms-teams-webhook-notifier

Choose a version

Simple MS Teams Webhook


A GitHub Action to send notifications to MS Teams using the syntax of Legacy Actionable Messages (Not all features yet).


Input Description Required Default
webhook_url Url generated by Incoming Webhook for MS Teams channel ✔️
summary Card summary
title Card title
text Card body text
theme-color Brand color card. Hexadecimal (without #).
You can use Success, Warning, Error and Info words as well
Success
sections For more information visit Sections fields.
This action uses yaml format in value as string. Some examples below.
potential-action For more information visit Actions.
This action uses yaml format in value as string. Some examples below.
yaml-ident This action uses YAML to parse the value of sections & potential-action to json properties.
This input configures the number of spaces used for the indentations.
2

Templates

Use them in title, summary, text and sections fields to easily display information

Syntax Description Output
{gh:actor} Return the username that runs the workflow UserName
{gh:actor-url} Returns the URL of the user who runs the program. https://github.com/UserName
{gh:avatar-url} Returns the avatar URL of the user who runs the program. https://avatars2.githubusercontent.com/u/123456789?v=4
{gh:run-number-link} Returns a link to the run id displaying run number #1 => https://github.com/user/repository/actions/runs/{run_id}

Examples

Send only basic fields

- name: run action
      id: run_action
      uses: luisghz/simple-ms-teams-webhook-notifier@v1-latest
      with: 
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        summary: 'Card Summary'
        title: 'Card title'
        text: 'Card text'

Set hexadecimal theme color

- name: run action
      id: run_action
      uses: luisghz/simple-ms-teams-webhook-notifier@v1-latest
      with: 
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        summary: 'Card Summary'
        title: 'Card title'
        text: 'Card text'
        theme-color: 'b405ff'

Set preset theme color

- name: run action
      id: run_action
      uses: luisghz/simple-ms-teams-webhook-notifier@v1-latest
      with: 
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        summary: 'Card Summary'
        title: 'Card title'
        text: 'Card text'
        theme-color: 'Success'

Use sections (You can use the basic fields at the same time) and templates

- name: run action
      id: run_action
      uses: luisghz/simple-ms-teams-webhook-notifier@v1-latest
      with: 
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        summary: 'Card Summary'
        title: 'Card Title'
        text: 'Card Text'
        sections: |
          - activityTitle: "Section title by {gh:actor}"
            activitySubtitle: "Section subtitle. Make click [here]({gh:actor-url}) to go to user profile"
            activityImage: "{gh:avatar-url}"
            facts:
              - name: 'Fact 1'
                value: 'Value 1'
              - name: 'Fact 2'
                value: 'Value 2'

Use potential action

- name: run action
      id: run_action
      uses: luisghz/simple-ms-teams-webhook-notifier@v1-latest
      with: 
        webhook_url: ${{ secrets.WEBHOOK_URL }}
        summary: 'Card Summary'
        title: 'Card Title'
        text: 'Card Text'
        potential-action: |
        	- "@type": "OpenUri"
	          name: "Open Executed Action"
	          targets:
	          	- os: "default"
	          	  uri: "https://docs.microsoft.com/outlook/actionable-messages"
	          

Note: To use special characters you must use double quotes " " in the property name. You can use double quotes in the values too.