Skip to content

Latest commit

 

History

History
38 lines (25 loc) · 915 Bytes

Readme.md

File metadata and controls

38 lines (25 loc) · 915 Bytes

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")
}