2021-02-13 23:24:06 +02:00
|
|
|
/*
|
|
|
|
Package whatsapp provides message notification integration for WhatsApp.
|
|
|
|
|
|
|
|
Usage:
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"github.com/nikoksr/notify"
|
|
|
|
"github.com/nikoksr/notify/service/whatsapp"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
whatsappSvc, err := whatsapp.New()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("whatsapp.New() failed: %s", err.Error())
|
|
|
|
}
|
|
|
|
|
2021-02-17 09:41:43 +02:00
|
|
|
err = whatsappSvc.LoginWithQRCode()
|
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("whatsappSvc.LoginWithQRCode() failed: %s", err.Error())
|
|
|
|
}
|
|
|
|
|
2021-02-13 23:24:06 +02:00
|
|
|
whatsappSvc.AddReceivers("Contact1")
|
|
|
|
|
|
|
|
notifier := notify.New()
|
|
|
|
notifier.UseServices(whatsappSvc)
|
|
|
|
|
2021-02-18 04:33:30 +02:00
|
|
|
err = notifier.Send(context.Background(), "subject", "message")
|
2021-02-13 23:24:06 +02:00
|
|
|
if err != nil {
|
|
|
|
log.Fatalf("notifier.Send() failed: %s", err.Error())
|
|
|
|
}
|
|
|
|
|
|
|
|
log.Println("notification sent")
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
package whatsapp
|