gowhatsweb

module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: GPL-3.0

README

WhatsAppGoLang

GO Whats Web

Simple application to automate sending messages via whatsapp with golang

📲 Installation

To use the package in your project, use the following command:

$ go get -u github.com/nwiry/gowhatsweb/whatsapp@latest

📍 Package Features

Features available in the pack:

  • Authentication (Verifies that the QR code was scanned correctly by the app)
  • Send messages

🚴 Starting

To start you must import the package, for that just add the following line in your code:

import "github.com/nwiry/gowhatsweb/whatsapp"

Then go to: https://chromedriver.chromium.org/downloads and download the driver respecting your browser version. If you need help seeing your Google Chrome browser version, go to: https://www.google.com/chrome/update/. If you don't have it installed, download it from: https://www.google.com/intl/pt-BR/chrome/, check the version and go to the first site to download the driver according to your operating system.

💻 Example of use

Setting the chromedriver path:

d := "$PATH/chromedriver.exe" 
// $PATH e a extensão do arquivo variam dependendo do caminho salvo e do sistema operacional.

Authenticating and sending messages with goroutines:

	w1 := whatsapp.WhatsApp{}
	w2 := whatsapp.WhatsApp{}
	w3 := whatsapp.WhatsApp{}

    go func() {
		w1.Browser.SetDriverPath(d)
		w1.Authenticate()

		w1.SendMessageToNumber(5511999999999, "Test Message", 5)
	}()

	go func() {
		w2.Browser.SetDriverPath(d)
		w2.Authenticate()

		w2.SendMessageToNumber(5511999999999, "Test Message", 5)
	}()

	go func() {
		w3.Browser.SetDriverPath(d)
		w3.Authenticate()
		
		w3.SendMessageToNumber(5511999999999, "Test Message", 5)
	}()
	
	// See that in this code, you are running 3 different windows, where a different authentication occurs in each one, and you can authenticate several numbers. This way, the code continues to operate without interruptions, faster.

Preventing application interruption

whatsapp.AppMonitor() // Add this function to the last line of your main function to prevent the code from stopping after sending messages.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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