Skip to content

Instantly share code, notes, and snippets.

@meseven
Last active March 15, 2020 07:44
Show Gist options
  • Save meseven/258293e8d425f304343c59214121fc45 to your computer and use it in GitHub Desktop.
Save meseven/258293e8d425f304343c59214121fc45 to your computer and use it in GitHub Desktop.
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"phone_number\": \"RECIPIENT_NUMBER\",\n\t\"message\": \"hello\"\n}");
Request request = new Request.Builder()
.url("https://api.wapim.io/api/v1/whatsapp/message/text")
.method("POST", body)
.addHeader("token", "YOUR_WAPIM_TOKEN")
.build();
Response response = client.newCall(request).execute();
Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://api.wapim.io/api/v1/whatsapp/message/text";)
.header("token", "YOUR_WAPIM_TOKEN")
.body("{\n\t\"phone_number\": \"RECIPIENT_NUMBER\",\n\t\"message\": \"hello\"\n}")
.asString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment