8000 GitHub - z1065485649/WhatsappWeb4j: Standalone fully-featured Whatsapp Web API for Java and Kotlin
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

z1065485649/WhatsappWeb4j

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WhatsappWeb4j

What is WhatsappWeb4j

WhatsappWeb4j is a standalone library built to interact with WhatsappWeb. This means that no browser, application or any additional software is necessary to use this library. This library was built for Java 15 and JakartaEE 9. Support for Java 11, the latest LTS as of this date, will come soon. Any help to this library welcomed as long as the coding style of the project is respected.

How to install

Maven

Add this dependency to your dependencies in the pom:

<dependency>
    <groupId>it.auties</groupId>
    <artifactId>whatsappweb4j</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Gradle

Add this dependency to your build.gradle:

implementation 'it.auties:whatsappweb4j:1.0-SNAPSHOT'

How to configure WhatsappWeb4j

To use this library, start by initializing an instance of WhatsappAPI like this:

var api = new WhatsappAPI();

Alternatively, you can provide a custom configuration like this:

var configuration = WhatsappConfiguration.builder()
        .whatsappTag("whatsapp")
        .async(false)
        .build()
var api = new WhatsappAPI(configuration);

Now register your listeners:

api.registerListener(new YourAwesomeListener());

Alternatively, you can annotate your listeners with @RegisterListener:

import it.auties.whatsapp4j.listener.RegisterListener;
import it.auties.whatsapp4j.listener.WhatsappListener;

@RegisterListener
public class YourAwesomeListener implements WhatsappListener {
    
}

IMPORTANT: Only listeners that provide a no arguments constructor can be annotated with @RegisterListener

then enable auto-detection:

api.autodetectListeners();

Open a connection with WhatsappWeb's WebSocket using:

api.connect();

To disconnect from WhatsappWeb's WebSocket use:

api.disconnect();

To disconnect and then reconnect to WhatsappWeb's WebSocket use:

api.reconnect();

To disconnect and invalidate the credentials linked with this session use:

api.logout();

About

Standalone fully-featured Whatsapp Web API for Java and Kotlin

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%
0