docs: added matrix documentation

pull/65/head
ahdekkers 3 years ago
parent 300293b85b
commit aea178cb18

@ -54,6 +54,7 @@ platforms.
- *Line* - *Line*
- *Mastodon* - *Mastodon*
- *Mattermost* - *Mattermost*
- *Matrix*
- *Microsoft Teams* - *Microsoft Teams*
- *Pushbullet* - *Pushbullet*
- *Pushover* - *Pushover*

@ -806,3 +806,72 @@ jobs:
| TEXTMAGIC_TITLE | "" | | TEXTMAGIC_TITLE | "" |
| TEXTMAGIC_MESSAGE | "" | | TEXTMAGIC_MESSAGE | "" |
| TEXTMAGIC_RECEIVER | "" | | 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 | "" |

@ -26,14 +26,14 @@ func Send() *cli.Command {
Name: "matrix", Name: "matrix",
Usage: "Send message via matrix", Usage: "Send message via matrix",
UsageText: "pingme matrix --token 'syt_YW...E2qD' --room 'LRovrjPJaRChcTKgoK:matrix.org' " + 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{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Destination: &matrix.Username, Destination: &matrix.Username,
Name: "username", Name: "username",
Aliases: []string{"u"}, Aliases: []string{"u"},
Usage: "Matrix username", Usage: "Matrix username",
EnvVars: []string{"MATRIX_USERNAME"}, EnvVars: []string{"MATRIX_USER"},
}, },
&cli.StringFlag{ &cli.StringFlag{
Destination: &matrix.Password, Destination: &matrix.Password,
@ -44,7 +44,7 @@ func Send() *cli.Command {
}, },
&cli.StringFlag{ &cli.StringFlag{
Destination: &matrix.Token, Destination: &matrix.Token,
Name: "accessToken", Name: "token",
Aliases: []string{"t"}, Aliases: []string{"t"},
Usage: "Matrix access token. Can be used instead of username+password", Usage: "Matrix access token. Can be used instead of username+password",
EnvVars: []string{"MATRIX_ACCESS_TOKEN"}, EnvVars: []string{"MATRIX_ACCESS_TOKEN"},
@ -81,7 +81,7 @@ func Send() *cli.Command {
}, },
&cli.StringFlag{ &cli.StringFlag{
Destination: &matrix.Message, Destination: &matrix.Message,
Name: "message", Name: "msg",
Aliases: []string{"m"}, Aliases: []string{"m"},
Required: true, Required: true,
Usage: "Message to send to matrix", Usage: "Message to send to matrix",

Loading…
Cancel
Save