Documentation ¶
Overview ¶
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()) } err = whatsappSvc.LoginWithQRCode() if err != nil { log.Fatalf("whatsappSvc.LoginWithQRCode() failed: %s", err.Error()) } whatsappSvc.AddReceivers("Contact1") notifier := notify.New() notifier.UseServices(whatsappSvc) err = notifier.Send(context.Background(), "subject", "message") if err != nil { log.Fatalf("notifier.Send() failed: %s", err.Error()) } log.Println("notification sent") }
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 encapsulates the WhatsApp client along with internal state for storing contacts.
func (*Service) AddReceivers ¶
AddReceivers takes WhatsApp contacts and adds them to the internal contacts list. The Send method will send a given message to all those contacts.
func (*Service) LoginWithQRCode ¶
LoginWithQRCode provides helper for authentication using QR code on terminal. Refer: https://github.com/Rhymen/go-whatsapp#login for more information.
Click to show internal directories.
Click to hide internal directories.