Help us shape the future of Go! Take the 2026 Go Developer Survey

textmagic

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 4 Imported by: 0

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service allow you to configure a TextMagic SDK client.

func New

func New(userName, apiKey string) *Service

New creates a new text magic client. Use your user-name and API key from https://my.textmagic.com/online/api/rest-api/keys.

func (*Service) AddReceivers

func (s *Service) AddReceivers(phoneNumbers ...string)

AddReceivers adds the given phone numbers to the notifier.

func (*Service) Send

func (s *Service) Send(ctx context.Context, subject, message string) error

Send sends a SMS via TextMagic to all previously added receivers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL