License: CISCO
published

Cisco Webex: Post to Space (Room) GitHub Action

Note: please test this well before using in production, this is a sample action!

This GitHub Action posts a message to a Webex Room using the Webex API and a NodeJS GitHub Action.

Usage

  1. Set the Webex Room ID (WEBEX_ROOM_ID) and Webex Access Token (WEBEX_TOKEN) as repository secrets in the repository that you want to run the action in. It is recommended to use a Webex Bot to create an Access Token. Please find more information regarding Webex Bots in the Webex developer documentation.

Note: make sure that the Webex Bot is added to that space, otherwise this will fail.

  1. Create a file called webex_post_message.yml with the following content in the .github/workflows directory of your repository from where you want to run the action:
name: Post Message to Webex Room JS Action

on: 
  push:

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  webex_message:
    runs-on: ubuntu-latest
    name: Send a Webex Notification
    steps:
      - name: Post Message to Webex Room
        uses: chrivand/action-webex-js@main
        env:
          WEBEX_TOKEN: ${{ secrets.WEBEX_TOKEN }}
          WEBEX_ROOM_ID: ${{ secrets.WEBEX_ROOM_ID }}
          MARKDOWN_MESSAGE: "**Hello, world! You just ran an action from ${{ github.repository }}.**"
  1. Adjust the yml file as needed, especially the MARKDOWN_MESSAGE environment variable. You can for example trigger a Webex notification based on certain output of other actions that you have run before. Please check the GitHub documentation for all context that you can use.
View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.