go-whatsapp icon indicating copy to clipboard operation
go-whatsapp copied to clipboard

Error try login

Open centratelemedia opened this issue 1 year ago • 0 comments

below sample does't work for me, i got message like this

panic: couldn't dial whatsapp web websocket: websocket: bad handshake

howt to solve?

import (
	"fmt"
	"os"
	"time"

	qrcodeTerminal "github.com/Baozisoftware/qrcode-terminal-go"
	"github.com/Rhymen/go-whatsapp"
)

func main() {
	wac, err := whatsapp.NewConn(5 * time.Second)
	if err != nil {
		panic(err)
	}

	qr := make(chan string)
	go func() {
		terminal := qrcodeTerminal.New()
		terminal.Get(<-qr).Print()
	}()

	session, err := wac.Login(qr)
	if err != nil {
		fmt.Fprintf(os.Stderr, "error during login: %v\n", err)
		return
	}
	fmt.Printf("login successful, session: %v\n", session)
}

centratelemedia avatar Jan 30 '23 02:01 centratelemedia