1
0
mirror of https://github.com/nikoksr/notify.git synced 2024-12-02 08:51:50 +02:00
notify/service/textmagic
2021-05-26 14:13:40 +02:00
..
Readme.md fix : resolved issues 2021-05-26 15:02:48 +05:30
textmagic.go chore(fmt): run 'make fmt' 2021-05-26 14:13:40 +02:00

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() {

  textMagicService := textmagic.New("YOUR_USER_NAME", "YOUR_API_KEY")

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

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

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

  log.Printf("notification sent")
}