2021-02-06 14:30:42 +05:30
|
|
|
/*
|
|
|
|
Package plivo provides message notification integration for Plivo.
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/nikoksr/notify"
|
|
|
|
"github.com/nikoksr/notify/service/plivo"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
plivoSvc, err := plivo.New(
|
|
|
|
&plivo.ClientOptions{
|
|
|
|
AuthID: "<Your-Plivo-Auth-Id>",
|
|
|
|
AuthToken: "<Your-Plivo-Auth-Token>",
|
|
|
|
}, &plivo.MessageOptions{
|
|
|
|
Source: "<Your-Plivo-Source-Number>",
|
|
|
|
})
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("plivo.New() failed: %s", err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
plivoSvc.AddReceivers("Destination1")
|
|
|
|
|
|
|
|
notifier := notify.New()
|
|
|
|
notifier.UseServices(plivoSvc)
|
|
|
|
|
2021-02-18 03:33:30 +01:00
|
|
|
err = notifier.Send(context.Background(), "subject", "message")
|
2021-02-06 14:30:42 +05:30
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("notifier.Send() failed: %s", err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Printf("notification sent")
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
package plivo
|