Skip to content

Github Action to send a message/alert to a threema Broadcast group over the broadcast api

License

Notifications You must be signed in to change notification settings

FabioTavernini/notify-threema-broadcast

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation


Release CodeQL

Static Badge GitHub code size in bytes

Send Alert to Threema Broadcast Group with Github actions

🔔 Send a custom message with repo infos to a Threema Broadcast Group using github actions.

Inputs

Name Required Description
THREEMA_URL yes Url to your Threema broadcast Group (POST will be sent to this)
THREEMA_XAPIKEY yes Your Threema X-API-Key
job yes Job data as json : ${{toJson(job)}}
message yes The message text to send to the group

Example usage

Add two Secrets to your repo

  • THREEMA_URL

    • Threema Group URL will look something like this: https://broadcast.threema.ch/api/v1/identities/{broadcastUid}/groups/{groupUid}/chat
  • THREEMA_XAPIKEY

    • X-API-Key can be generated at: Threema Broadcast > Settings > Your profile > API Keys.

To get more infos about threema API: API Docs

Then create or edit an action at .github/workflows/youraction.yaml.

Examples

Basic Example:

on: [push]

jobs:
  demojob:
    runs-on: ubuntu-latest
    name: Send Threema Alert
    steps:
      - name: Send Threema message
        id: alert
        if: always() # Always run the job, so failures are reported / alerted.
        uses: FabioTavernini/notify-threema-broadcast@v1
        with:
          THREEMA_URL: ${{ secrets.THREEMA_URL }}
          THREEMA_XAPIKEY: ${{ secrets.THREEMA_XAPIKEY }}
          job: ${{ toJson(job) }}
          message: 'Hello from github'
      - name: Get outputs
        run: |
          echo "response ${{ steps.Alert.outputs.response }}"
          echo "status ${{ steps.Alert.outputs.status }}"

Alert with commit message

on: [push]

jobs:
  demojob:
    runs-on: ubuntu-latest
    name: Send Threema Alert
    steps:
      - name: Send Threema message
        id: alert
        if: always() # Always run the job, so failures are reported / alerted.
        uses: FabioTavernini/notify-threema-broadcast@v1
        with:
          THREEMA_URL: ${{ secrets.THREEMA_URL }}
          THREEMA_XAPIKEY: ${{ secrets.THREEMA_XAPIKEY }}
          job: ${{ toJson(job) }}
          message: '${{ github.event.head_commit.message }}'
      - name: Get outputs
        run: |
          echo "response ${{ steps.Alert.outputs.response }}"
          echo "status ${{ steps.Alert.outputs.status }}"

Alert only on failure

on: [push]

jobs:
  demojob:
    runs-on: ubuntu-latest
    name: Send Threema Alert
    steps:
      - name: Send Threema message
        id: alert
        if: failure() # Only run if job has failed
        uses: FabioTavernini/notify-threema-broadcast@v1
        with:
          THREEMA_URL: ${{ secrets.THREEMA_URL }}
          THREEMA_XAPIKEY: ${{ secrets.THREEMA_XAPIKEY }}
          job: ${{ toJson(job) }}
          message: 'Hello from github'
      - name: Get outputs
        run: |
          echo "response ${{ steps.Alert.outputs.response }}"
          echo "status ${{ steps.Alert.outputs.status }}"

Styling

If you want to style/customize your message further, have a look at the guide here.

Contribution

Feel free to contribute in any way, shape or form.

Disclaimer

This project is not affiliated with @Threema. The Threema Broadcast API is used in this action as an external service, and the creator of this action is not responsible for any issues that arise from Threema’s service or changes to their API.

About

Github Action to send a message/alert to a threema Broadcast group over the broadcast api

Resources

License

Stars

Watchers

Forks

Packages

No packages published