/Gorgeous-Whatsapp

The WhatsApp lib for java

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

Line RestApi

https://github.com/lovethiscode/Gorgeous_Line

Gorgeous

Telegram :gorgeous006

WebDemo

The WhatsApp Websocket API

  1. This project is an open source project. Considering that many people will not deploy, a test server is deployed here for testing only.

  2. The websocket maximum frame supports 10M, and the media file sent cannot exceed 10M, otherwise the websocket will be disconnected.

Test Server: ws://8.210.124.139:16090

The test account has been banned, you need to use the demo to register an account.

Vue Demo

Vue Demo

Vue Demo

-) Support WA Business

-) Support multiple devices to send and receive messages

-) whatsapp_config_tool.apk support the latest whatsapp version

-) update whatsapp cli tool 1.2

RegisterAccount. 3 steps blow.

CheckAccountExist

 command.put("command", "CheckAccountExist");
  command.put("token", "test");
  command.put("cc", "91");
  command.put("phone", "451245721247");
 
  command.put("proxy_type",-1); // -1 no proxy, 0 http proxy, 1 socks5 proxy
  command.put("proxy_server", "xxx");
  command.put("proxy_port", 1234);
  command.put("proxy_username", ""); //optional
  command.put("proxy_password", ""); //optional

CodeRequest

 command.put("command", "CodeRequest");
 command.put("method",  "sms"); //sms or voice

Register

  command.put("command", "Register");
  command.put("code", "123456");

Login

    //if 
     command.put("command", "login");
    command.put("userName", "xxxx");
    command.put("token", "test");   
    // if you register account use websocket,put config "none"
    //command.put("config", "none");
     //you can use whatsapp_config_tool.apk to get config from phone or simulator
     command.put("config", Base64.getEncoder().encodeToString(FileUtil.ReadFileContent("xxxx")));
    command.put("proxy_type",-1); // -1 no proxy, 0 http proxy, 1 socks5 proxy
    command.put("proxy_server", "xxx");
    command.put("proxy_port", 1234);
    command.put("proxy_username", ""); //optional
    command.put("proxy_password", ""); //optional
    command.put("reset", false); //optional if true  Will use the config you passed in.

SyncContact

    JSONObject command = new JSONObject();
    command.put("command", "SyncContact");
    JSONArray phones = new JSONArray();
    phones.add("+66xxxx6");
     command.put("task_id", 1);
    command.put("phones", phones);

GetHDHead

    JSONObject command = new JSONObject();
    command.put("task_id", 3);
    command.put("command", "GetHDHead");
    command.put("jid", "xxxx");

SetHDHead

    // 192 * 192
    JSONObject command = new JSONObject();
    command.put("task_id", 4);
    command.put("command", "SetHDHeadData");
    command.put("content", "xxxx"); // base64(file content)

SetPushName

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "SetPushName");
    command.put("pushname", "xxxx");

SetStatus

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "SetStatus");
    command.put("status", "xxxx");

CreateGroup

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "CreateGroup");
    command.put("subject", "subject");

    
    JSONArray members = new JSONArray();
    members.put("111");
    members.put("2222");
    command.put("members", members);

ModifyGroupSubject

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "ModifyGroupSubject");
    command.put("jid", "xxxx");
    command.put("subject", "xxxx");

ModifyGroupDesc

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "ModifyGroupDesc");
    command.put("jid", "xxxx");
    command.put("desc", "xxxx");

GetInviteLink

    // //https://chat.whatsapp.com/ + "code"
    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "GetInviteLink");
    command.put("jid", "xxxx");
    command.put("reset", false); 

AcceptInviteToGroup

    // //https://chat.whatsapp.com/ + "code"
    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "AcceptInviteToGroup");
    command.put("token", "xxxx");

InviteGroupMember

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "InviteGroupMembers");
    command.put("jid", "xxx");

    
    JSONArray members = new JSONArray();
    members.put("111");
    members.put("2222");
    command.put("members", members);

RemoveGroupMember

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "RemoveGroupMembers");
    command.put("jid", "xxx");

    
    JSONArray members = new JSONArray();
    members.put("111");
    members.put("2222");
    command.put("members", members);

PromoteGroupMembers

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "PromoteGroupMembers");
    command.put("jid", "xxx");

    
    JSONArray members = new JSONArray();
    members.put("111");
    members.put("2222");
    command.put("members", members);

DemoteGroupMembers

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "DemoteGroupMembers");
    command.put("jid", "xxx");

    
    JSONArray members = new JSONArray();
    members.put("111");
    members.put("2222");
    command.put("members", members);

GetGroupInfo

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "GetGroupInfo");
    command.put("jid", "xxxx");

LeaveGroups

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "LeaveGroups");
    
    
        
    JSONArray members = new JSONArray();
    members.put("111");
    members.put("2222");
    command.put("groups", members);

SendText

    JSONObject command = new JSONObject();
    command.put("task_id", 2);
    command.put("command", "SendText");
    command.put("jid", "xxxx");
    command.put("content", "xxx");

SendImage

     command.put("task_id", 4);
    command.put("command", "SendImage");
    command.put("jid", "xxx");
    command.put("data", Base64.getEncoder().encodeToString(xx.ReadFileContent("xx")));
    command.put("thumbnail", Base64.getEncoder().encodeToString(xx.ReadFileContent("xxx")));
    command.put("caption", "hellokg");

SendDocument

    command.put("task_id", 4);
    command.put("command", "SendDocument");
    command.put("jid", "xxxx@g.us");
    command.put("data", Base64.getEncoder().encodeToString(xx.ReadFileContent("xxxx")));
    command.put("filename", "xxxx");

SendVideo

     command.put("task_id", 4);
    command.put("command", "SendVideo");
    command.put("jid", "xxx@s.whatsapp.net");
    command.put("data", Base64.getEncoder().encodeToString(FileUtil.ReadFileContent("xxx.mp4")));
    command.put("thumbnail", Base64.getEncoder().encodeToString(FileUtil.ReadFileContent("main.jpg")));
    command.put("caption", "hellokg");
    command.put("duration", 13000);
    command.put("width", 465);
    command.put("height", 892);

SendPTT

    // AV_CODEC_ID_OPUS, 48000, 64 * 1000, 1
    command.put("task_id", 4);
    command.put("command", "SendPTT");
    command.put("jid", "xxx@s.whatsapp.net");
    command.put("data", Base64.getEncoder().encodeToString(FileUtil.ReadFileContent("ptt.ogg")));
                  

SendVcard

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "SendVcard");
    command.put("jid", "xxx@s.whatsapp.net");
    command.put("showname", "abc");
    command.put("vcard", "BEGIN:VCARD\nVERSION:3.0\nN:;;;;\nFN:681330000000\nitem1.TEL:+68 133 000 0000\nitem1.X-ABLabel:xxx\nEND:VCARD");

SendLocation

    JSONObject command = new JSONObject();
    command.put("task_id", 111);
    command.put("command", "SendLocation");
    command.put("jid", "sendvcard");
    command.put("latitude", 98.032313465);
    command.put("longitude", 10.202121212);
    command.put("name", "xx");
    command.put("address", "xx");
    command.put("comment", "xx");

Subscribe

    JSONObject command = new JSONObject();
    command.put("command", "Subscribe");
    command.put("jid", "xxx");

License:

Gorgeous is licensed under the GPLv3+: http://www.gnu.org/licenses/gpl-3.0.html.