1
0
mirror of https://github.com/nikoksr/notify.git synced 2024-11-28 08:39:13 +02:00
notify/service/textmagic
2021-05-10 15:43:55 +05:30
..
Readme.md feat(service): add textmagic service 2021-05-06 20:31:53 +05:30
textmagic.go feat(service): formatted code 2021-05-10 15:43:55 +05:30

TextMagic

go.dev reference

Prerequisites

You will need to have a TextMagic account and UserName and API KEY from TextMagic.(api-keys)

package main

import (
  "context"
  "log"

  "github.com/nikoksr/notify"
  "github.com/nikoksr/notify/service/textmagic"
)

func main() {
  textMagic := textmagic.NewTextMagicClient("YOUR_USER_NAME", "YOUR_API_KEY")

  textMagic.AddReceivers("Destination1-Phone-Number")

  notifier := notify.New()
  notifier.UseServices(textMagic)

  err := notifier.Send(context.Background(), "subject", "message")
  if err != nil {
    log.Fatalf("notifier.Send() failed: %s", err.Error())
  }

  log.Printf("notification sent")
}