diff --git a/docs/home.md b/docs/home.md index 62c0439..9bd7d7c 100644 --- a/docs/home.md +++ b/docs/home.md @@ -54,6 +54,7 @@ platforms. - *Line* - *Mastodon* - *Mattermost* +- *Matrix* - *Microsoft Teams* - *Pushbullet* - *Pushover* diff --git a/docs/services.md b/docs/services.md index 5d31b52..e913407 100644 --- a/docs/services.md +++ b/docs/services.md @@ -806,3 +806,72 @@ jobs: | TEXTMAGIC_TITLE | "" | | TEXTMAGIC_MESSAGE | "" | | TEXTMAGIC_RECEIVER | "" | + +## Matrix + +Matrix uses either username and password, or an access token for authentication. Tokens will be used first, if not +present, username and password will be used. Similarly for --room, if not present, room will be determined using roomId +and domain. + +```bash + pingme matrix \ + --username 'matrix username' \ + --password 'password' \ + --token 'access token' \ + --url 'https://matrix-client.matrix.org' \ + --serverName 'server1.matrix.org' \ + --room 'LRovrjPJaRChcTKgoK:matrix.org' \ + --roomId 'LRovrjPJaRChcTKgoK' \ + --domain 'matrix.org' \ + --msg 'some message' \ + --autoJoin +``` + +- GitHub Action + +```yaml +on: [push] + +jobs: + pingme-job: + runs-on: ubuntu-latest + name: PingMe + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Ping me On + uses: kha7iq/pingme-action@v1 + env: + MATRIX_USERNAME: ${{ secrets.MATRIX_USERNAME }} + MATRIX_PASSWORD: ${{ secrets.MATRIX_PASSWORD }} + MATRIX_ACCESS_TOKEN: ${{ secrets.MATRIX_ACCESS_TOKEN }} + MATRIX_SERVER_URL: ${{ secrets.MATRIX_SERVER_URL }} + MATRIX_SERVER_NAME: ${{ secrets.MATRIX_SERVER_NAME }} + MATRIX_ROOM: ${{ secrets.MATRIX_ROOM }} + MATRIX_ROOM_ID: ${{ secrets.MATRIX_ROOM_ID }} + MATRIX_DOMAIN: ${{ secrets.MATRIX_DOMAIN }} + MATRIX_MESSAGE: 'Event is triggered by ${{ github.event_name }}' + MATRIX_AUTO_JOIN: ${{ secrets.MATRIX_AUTO_JOIN }} + + with: + # Chose the messaging platform. + # slack / telegram / rocketchat / teams / + # pushover / discord / email / mattermost / textmagic / matrix + service: matrix +``` + +- **Variables** + +| Variables | Default Value | +|--------------------| :----------------: | +| MATRIX_USERNAME | "" | +| MATRIX_PASSWORD | "" | +| MATRIX_ACCESS_TOKEN | "" | +| MATRIX_SERVER_URL | "" | +| MATRIX_SERVER_NAME | "" | +| MATRIX_ROOM | "" | +| MATRIX_ROOM_ID | "" | +| MATRIX_DOMAIN | "" | +| MATRIX_MESSAGE | "" | +| MATRIX_AUTO_JOIN | "" | diff --git a/service/matrix/matrix.go b/service/matrix/matrix.go index 4598d74..9cd2e95 100644 --- a/service/matrix/matrix.go +++ b/service/matrix/matrix.go @@ -26,14 +26,14 @@ func Send() *cli.Command { Name: "matrix", Usage: "Send message via matrix", UsageText: "pingme matrix --token 'syt_YW...E2qD' --room 'LRovrjPJaRChcTKgoK:matrix.org' " + - "--url 'matrix-client.matrix.org' --autoJoin --message 'Hello, Matrix!'", + "--url 'matrix-client.matrix.org' --autoJoin --msg 'Hello, Matrix!'", Flags: []cli.Flag{ &cli.StringFlag{ Destination: &matrix.Username, Name: "username", Aliases: []string{"u"}, Usage: "Matrix username", - EnvVars: []string{"MATRIX_USERNAME"}, + EnvVars: []string{"MATRIX_USER"}, }, &cli.StringFlag{ Destination: &matrix.Password, @@ -44,7 +44,7 @@ func Send() *cli.Command { }, &cli.StringFlag{ Destination: &matrix.Token, - Name: "accessToken", + Name: "token", Aliases: []string{"t"}, Usage: "Matrix access token. Can be used instead of username+password", EnvVars: []string{"MATRIX_ACCESS_TOKEN"}, @@ -81,7 +81,7 @@ func Send() *cli.Command { }, &cli.StringFlag{ Destination: &matrix.Message, - Name: "message", + Name: "msg", Aliases: []string{"m"}, Required: true, Usage: "Message to send to matrix",