WhatsApp + Java
WAHA provides a private, self-hosted,
and free HTTP API to seamlessly integrate and automate WhatsApp using Java.
Send messages, manage chats, and streamline workflows effortlessly with a simple API!
WhatsApp + Java
WAHA provides a private, self-hosted,
and free HTTP API to seamlessly integrate and automate WhatsApp using Java.
Send messages, manage chats, and streamline workflows effortlessly with a simple API!
java --version
# No additional dependencies required
import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
public class WhatsAppClient {
public static void main(String[] args) {
String url = "http://localhost:3000/api/sendText";
HttpResponse<JsonNode> response = Unirest.post(url)
.header("Content-Type", "application/json")
.body("{\"session\": \"default\", \"chatId\": \"12132132130@c.us\", \"text\": \"Hi there!\"}")
.asJson();
System.out.println(response.getBody());
}
}
import io.javalin.Javalin;
import io.javalin.http.Context;
import org.json.JSONObject;
public class WhatsAppWebhook {
public static void main(String[] args) {
Javalin app = Javalin.create().start(7000);
app.post("/bot", WhatsAppWebhook::handleWebhook);
}
private static void handleWebhook(Context ctx) {
JSONObject json = new JSONObject(ctx.body());
if (!"message".equals(json.getString("event"))) {
processMessage(json.getJSONObject("payload"));
}
ctx.result("OK");
}
private static void processMessage(JSONObject payload) {
System.out.println("Received message: " + payload.toString());
}
}
⚡ Quick Start documentation to get started!
WAHA Core
version is always free, with no limits on messages or time!
WAHA Plus
version has no license expiration!
No strings attached to suspicious SaaS WhatsApp API solutions. Install it on your own server!
Use your favorite language - Python, JavaScript, PHP, C#, Clojure, or PowerShell.
PowerShell, really? Are you insane?! Choose another language, dude.
You can easily run 1 session to automate your WhatsApp and scale it to 500 sessions to provide a SaaS solution!
You can
run the API in a click!*
Documentation
has many examples and how-to guides.
*It's actually "a command", not a click.
Under the hood
it runs a real instance of WhatsApp Web to avoid getting blocked.
WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be
considered
totally safe.