Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidepastore/whatsapp4java
This API helps you to work with WhatsApp using Java.
https://github.com/davidepastore/whatsapp4java
Last synced: about 1 month ago
JSON representation
This API helps you to work with WhatsApp using Java.
- Host: GitHub
- URL: https://github.com/davidepastore/whatsapp4java
- Owner: DavidePastore
- Created: 2017-10-25T12:44:00.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-05-22T12:25:13.000Z (over 2 years ago)
- Last Synced: 2023-03-22T16:50:20.557Z (over 1 year ago)
- Language: Python
- Size: 35.2 KB
- Stars: 1
- Watchers: 1
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WhatsApp4Java
Send and listen messages through WhatsApp from a Java Program.
This is and updated Version of JavaWhatsApp.
This is done thanks to Margaruga: https://github.com/Margaruga/JavaWhatsAppThis is done thanks to Yowsup: https://github.com/tgalal/yowsup
# Steps
* Register your phone number in yowsup, follow these instructions.
https://github.com/tgalal/yowsup/wiki/yowsup-cli-2.0* Fill the fields in yowsup/yowsup-cli.config
- cc=
- phone=
- id=
- password=* The Whatsapp folder is a Netbeans Maven project that contains a package with all the
necessary. It also has a demo to show how it works.```java
package com.nqysit.whatsapp;import java.util.ArrayList;
public class EchoDemo {
public static void main(String[] args) throws ClientIsNotInit {
boolean run = true;
Client client = new Client("/usr/bin/python", "Java4Whatsapp/yowsup/yowsupclient.py");
client.init();
while (run) {
client.listenIncomingMessages();
ArrayList unreaden = client.getUnseenContacts();
if (!unreaden.isEmpty()) {
for (Contact ur : unreaden) {
String from = ur.getNumber();
String text = ur.getUnseenMessage();
System.out.println(from + "-" + text);
if (text.equals("stop")) {
client.killit();
run = false;
break;
}
client.sendMessage(from, text);
}
} else {
System.out.println("There are not new messages");
}
}
}
}# Updates
- 2.0 : Cleaned up the Code. The Client now has to be initialized.