From 51a59136f53439ff45cf3effbe0e51e2f4d3dc28 Mon Sep 17 00:00:00 2001 From: charconstpointer Date: Tue, 3 Aug 2021 22:34:59 +0200 Subject: [PATCH] chore: udpate docs, fix config binding --- docs/services.md | 52 +++++++++++++++++++++++++++++++++- main.go | 2 ++ service/textmagic/textmagic.go | 4 +-- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/docs/services.md b/docs/services.md index dfe1772..fb81494 100644 --- a/docs/services.md +++ b/docs/services.md @@ -375,7 +375,7 @@ by comma ',' or you can add permissions for multiple channels to single webhook. pingme teams \ --webhook 'https://example.webhook.office.com/xx' \ --msg 'some message' -``` +``` - GitHub Action @@ -754,3 +754,53 @@ jobs: | WECHAT_RECEIVER_IDS | "" | | WECHAT_MSG_TITLE | "" | | WECHAT_MESSAGE | "" | + +## TextMagic + +TextMagic allows you to send SMS to multiple receivers provided by comma separated string. + +```bash + pingme textmagic \ + --token 'tokenabc' \ + --user 'sid123' \ + --subject '+140001442' \ + --receiver '+140001442' \ + --msg 'some message' +``` + +- 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: + TEAMS_WEBHOOK: ${{ secrets.TEAMS_WEBHOOK }} + TEAMS_MSG_TITLE: 'Reference: ${{ github.ref }}' + TEAMS_MESSAGE: 'Event is triggered by ${{ github.event_name }}' + + with: + # Chose the messaging platform. + # slack / telegram / rocketchat / teams / + # pushover / discord / email / mattermost / textmagic + service: textmagic +``` + +- **Variables** + +| Variables | Default Value | +| -------------------------- | :----------------: | +| TEAMS_USER | "" | +| TEAMS_TOKEN | "" | +| TEAMS_SUBJECT | "" | +| TEAMS_MESSAGE | "" | +| TEAMS_RECEIVER | "" | diff --git a/main.go b/main.go index 9ef4bf8..6efc419 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "os" "github.com/kha7iq/pingme/service/gotify" + "github.com/kha7iq/pingme/service/textmagic" "github.com/kha7iq/pingme/service/mastodon" "github.com/kha7iq/pingme/service/twillio" @@ -56,6 +57,7 @@ email address, Line, Gotify and Wechat.` line.Send(), wechat.Send(), gotify.Send(), + textmagic.Send(), } err := app.Run(os.Args) diff --git a/service/textmagic/textmagic.go b/service/textmagic/textmagic.go index 0c422be..00f0904 100644 --- a/service/textmagic/textmagic.go +++ b/service/textmagic/textmagic.go @@ -23,7 +23,7 @@ type TextMagic struct { func Send() *cli.Command { var textMagicOpts TextMagic return &cli.Command{ - Name: "textMagic", + Name: "textmagic", Usage: "Send message via TextMagic", UsageText: "pingme textmagic --token 'tokenabc' --user 'sid123' " + "--receiver '+140001442' --msg 'some message'", @@ -55,7 +55,7 @@ You can specify multiple receivers by separating the value with a comma.`, EnvVars: []string{"TEXTMAGIC_SUBJECT"}, }, &cli.StringFlag{ - Destination: &textMagicOpts.Message, + Destination: &textMagicOpts.Receivers, Name: "receiver", Usage: "Receiver(s) of the message", Aliases: []string{"r"},